6

I recently saw a blog, which suggested two instances of Jenkins can run on same Windows machine: Two Guys Arguing, Pro Tips: Run Multiple Jenkins CI Servers on a Single Machine.

But rather than deploying the jenkins.war, I actually installed another Jenkins on top of already installed Jenkins on my Windows machine, Which caused the previous Jenkins to stop.

Gerold Broser
  • 14,080
  • 5
  • 48
  • 107
sandejai
  • 931
  • 1
  • 15
  • 22

2 Answers2

4

I made the mistake of installing Jenkins using standard Windows installation, instead of deploying the war like:

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

which caused a change in Jenkins service's Path to executable. (Because during the 2nd Jenkins installation, I had chosen a different JENKINS_HOME_1 path.)

To make another mistake, I tried to uninstall this second installation, but Windows Jenkins service was still having exe path as JENKINS_HOME_1 (former C:/Jenkins/jenkins.exe).

To come out of this I had to change this Path to executable via:

  • Command line:

    sc config Jenkins binPath="C:\Program Files (x86)\Jenkins\jenkins.exe"
    

or

  • Registry change:

    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Jenkins\ImagePath="C:\Program Files (x86)\Jenkins\jenkins.exe"
    

I will try the java -jar jenkins options again though.

Gerold Broser
  • 14,080
  • 5
  • 48
  • 107
sandejai
  • 931
  • 1
  • 15
  • 22
2

Steps to install next jenkins instance:

  1. You need make the full copy of working jenkins folder to second location. for example D:\jenkins2

  2. next you need to edit inside this folder file jenkins.xml. Modify line

    <arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8083 --webroot="%BASE%\war"</arguments>
    

    and set value --httpPort to expected value.

  3. run cmd.exe as Administrator

  4. inside cmd run command: sc.exe create JenkinsUpgrade binpath= "D:\jenkins2\jenkins.exe" displayname="Jenkins for Upgrade"

    where JenkinsUpgrade is servicename and have to be unique,

    binpath contains desired path of new jenkins instance,

    displayname is the name displayed in services.

    This command creates a new instance of a jenkins server in a separated directory.

To uninstall this instance you can use command sc delete JenkinsUpgrade.

Neuron
  • 5,141
  • 5
  • 38
  • 59
simon
  • 21
  • 1