Two Guys Arguing

Pro Tips: Run Multiple Jenkins CI Servers on a Single Machine

Posted in software development, software testing by benjaminplee on 07.24.11

Jenkins (or Hudson if you work for Oracle) is a great, simple and steady continuous integration and build server.  One of its greatest features is that despite being packaged as a standard .war ready to be dropped into your JEE web container of choice … it also contains an embedded web container that makes the .war everything you need in most situations.  Simply run

java -jar jenkins.war

and up starts Jenkins on port 8080 in all of its glory.  All of Jenkins’ configuration files, plugins, and working directories go under <USER_HOME>/.jenkins by default.  Perfect.

Except if you want to run multiple instances on the same machine.  We are going to get a config folder collision.  It turns out this is a piece of cake, but the docs are hard to find.  Jenkins will use a JENKINS_HOME path environement variable for its configuration files if one is set so a simple change means we can run Jenkins out of any directory we desire:

java -DJENKINS_HOME=/path/to/configs -jar jenkins.war

What about the port you say?  Winston, the embedded web container used, has a simple property for this too:

java -DJENKINS_HOME=/path/to/configs -jar jenkins.war --httpPort=9090
About these ads

4 Responses

Subscribe to comments with RSS.

  1. Brian Smith (@brianthesmith) said, on 08.11.11 at 8:52 pm

    Is the config folder location also necessary when running as a war from inside a full tomcat? It doesn’t just blow the config folder out into tomcat somewhere?

  2. benjaminplee said, on 08.11.11 at 9:06 pm

    Honestly, I don’t know. I have always run Hudson/Jenkins directly using the embedded web application server. Given how easy it is to spin up slave nodes via JNLP, we didn’t end up going this direction.

  3. Chris said, on 01.10.14 at 12:22 am

    Really helpful, I did exactly as you said and worked. tks!!

  4. Pedro de Almeida said, on 03.12.14 at 12:40 pm

    Thank you, this tip was really helpful.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.