Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keeping two jenkins server in sync

I have

  • a usual jenkins master jettysburg:8888/jenkins,
  • and a failover jenkins master jettyperry:8888/jenkins.

I am planning to use mercurial to keep the jobs directory of the two masters in sync.

Usually, most of the time, new jobs and builds are defined and executed at jettysburg:8888. Then I would need to sync jettyperry:8888 with whatever took place in jettysburg:8888, and I plan to perform the push once a day.

Which means, after a failover to jettyperry:8888, the push would be performed the converse direction.

I have been using mercurial for my non-programming/coding files (like word, excel and text files) for that purpose, as a means to perform incremental and redundant backup of my "mission critical" files, as well as versioning them.

I am also hoping to depend on mercurial to backout from changes made to jenkins jobs.

Is using mercurial to sync two Jenkins masters a good idea? Is there a better way to keep two Jenkins servers in sync? In this case, I am syncing only the jobs tree.

like image 678
Blessed Geek Avatar asked Jul 08 '16 17:07

Blessed Geek


People also ask

Do we need to move Jenkins to new servers?

For some organizational reasons we have to move Jenkins to new servers. As we are on a old version so a updated is also need on same time. What are things we should consider. Also not sure if we need to configure all jobs in new instance manually or there is faster way to clone them from existing instance.

How to change the access url of Jenkins server?

You can also change the access URL of Jenkins server like it is defined in attached screenshot- 5. Configure Credentials To add/update credentials you need to click on Credentials option from left side menu. Now you will see the list of all added domains and their credentials and on clicking any credential you can update it or add a new one.

How to manage Jenkins plugins?

Here you can configure the Jenkins settings from Configure settings option in the side menu, you are required to update plugins and setup project SDK before setting up the project. Manage plugins allows to install and update plugins for Jenkins server.

What is the configure system option in Jenkins?

As a Jenkins admin, Configure System ( Option to configure Jenkins settings) is the most prominent section of Jenkins. Here, the admin can define global settings that apply to all the projects that are present in Jenkins. Now, the question is how to navigate towards the Configure System option in Jenkins.


1 Answers

As long as you don't need shared job state between the servers (they run in their own little universes) and you keep the same plugin modules and libraries on both Jenkins servers, using some form version control to keep the actual job definitions is fine.

My office does this with git. We have a development and a production set of jenkins servers. We maintain a base linux image with jenkins install with all necesarry modules and locally install libraries (like nodejs and such). We then spin up an instance of the image and pull down the jobs.

The one thing that can be a challenge is keeping in sync things like credentials and Jenkins config settings--you might need to keep them as part of the base image.

If you need the job queues to persist and be shared (like a master-master setup) you can look at this plugin, which allows multiple jenkins masters to share the same job queue: https://wiki.jenkins-ci.org/display/JENKINS/Gearman+Plugin

like image 157
Ray Avatar answered Oct 18 '22 20:10

Ray