Thursday, March 15, 2012

Change Jenkins or Hudson HTTP port number

One of the things server administrators of Jenkins or Hudson CI solutions often want to do, is to change the HTTP administration port.

I'll show you how, in 4 different ways: For Windows (service), WAR file deployed in GlassFish, Natively in linux and finally, using wrapper.

It's pretty simple:


For Windows (service installation)
Edit jenkins.xml or hudson.xml
Where is the jenkins.xml or hudson.xml?

Navigate to the directory where you installed Jenkins/Hudson and you will see the XML at the root. Open it and look for tag, there will be all the command arguments to be used when starting up Jenkins or Hudson.

One of those arguments is --httpPort, typically:
--httpPort=8080.
Change 8080 to whatever port number you want.


WAR File, deployed in GlassFish
You will need to change the default HTTP port in GlassFish.


Natively installed in linux
At least for RHEL, you should be able to find the /etc/sysconfig/hudson, which typically has the following line, among other configuration ones:
HUDSON_PORT="8080".
Change 8080 to whatever port number you want.


Other linux distributions (using wrapper)
At the time of writing, Arch Linux's AUR Jenkins version uses wrapper to launch itself from the .war file.

Edit /opt/jenkins/conf/wrapper.conf, find wrapper.app.parameter.2=--httpPort=8070 (typically).
Change 8070 to whatever port number you want.

This wrapper solution applies to any system using wrapper, not only linux.


Some useful links:
Forum talk about the Windows version
Configuration tutorial in RHEL