Friday, April 27, 2012

New version of Jenkins, Upgrading your BitNami Jenkins Stack

Last week we announced the first version of our BitNami Jenkins Stack. This week a new Jenkins version was announced and we have already updated our stack. However, in some cases it is more convenient to upgrade the installation in place than re-installing. This post explains briefly how to upgrade a Jenkins installation manually.

The first step is to understand where the JENKINS_HOME variable is pointing to. That directory is where all your data is stored.

In BitNami we define JENKINS_HOME in the apache-tomcat/conf/Catalina/localhost/jenkins.xml file pointing to apps/jenkins/jenkins_home. If you want to upgrade Jenkins keeping your data, you just need to download the latest jenkins.war file, copy it in your apache-tomcat/webapps directory and restart Tomcat. It is recommended to create a backup of the previous jenkins.war file, just in case you find issues when upgrading.


On Linux and OSX you can execute the following steps to perform the above (notice that the installation directory is /opt/bitnami in the BitNami virtual appliances and BitNami Amazon Images):


$ cd <installation_directory>
$ ./ctlscript.sh stop
$ cp apache-tomcat/webapps/jenkins.war apps/jenkins/jenkins.war.bak
$ wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war
$ mv jenkins.war apache-tomcat/webapps/
$ ./ctlscript.sh start


On Windows you can stop the servers from the Start Menu entry or using the graphical tool that you can find in your installation directory. Using the file explorer go to where you installed the BitNami Jenkins Stack. Copy the jenkins.war file from the apache-tomcat/webapps directory to apps/jenkins. Download the latest jenkins.war file and copy it in apache-tomcat/webapps. Now just start the server from the Start Menu or using the graphical tool.

Alternatively to the process above, you can download a new BitNami Jenkins Stack. You can install it to a different location (remember to stop the previous install so there are no port conflicts) and point it to your previous JENKINS_HOME path by editing the file  apache-tomcat/conf/Catalina/localhost/jenkins.xml.