How backup works ?
Jenkins plugin Periodic Backup Manager create backup into jenkins server with tar.gz
After it , cronjob automate run script , script checking into directory where stored tar.gz
If have backup.tar.gz , script automaticly push to s3 and delete after pushing.
All steps are automatically you can only monitoring for stability
For backup you need to AWS account S3 bucket and Linux Server where Jenkins.
- sudo -i
- git clone https://github.com/vndark/jenkins-backup-s3.git
- mkdir permanent && mkdir tmp
- If have mount disk example ` mount sdb1 /jenkinsbackup and create permanent and tmp dir in jenkinsbackup
- Open jenkins-backup-s3.sh via nano or vim , and edit path to directory
AWS S3 steps.
- Go to S3 and create bucket example ` backup-jenkins or jenkins-backup.
- Copy bucket url and paste into jenkins-backup-s3.sh on the line where s3 cp url
- You can enable versioning and configure lifecycle rule for replace backup file and save old versions.
- Go to manage plugins
- Install plugin "Periodic Backup Manager"
- Go to settings Jenkins scroll down open Periodic Backup Manager
- Set cron time when start jenkins backuping
- set tmp path example ` /root/tmp
- Mark the fullbackup button
- Storage Strategy - tar.gz
- Backup Location example ` /root/permanent and press ENABLE THIS LOCATION.
Cron job steps.
- crontab -e with nano or vim
- You can generate time on website > https://crontab.guru
- Your job in cron , set time after Periodic Backup Manager Backup example * * * * * /root/jenkins-backup-s3.sh