Installing and Using the Hudson build server

Version 77.1 by Ramsey Gurley on 2011/04/24 16:30
Warning: For security reasons, the document is displayed in restricted mode as it is not the current version. There may be differences and errors due to this.

Hudson is an "extensible continuous integration server".  It monitors repeated executions of jobs, such as building software projects, and can be used to build WebObjects applications and frameworks.  Hudson is an open source project, and can be used at no cost.  An introductory presentation on building WebObjects projects with Hudson was given by Mike Schrag at WOWODC-West in 2009, and the video can be purchased from wocommunity.org.

Setting up Hudson

There are a couple different ways to run Hudson. The easiest is to run it as a standalone application.

Standalone Installation

Information

These instructions are based on David Avendasora's setup. You may have different preferences as to where to install Hudson at or where to set its home directory to.

  1. Create a /Developer/Hudson/Home directory.
  2. Download Hudson, saving hudson.war file to /Developer/Hudson.
  3. Launch Hudson with the following command in Terminal.app:

java -DHUDSON_HOME=/Developer/Hudson/Home -jar /Developer/Hudson/hudson.war
Information

Hudson uses a built-in servlet container in stand-alone mode. If you have Tomcat running on the computer already, you should use the {{\-}}}{-}httpPort{- and {{\-ajp13Port}} options to change which ports Hudson uses.
{code}
java -DHUDSON_HOME=/Developer/Hudson/Home -jar /Developer/Hudson/hudson.war -httpPort=9080 ajp13Port=9009
{code}

  1. Point your browser to: http://localhost:8080/ 
  2. Start setting up jobs

Standalone Jenkins w/SSL

Setting up SSL for Jenkins is surprisingly easy. I found basic instructions here at SSL Setup Options. I'll repeat them here for posterity.

  1. Create a selfsigned test SSL certificate. 
    keytool genkey keyalg RSA alias selfsigned keystore keystore.jks -storepass ToPSecRet321 dname "cn=localhost"
  2. Launch Hudson. 

Unknown macro: noformat. Click on this message for details.

  1. Launch browser 
    Open "https://localhost:8080" in browser. You might get a browser warning, because the certificate is not signed by a known certificate authority. Communication is SSL-encrypted nevertheless.

Those with sharp eyes will notice the port has changed from the original instructions. That was required on Mac OS X because of permissions. Also, it's worth noting that the keytool asks for a second password for the private key of the ssl certificate. I used the same password as the keystore password and everything works. I'm not sure if that makes a difference.

Standalone Jenkins and launchd on Mac OS X

In my case I created the jenkins user and JENKINSHOME using dscl. (Using dscl to Create New Users and Groups) To make jenkins launch when the machine boots up and relaunch if it dies, I created a launch daemon. Doing that requires a plist in the correct folder. Then either reboot, or launch the daemon with launchctl on the command line.

Make sure your permissions and user:group are set correctly on the plist (-rw-r{-}{-}r- root:wheel). In /Library/LaunchDaemons/org.jenkins-ci.jenkins.plist I placed:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
       <key>UserName</key>
       <string>jenkins</string>
       <key>Label</key>
       <string>org.jenkins-ci.jenkins</string>
       <key>EnvironmentVariables</key>
       <dict>
               <key>JENKINS_HOME</key>
               <string>/usr/local/jenkins/.jenkins</string>
       </dict>
       <key>ProgramArguments</key>
       <array>
               <string>/usr/bin/java</string>
               <string>-jar</string>
               <string>/usr/local/jenkins/jenkins.war</string>
               <string>--httpPort=-1</string>
               <string>--httpsPort=8080</string>
               <string>--httpsKeyStore=/usr/local/jenkins/keystore.jks</string>
               <string>--httpsKeyStorePassword=Jenkins123</string>
       </array>
       <key>StandardOutPath</key>
       <string>/usr/local/jenkins/.jenkins/log/out.txt</string>
       <key>StandardErrorPath</key>
       <string>/usr/local/jenkins/.jenkins/log/err.txt</string>
       <key>Disabled</key>
       <false/>
       <key>KeepAlive</key>
       <true/>
       <key>RunAtLoad</key>
       <true/>
</dict>
</plist>

Servlet Container Installation on Mac OS X (10.5, 10.6)

  1. Install Tomcat from http://www.macports.org with the command

Unknown macro: noformat. Click on this message for details.

  1. Create an administrative user in /opt/local/share/java/tomcat6/conf/tomcat-users.xml.

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="tomcat" password="tomcat" roles="admin,manager"/>
</tomcat-users>

Don't forget to change the username and password after you have finished checking out the build server and start using it in production.

  1. Start Tomcat.

Unknown macro: noformat. Click on this message for details.

  1. Download Hudson, saving hudson.war somewhere for later.
  2. Create a folder for Hudson to work in: /opt/local/var/db/hudson
  3. Change ownership of that folder: chown www:_www /opt/local/var/db/hudson
  4. Add the following to /opt/local/share/java/tomcat6/conf/setenv.local:

Unknown macro: noformat. Click on this message for details.

  1. Install Hudson in Tomcat: go to http://localhost:8080, login with the user and password that you have created in tomcat-users.xml, and upload hudson.war to the Tomcat server.
  2. Goto http://localhost:8080/hudson and you can start configuring your Hudson build server.

Unknown macro: color. Click on this message for details.

  1. Tomcat is by default installed on Mac OS X Server.
  2. Create an administrative user in&nbsp;/Library/Tomcat/conf/tomcat-users.xml.

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="tomcat" password="tomcat" roles="admin,manager"/>
</tomcat-users> 

{color:#000000}Don't forget to change the username and password after you have finished checking out the build server and start using it in production.&nbsp;{color}

  1. The way to start it depends on the version. The current way is to go to the Web Settings in Server Admin, Settings, General, check the Tomcat checkbox. Restart the WebServer.&nbsp;
  2. Unknown macro: color. Click on this message for details.
    Unknown macro: color. Click on this message for details.
    http://hudson-ci.org/latest/hudson.war, saving&nbsp;hudson.war&nbsp;somewhere for later.
  3. Create a folder for Hudson to work in:&nbsp;/Library/hudson
  4. Change ownership of that folder:&nbsp;chown appserver:sys /Library/Hudson
  5. Add the following to&nbsp;/Library/Tomcat/bin/setenv.sh:

Unknown macro: noformat. Click on this message for details.

  1. Make sure that you are using UTF8 in the Connector, by adding

Unknown macro: noformat. Click on this message for details.

to the Connector in /Library/tomcat/conf/server.xml in such a way:

Unknown macro: noformat. Click on this message for details.

  1. Install Hudson in Tomcat: go to http://localhost:8080, login with the user and password that you have created in tomcat-users.xml, and upload hudson.war to the Tomcat server.
  1. Goto http://localhost:8080/hudson&nbsp;and you can start configuring your Hudson build server.

Building WO Apps

  • Check out sh