Web Server Setup: 05 - Hudson & Jenkins

Hudson Installation under Tomcat

Copy hudson.war to necessary locations

Copy hudson.war to \xampp\Hudson
Copy hudson.war to \xampp\tomcat\webapps\
tomcat will automatically unpack and implement the application

Create a \hudson\hudson_start.cmd

Use this to test the Hudson installation and to verify it can start successfully

set  DEV_HOME=D:\Java
set JAVA_HOME=%DEV_HOME%\java32\jdk6
set PATH=%JAVA_HOME%\bin;%PATH%
java -jar hudson.war

TomCat\bin\setenv.bat

Once Hudson is working on its own, add it to tomcat and create an environment variable for HUDSON_HOME
catalina.bat will seek and run setenv.bat if it exists.

set CATALINA_OPTS=-DHUDSON_HOME=D:\xampp\hudson\.hudson -Xms256m -Xmx512m -XX:MaxPermSize=128m

Change tomcat-users.xml so ‘tomcat’ user can access the GUI

<role rolename="tomcat"/>
<user username="tomcat" password="tomcat" roles="standard,manager,manager-gui"/>

Hudson listens on port 49198

INFO: Attained Finalizing set up
Apr 5, 2013 1:04:10 AM hudson.model.Hudson$5 onAttained
INFO: Completed initialization
Apr 5, 2013 1:04:10 AM hudson.TcpSlaveAgentListener <init>
INFO: JNLP slave agent listener started on TCP port 49198
Apr 5, 2013 1:04:19 AM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate

Jenkins

tomcat\bin\setenv.bat

set JENKINS_HOME=D:\xampp\jenkins\jenkins

To run Jenkins, minimally you need to have JRE 1.5 or later. After you download jenkins.war, you can launch it by executing java -jar jenkins.war. This is basically the same set up as the test drive, except that the output will go to console, not to a window.

Alternatively, if you have a servlet container that supports Servlet 2.4/JSP 2.0 or later, such as Glassfish, Tomcat 5, JBoss, Jetty 6, etc., then you can deploy jenkins.war as you would any WAR file. See this document for more about container-specific installation instruction.

Once the war file is exploded, run chmod 755 jenkins in the exploded jenkins/WEB-INF directory so that you can execute this shell script.

If you're running on Windows you might want to run Jenkins as a service so it starts up automatically without requiring a user to log in. The easiest way to achieve this is to simply download and install Jenkins via the native Windows installer, which can be found on the Jenkins main page. Just download the .zip file, unpack it, and click through the install wizard. The wizard both installs Jenkins and sets up the Jenkins Windows service for you.

Another way to run Jenkins as a service is to first install Tomcat as a service and then deploy Jenkins to it in the usual way. Another way is to use the Java Service Wrapper. However, there may be problems using the service wrapper, because the Main class in Jenkins in the default namespace conflicts with the service wrapper main class. Deploying inside a service container (Tomcat, Jetty, etc.) is probably more straightforward, even for developers without experience with such containers.