In the previous section we have successfully installed the Jenkins on Another machine, now it’s time to focus on our objectives.
Objectives:
- Transfer all existing projects/pipelines
- Transfer all existing plugins
- Transfer all configuration settings: System Global Tool, Security, Nodes, Credentials
Avoid the following: Don’t go for the shortcuts like Backup Manager, GbackUp, ThinPlugin etc… since they will not work either not due to different versions or will not cover all the mentioned objectives.
Copy and Transfer Full Data:
# Zip the whole contents of JENKINS_HOME
cd /home/ubuntu
sudo su
nohup zip -r jenkins-backup.zip /var/lib/jenkins &
Note: To reduce the size of backup file removed the old backups form /var/lib/jenkins/backup
# Transfer the Zip file into remote machine
scp jenkins-backup.zip ubuntu@:/home/ubuntu
# Unzip and move into remote destination
ssh -i remote.pem ubuntu@
sudo apt-get install unzip
cd /var/lib/jenkins
sudo su
nohup unzip -q /home/ubuntu/jenkins-backup.zip -d / &
# Update the ownership of all Jenkins files
sudo chown -R jenkins:jenkins /var/lib/jenkins/
# Restart jenkins
sudo systemctl start jenkins
sudo systemctl status jenkins
Try opening the Jenkins from browser, all previous projects and pipelines should be visible.
Note::
- Encrypted data like keys, passwords etc… although has been transferred but not necessary to be recovered at Remote Machine, must be updated.
Feel free to ping me for any queries. ankurlnmiit@gmail.com