0

I want to run Jenkins in a docker container, and according to my understanding of this thread the best practice for managing the container's data is to use docker's new volume API (so I can update the Jenkins container without losing my data)

My concern is losing the data somehow, so I want to store it using a version control system, e.g. Git. That way I can track the changes done in my team's build and get things working again if someone makes a mess.

The issue that is not clear to me is how to version control the data? Also, I want to be able to get my container running with restored data in a flash (a simple script/command)

Note that the version control system is not the issue here, I am looking for a best practice for working with containers' data(volumes) in a way that allows tracking changes and restoring the "system" quickly if something breaks.

Community
  • 1
  • 1
e.t.
  • 115
  • 1
  • 6
  • backup folder /var/lib/jenkins every hour, this is our solution currently. – BMW Sep 02 '16 at 18:10
  • https://stackoverflow.com/questions/2087142/is-there-a-way-to-keep-hudson-jenkins-configuration-files-in-source-control – Matt Sep 03 '16 at 11:07
  • and https://wiki.jenkins-ci.org/display/JENKINS/SCM+Sync+configuration+plugin – Matt Sep 03 '16 at 11:08

2 Answers2

0

We don't version control the setting, and just directly backup the whole folder /var/lib/jenkins to s3 bucket every hour.

In S3 bucket, you can active version control, or set rotate policy, for example, keep the data in 90 days only.

restore is easier, after install jenkins, copy the data backup to /var/lib/jenkins, you get everything back.

So should be fine to do the same with traditional backup plan, if no access to aws s3 bucket

BMW
  • 34,279
  • 9
  • 81
  • 95
0

I suggest investigating the use of volume plugins. Some of thesesupport snapshotting the file system, a feature that can later be used for PITR (Point in time recovery)

Mark O'Connor
  • 72,448
  • 10
  • 129
  • 174