Running Jenkins using SMF on Solaris 11
by Andrew Kroh
Jenkins (formerly known as Hudson) is a continuous integration tool. Installing Jenkins as a daemon service on Solaris 11 is pretty simple. Below are the steps I took to get it up and running using SMF in Solaris 11. SMF or Service Management Facility is the default way to manage services in Solaris 10 and 11.
Create New User to Run Jenkins
groupadd jenkins
useradd -g jenkins -d /export/home/jenkins -m -s /bin/bash jenkins
passwd jenkins
Configure the User’s Environment
sudo su - jenkins
mkdir workspace
wget http://mirrors.jenkins-ci.org/war-stable/latest/jenkins.war
echo source .bashrc > .bash_profile
Create a .bashrc with the appropriate settings for your jenkins user.
Create a start_jenkins.sh script.
Add execute permissions to the new script.
Configure SSH to allow CVS only for Jenkins
Generate a SSH key for jenkins.
Append the contents of id_dsa.pub to the ~/.ssh/authorized_keys2 file on the system that you want to allow you to log in to.
Add command="/usr/bin/cvs server",no-port-forwarding,no-X11-forwarding,no-agent-forwarding"
to the beginning of the line you just appended to limit the commands that Jenkins can
execute when SSH’ing to the server.
Test your SSH connection once so that you can accept the server’s key or else Jenkins will hang on the first CVS checkout.
Configure SMF to Start Jenkins as a Service
You need to load a manifest file into SMF that tells it how to run Jenkins.
Place the following manifest file in /var/svc/manifest/application
and then
load it into SMF using svccfg.
Listing: /var/svc/manifest/application/jenkins.xml
Now with the manifest file on your system. It’s time to load it into SMF.
You can verify that it started by running this command and checking the state.
If you need to debug something you can have a look at the log file for your
jenkins service at /var/svc/log/application-jenkins:default.log
.
Bonus: Running Jenkins Behind Apache using Reverse Proxy
I already have a web service running on port 80, and I wanted to be able to access Jenkins through that port. To do this I added a reverse proxy in Apache. If you have any access controls in your apache configuration then its important that you set the host address to 127.0.0.1 so that someone can’t go around your proxy and hit Jenkins directly. Add the following to your httpd.conf to be able to access Jenkins.
Subscribe via RSS