Logaholic.de

Avatar

queer as code!

How to install cruisecontrol/phpUnderControl in Debian Lenny

Some time ago, I posted a small tutorial how to install phpundercontrol in a fresh Debian Etch machine. As Debian Lenny is now out for some time I’d like to update this small tutorial for its changes.

The good thing: You don’t need to use backports anymore – the sun-java6-bin/sun-java6-jre packages are available in the lenny non-free tree.

Therefore, the first thing to do is check your /etc/apt/sources.list if it checks for non-free packages (does not per default).

deb http://ftp.debian.org/debian/ lenny main non-free
deb-src http://ftp.debian.org/debian/ lenny main non-free

The rest stays mostly the same:

# update apt to include non-free packages
apt-get update

# install packets (java and subversion)
apt-get install sun-java6-bin sun-java6-jre
apt-get install subversion

# add symlink from /usr/bin/java to /bin/java for the cruisecontrol start script
ln -s /usr/bin/java /bin/java

# install apache (mainly for phpmyadmin) and php5 + cli
apt-get install apache2-mpm-prefork
apt-get install php5 php5-cli php5-dev
apt-get install php-pear make

# install xdebug (needed for phpunit)
pecl install xdebug
echo "zend_extension=/usr/lib/php5/20060613+lfs/xdebug.so" >> /etc/php5/cli/php.ini

# install phpunit and phpundercontrol via pear
pear upgrade --force pear
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear install phpunit/phpunit
pear install --alldeps channel://components.ez.no/Graph
pear install --alldeps channel://pear.phpunit.de/phpundercontrol-0.5.0

# get and extract cruisecontrol
apt-get install unzip wget
cd ~
wget http://freefr.dl.sourceforge.net/sourceforge/cruisecontrol/cruisecontrol-bin-2.8.3.zip
unzip cruisecontrol-bin-2.8.3.zip -d /opt
cd /opt
ln -s cruisecontrol-bin-2.8.3 cruisecontrol

# run phpundercontrol modifications against cruisecontrol
phpuc install /opt/cruisecontrol

# first testrun
cd /opt/cruisecontrol
./cruisecontrol.sh

How to install cruisecontrol/phpUnderControl in Debian Etch

This is how I install cruisecontrol/phpUnderControl, including all dependencies, in a fresh Debian Etch machine.

# add the backport mirror for java and subversion
echo "deb http://www.backports.org/debian etch-backports main contrib non-free" >> /etc/apt/sources.list

# add the backport mirror key
gpg --keyserver hkp://pgp.mit.edu --recv-keys 16BA136C
gpg --armor --export 16BA136C | apt-key add -

apt-get update

# install backports (java and subversion)
apt-get -t etch-backports install sun-java6-bin sun-java6-jre
apt-get -t etch-backports install subversion

# install apache (mainly for phpmyadmin) and php5 + cli
apt-get install apache2-mpm-prefork
apt-get install php5 php5-cli php5-dev
apt-get install php-pear make

# install xdebug (needed for phpunit)
pecl install xdebug
echo "zend_extension=/usr/lib/php5/20060613+lfs/xdebug.so" >> /etc/php5/cli/php.ini

# install phpunit and phpundercontrol via pear
pear upgrade --force pear
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear install phpunit/phpunit
pear install --force --alldeps channel://components.ez.no/Graph
pear install --force --alldeps channel://pear.phpunit.de/phpundercontrol-0.4.7

# get and extract cruisecontrol
apt-get install unzip wget
cd ~
wget http://freefr.dl.sourceforge.net/sourceforge/cruisecontrol/cruisecontrol-bin-2.8.2.zip
unzip cruisecontrol-bin-2.8.2.zip -d /opt
cd /opt
ln -s cruisecontrol-bin-2.8.2 cruisecontrol

# run phpundercontrol modifications against cruisecontrol
phpuc install /opt/cruisecontrol

# first testrun
cd /opt/cruisecontrol
./cruisecontrol.sh

Apache, SSL and phpUnderControl

After installing phpUnderControl I wanted to use my existing apache, running with ssl, to proxy requests to the “java stuff”. After failing with various mod_proxy reverse proxying attempts I learned how to use mod_rewrite for this purpose.

ProxyPreserveHost on
RewriteEngine on

RequestHeader Set Proxy-keysize 512
RequestHeader Set Proxy-ip %{REMOTE_ADDR}e
RequestHeader Set Host example.org:443

RewriteRule ^/$ /cruisecontrol/ [R,L]

RewriteRule ^/cruisecontrol$ /cruisecontrol/ [R,L]
RewriteRule ^/cruisecontrol/(.*) http://localhost:8080/cruisecontrol/$1 [P,L]

RewriteRule ^/dashboard$ /dashboard/ [R,L]
RewriteRule ^/dashboard/(.*) http://localhost:8080/dashboard/$1 [P,L]

Unfortunately, phpUnderControl didn’t get the baseURL right with this setup. I didn’t want to dive into mod_jk yet, which I had read should also work (or be the more clean/generic solution), so i poked at the phpUnderControl code with grep. And now it just works fine.

You have to edit the files error.jsp, index.jsp, main.jsp and old_index.jsp in /opt/cruisecontrol/webapps/cruisecontrol/: Just place your https-url in the baseURL strings (https://example.org/cruisecontrol/).

The CruiseControl dashboard (/dashboard) does not need any tweaking for https.

One could even add any apache authentication module in front of phpUnderControl now ;)

,