Hudson, Meet JavaServiceWrapper

October 01, 2008 By Tim OBrien

2 minute read time

Here at Sonatype, we're working on a continuous integration build farm for testing the various open source projects we're involved with, including Nexus, m2eclipse, and of course Apache Maven. Yesterday, as part of this effort, I took a minute to repurpose some of the work we've done with JavaServiceWrapper for Nexus. By combining some of the techniques found in the Nexus build with the Hudson WAR file, I was able to create a bundle that wraps Hudson in JSW startup scripts and configuration. Obviously, this isn't a momentous achievement, but it is very convenient for anyone who wants to run a very simple Hudson instance, and have that instance recover automatically after a machine restart.

You can download the bundle at http://repository.sonatype.org/content/groups/public/org/sonatype/hudson/hudson-jsw/1.254-2/, or reference it via Maven using the following information:

Finally, to bring this full circle for RedHat/Fedora/CentOS users (in short, anyone with the chkconfig utility), you can integrate the above Hudson-JSW bundle into your sys-V init system using the following script in your /etc/init.d directory:

#!/bin/bash
#
# /etc/rc.d/init.d/atd
#
# Starts the hudson daemon
#
# chkconfig: 345 97 3
# description: Runs the Hudson CI server
# processname: hudson

export JAVA_HOME=/opt/java/sdk/1.6
export PATH=$JAVA_HOME/bin:$PATH

sudo -u hudson /opt/hudson/bin/jsw/linux-x86-64/hudson $*

Obviously, your own details may vary for user and JAVA_HOME.

Tags: Sonatype Says

Written by Tim OBrien

Tim is a Software Architect with experience in all aspects of software development from project inception to developing scaleable production architectures for large-scale systems during critical, high-risk events such as Black Friday. He has helped many organizations ranging from small startups to Fortune 100 companies take a more strategic approach to adopting and evaluating technology and managing the risks associated with change.