Friday, August 14, 2009

CruiseControl on CentOS: Setup

In this post I want to present a simple way to install and configure CruiseControl (hereafter just CC) to run on CentOS. For the configuration part, please refer to the Fedora procedure, since it is the same. The only difference is in how to install the CC to be similar to the RPM instalation.

1. Since I could not find any RPM specific for CentOS I have taken the binaries available at CC home-page:

You will also need the following packages:

yum -y install \

And Sun's Java JDK:

2. Decompress the binary package from CC into /opt dir:

unzip cruisecontrol-bin-<VERSION>.zip -d /opt/
ln -s /opt/cruisecontrol-bin-<VERSION> /opt/cruisecontrol

3. Edit the starting script at: /opt/cruisecontrol/

3.1. Add the following lines, right after the commented CC_OPTS variable:


3.2. Check if the default port is free:

nc -z localhost 8080 || echo "Port is free" # default cruise control port AND tomcat's default port, watch this out

OBS.: It MUST yeld NOTHING. If it returns a "succeeded" it means that the port is occupied and you need to change it to another one.

3.3. Change the final calling statements for:

cat >> /opt/cruisecontrol/ << __END__
# PAY ATTENTION: you ABSOLUTELY need to change the argument in the \"-webport\" if the port 8080 is already occupied
PATH=\${JAVA_HOME:-/usr}/bin:\$PATH \\
CC_OPTS=\"\${CRUISE_OPTS:-}\" \\
\$JAVA_HOME/bin/java \\ \\
\"-Dcc.library.dir=\$LIBDIR\" \\
\"-Djetty.logs=$JETTY_LOGS\" \\
-jar \"\$LAUNCHER\" \$@ \\
-configfile /etc/cruisecontrol/config.xml \\
-jmxport \${CRUISE_JMX_PORT:-8000} \\
-rmiport \${CRUISE_RMI_PORT:-1099} \\
-webport \${CRUISE_WEB_PORT:-8080} \\

echo \$CMD
# necessary to make the "out-of-box" version work regardless of the calling point
cd /var/spool/cruisecontrol/
eval \${CMD}
echo \$! > /var/spool/cruisecontrol/
mv /opt/cruisecontrol/ /opt/cruisecontrol/
cat > /opt/cruisecontrol/ << __END__
su - cruise -c /opt/cruisecontrol/
chmod 755 /opt/cruisecontrol/

4. Add the cruise user:

groupadd cruise
useradd \
--comment "CruiseControl User" \
--home-dir "/var/spool/cruisecontrol" \
--gid cruise \
--shell /bin/bash \

5. Verify if CC is running:


5.1. Check if it is up and running by accessing: http://localhost:8080/dashboard (remember that if you changed the default port the value 8080 must be changed as well).

5.2. If it is up and running you may want to make it starts when the server starts:

cat >> /etc/rc.local << __END__

# starts the CruiseControl

Related post: CruiseControl on Fedora: Setup

No comments: