jenkins-pipelinejenkins-pluginsbackupjenkins-cli

backup and restore to jenkins in case of disaster


I'm planning to practice jenkins. I want to set up 2 jenkins server on ec2 instance and one is production server another is backup. I want the jobs in the production server automatically backed up to the backup server. In case of an disaster I want to restore it to the production server. Can anyone help me with how can I implement this in realtime

I plan to connect them with ssh and run a script in backup that takes the jobs from production server using build triggers.


Solution

  • The simple solution is to backup the entire JENKINS_HOME folder. In case you need it for disaster recovery, just copy the whole thing back in. There is a number of files inside the JENKINS_HOME folder that are important to backup, such as the jobs folder which holds configuration of all the jobs, as well as a number of files that don't require backing up. If you want to go into detail, the official docs can give you the specifics of what needs backing up.