jenkins the definitive guide

(Jeff_L) #1

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.


3.11. Memory Considerations


Continuous Integration servers use a lot of memory. This is the nature of the beast—builds will consume
memory, and multiple builds being run in parallel will consume still more memory. So you should
ensure that your build server has enough RAM to cope with however many builds you intend to run
simultaneously.


Jenkins naturally needs RAM to run, but if you need to support a large number of build processes, it is
not enough just to give Jenkins a lot of memory. In fact Jenkins spans a new Java process each time it
kicks off a build, so during a large build, the build process needs the memory, not Jenkins.


You can define build-specific memory options for your Jenkins build jobs—we will see how to do this
later on in the book. However if you have a lot of builds to maintain, you might want to define the
JAVA_OPTS, MAVEN_OPTS and ANT_OPTS environment variables to be used as default values for your
builds. The JAVA_OPTS options will apply for the main Jenkins process, whereas the other two options
will be used when Jenkins kicks off new JVM processes for Maven and Ant build jobs respectively.


Here is an example of how these variables might be configured on a Unix machine in the .profile file:


export JAVA_OPTS=-Djava.awt.headless=true -Xmx512m -DJENKINS_HOME=/data/jenkins
export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m"
export ANT_OPTS="-Xmx512m -XX:MaxPermSize=256m"

3.12. Installing Jenkins as a Windows Service


If you are running a production installation of Jenkins on a Windows box, it is essential to have it running
as a Windows service. This way, Jenkins will automatically start whenever the server reboots, and can
be managed using the standard Windows administration tools.


One of the advantages of running Jenkins on an application server such as Tomcat is that it is generally
fairly easy to configure these servers to run as a Windows service. However, it is also fairly easy to
install Jenkins as a service, without having to install Tomcat.


Jenkins has a very convenient feature designed to make it easy to install Jenkins as a Windows servers.
There is currently no graphical installer that does this for you, but you get the next best thing—a web-
based graphical installer.

Free download pdf