3.10. Running Jenkins on an Application Server

Since Jenkins is distributed as an ordinary WAR file, it is easy to deploy it on any standard Java application server such as Tomcat, Jetty, or GlassFish. Running Jenkins on an application server is arguably more complicated to setup and to maintain. You also loose certain nice administration features such as the ability to upgrade Jenkins or restart the server directly from within Jenkins. On the other hand, your system administrators might be more familiar with maintaining an application running on Tomcat or GlassFish than on the more obscure Winstone server.

Let’s look at how you would typically deploy Jenkins onto a Tomcat server. The easiest approach is undoubtedly to simply unzip the Tomcat binary distribution onto your disk (if it is not already installed) and copy the jenkins.war file into the Tomcat webapps directory. You can download the Tomcat binaries from the Tomcat website .

You start Tomcat by running the startup.bat or startup.sh script in the Tomcat bin directory. Jenkins will be available when you start Tomcat. You should note that, in this case, Jenkins will be executed in its own web application context (typically “ jenkins ”), so you will need to include this in the URL you use to access your Jenkins server (e.g., http://localhost:8080/jenkins ).

However, this approach is not necessarily the most flexible or robust option. If your build server is a Windows box, for example, you probably should install Tomcat as a Windows service, so that you can ensure that it starts automatically whenever the server reboots. Similarly, if you are installing Tomcat in a Unix environment, it should be set up as a service.