You are not logged in. Click here to log in.

codeBeamer ALM

Search In Project

Search inClear

Tags:  Apache Mercurial
codeBeamer 6.0.3 and higher have build in Smart HTTP support thus no apache installation is required any more. Accessing Mercurial via Apache is deprecated and not supported.

Configuring Smart HTTP for Mercurial on Windows

To be able to use Smart HTTP on windows you have to execute the folliowing steps:

  • install Python
    http://www.python.org/ftp/python/2.6.6/python-2.6.6.msi

  • download the Mercurial module from here
    [https://bitbucket.org/tortoisehg/files/downloads/mercurial-4.4.1.win32-py2.7.msi]

  • install the Mercurial module to the same directory where you installed python
  • in general.xml configure the python executable location. If you installed python to c:\python26then you have to add this line to the config file:
    <scc>
      <hg python-exec="c:\Python26\python.exe"></hg>
    </scc>

Configuring Apache for Mercurial

Accessing Mercurial Repositories via Apache has a couple of advantages:

  • no setup is required for an extra port for external access
  • no SSH key setup is required.

This page describes how to setup Apache to serve Mercurial repositories.

codeBeamer must be installed and started before this configuration can be used.

Windows

Please choose the 32 bit version of all software mentioned below even if you are running 64 bits Windows We strongly recommended using the same versions shown on this page.

This description assumes that codeBeamer has been installed into

C:\Dokumente und Einstellungen\zk\Eigene Dateien\CB
.
  • Download Apache 2.2.17 from the location below or from a mirror:
    http://ftp-stud.hs-esslingen.de/pub/Mirrors/ftp.apache.org/dist//httpd/binaries/win32/httpd-2.2.17-win32-x86-no_ssl.msi
    
  • Install Apache to the default location (
    C:\Programme\Apache Software Foundation
    ) and take Typical Installation.
  • Download Python from the location below
    http://www.python.org/ftp/python/2.6.6/python-2.6.6.msi
    
  • Install Python into
    C:\Programme\Python-2.6.6
  • Download the Mercurial runtime from the location below. Note that this will not install a complete Mercurial client.
    http://mercurial.selenic.com/release/windows/mercurial-1.7.1.win32-py2.6.exe
    
  • Install Mercurial into the same location where Python is installed (
    C:\Programme\Python-2.6.6
    ).
  • Download Apache mod_wsgi module from the location below:
    http://modwsgi.googlecode.com/files/mod_wsgi-win32-ap22py26-3.3.so
    
  • Copy mod_wsgi-win32-ap22py26-3.3.so into Apache modules directory
    copy mod_wsgi-win32-ap22py26-3.3.so "C:\Programme\Apache Software Foundation\Apache2.2\modules\mod_wsgi.so"
    
The name of the output file must be mod_wsgi.so!
  • Edit Apache Configuration
Click on Start->Alle Programme->Apache HTTP Server 2.2->Configure Apache Server->Edit the Apache httpd.conf Configuration File!

Append the lines of

C:\Dokumente und Einstellungen\zk\Eigene Dateien\CB\repository\scmweb\httpd.conf.hg
to the end of Apache httpd.conf.

The variable WSGIPythonPath must contain the Python installation directory.

WSGIPythonPath "C:/Programme/Python-2.6.6"
  • Test Apache Configuration
Click on Start->Programme->Apache HTTP Server 2.2->Configure Apache Server->Test Configuration
  • Restarting Apache
Click on Start->Programme->Apache HTTP Server 2.2->Configure Apache Server->Control Apache Server->Restart

Linux/Unix

It is important that codeBeamer operating system user and apache belong to the same GID!

Ubuntu

CodeBeamer requires Mercurial 1.8.5 (or newer).

This description assumes that codeBeamer has been installed into /home/codebeamer/CB.

  • Install Apache HTTP Server using the following command:
    sudo apt-get install apache2
    
  • Install Mercurial using the command below
    sudo apt-get install mercurial
    

    Caution: On Ubuntu releases older than 12.04 this may install an obsolete Mercurial version. In this case, you have to manually find and install a newer supported version, e.g:
    sudo add-apt-repository ppa:mercurial-ppa/releases
    sudo apt-get update
    sudo apt-get install mercurial
    hg --version
    
  • Finally install the
    mod_wsgi
    apache module:
    sudo apt-get install libapache2-mod-wsgi
    
    and execute this command
    sudo ln -s /etc/apache2/mods-available/wsgi.load /etc/apache2/mods-enabled/wsgi.load
  • Copy httpd.conf.hg
    sudo cp /home/codebeamer/CB/repository/scmweb/httpd.conf.hg /etc/apache2/mods-available/hg.conf
  • Edit
    /etc/apache2/mods-available/hg.conf
    and replace
    PYTHON_PATH
    with the path to the library containing the Python libraries. For example:
    WSGIPythonPath /usr/lib/pymodules/python2.6
    
  • Enable hg support
    sudo ln -s /etc/apache2/mods-available/hg.conf /etc/apache2/mods-enabled/hg.conf
    

After these steps test the apache configuration with the following command:

sudo apache2ctl configtest

If the command runs without errors then the configuration's OK. You can restart apache:

sudo /etc/init.d/apache2 restart

RedHat

CodeBeamer requires Mercurial 1.8.5 (or newer).

This description assumes that codeBeamer has been installed into

/home/codebeamer/CB
.
  • Install the required software components using the following command:
    sudo yum install httpd python mercurial mod_wsgi
    

    This will install Apache HTTP Server, Python, Mercurial and the
    mod_wsgi
    module.
    Caution: All RedHat releases (at least until RHEL 6.2) contain an obsolete Mercurial version.
    hg --version
    
    In this case, you have to manually find and install a newer supported version, e.g. from
  • Copy the file
    /home/codebeamer/CB/repository/scmweb/httpd.conf.hg
    to
    /etc/httpd/conf.d/hg.conf
    
  • Now edit
    /etc/httpd/conf.d/hg.conf
    and replace
    PYTHON_HOME
    with the path to the library containing the Python libraries. For example:
    WSGIPythonPath /usr/lib64/python2.6:/usr/lib/python2.6
    
  • Finally test your configuration:
    sudo apachectl configtest
    
and if everything's fine restart Apache
sudo /etc/init.d/httpd restart

Add codeBeamer user to Apache group (gid)

If apache and codeBeamer operating system users are different (can be checked using
id
command) apache and codeBeamer operating system users must belong to the same system group (gid).

Typically the name of the apache group is

www-data
on Ubuntu and
apache
on Redhat (check your /etc/group).

We suggest to add the codeBeamer user to the apache group.

The example below shows that codeBeamer user id is 1002 and it belongs to gid 33 used by apache:

$ id
uid=1002(codebeamer) gid=33(www-data) groups=33(www-data),111(admin)

Example: Clone a codeBeamer Repository and Commit with an Associated Issue

  • Create a new codeBeamer project with a Managed Mercurial Repository and the name of the repository should be hgtest. Follow the steps described in Creating Managed Repositories.
  • Create a new issue in the Bugs tracker of the new project. This example assumes that the new issue gets the ID 1000 and the project was created by the account bond which has the password 007.
  • On Linux/Unix hg must be in your
    PATH
    . In Windows add Mercurial to the
    PATH
    with the command below:
    set PATH="C:\Dokumente und Einstellungen\zk\Eigene Dateien\CB\libexec\hg";%PATH%
    
  • Cloning the Repository
    hg clone http://bond:007@localhost/hg/hgtest
    
  • Adding a New File to the Repository
    cd hgtest
    echo hello > readme.txt
    hg add readme.txt
    
  • Committing (with a codeBeamer Issue) and Pushing Changes into the Upstream Repository
    hg commit -u bond -m "#1000 just a commit"
    hg push
    
  • Now after refreshing the browser window with issue details and the change set should appear under SCM Commits tab.

MercurialEclipse Plugin can be also used to work with Managed Mercurial Repositories.

Hints ant tips

Solving HTTP Error 413: Request Entity Too Large errors

If you receive an error like this - which can happen if you have lots of heads or branches in Mercurial:

hg pull --verbose
pulling from https://<url.of.mercurial.repo>
searching for changes
abort: HTTP Error 413: Request Entity Too Large

The fix is to increase the HTTP request sizes from the default 16 Kbytes to 64kbytes.

For this edit the following files, both in Apache configuration and also in codeBeamer's tomcat installation:

/etc/httpd/conf/worker.properties

#worker.ajp13_worker.max_packet_size=16384
worker.ajp13_worker.max_packet_size=65536

/etc/httpd/conf/httpd.conf

#LimitRequestFieldSize 12392
LimitRequestFieldSize 65536
#LimitRequestLine 12392
LimitRequestLine 65536

and $CB_HOME/tomcat/conf/server.xml

<Connector port="8009"
            protocol="AJP/1.3"
            ... etc...
            <!--packetSize="16384"-->
             packetSize="65536"
        />

For more details see: https://www.keycdn.com/support/413-request-entity-too-large/