Backup/Restore strategies while running Jenkins on Docker Desktop with WSL integration

What would be the best backup restore strategy.

I am trying to use Thinbackup plugin also Backup plugin on jenkins/jenkins:lts

docker run --rm -p 8080:8080 -p 50000:50000 -v ~/jenkins_home:/var/jenkins_home -v ~/jenkins_bkp:/var/lib/jenkins/backup jenkins/jenkins:lts

However none of them work.
I can see the backup is taken sucessfullly, however I am no able to restore.
For the test I am creating new jobs, taking a backup, then deleting these jobs and trying to restore, and nothing happens.

bleite@OMEN30L:~$ ls -als | grep jenkins_home
    4 drwxr-xr-x 15 bleite bleite     4096 Nov  6 11:16 jenkins_home
bleite@OMEN30L:~/jenkins_bkp$ ls -als
total 36
4 drwxr-xr-x  3 bleite bleite 4096 Nov  6 11:16 .
4 drwxr-xr-x 18 bleite bleite 4096 Nov  6 00:12 ..
8 -rw-r--r--  1 bleite bleite 8172 Nov  6 07:40 BACKUPSET_2022-11-06_14-20_.zip
8 -rw-r--r--  1 bleite bleite 8172 Nov  6 11:00 BACKUPSET_2022-11-06_14-40_.zip
8 -rw-r--r--  1 bleite bleite 8173 Nov  6 11:15 BACKUPSET_2022-11-06_18-00_.zip
4 drwxr-xr-x  6 bleite bleite 4096 Nov  6 11:15 FULL-2022-11-06_18-15
bleite@OMEN30L:~$ ls -als jenkins_home/
total 116
4 drwxr-xr-x 15 bleite bleite 4096 Nov  6 11:16  .
4 drwxr-xr-x 18 bleite bleite 4096 Nov  6 00:12  ..
4 drwxr-xr-x  3 bleite bleite 4096 Nov  6 00:15  .cache
4 drwxr-xr-x  3 bleite bleite 4096 Nov  6 00:15  .java
0 -rw-r--r--  1 bleite bleite    0 Nov  6 00:22  .lastStarted
0 -rw-r--r--  1 bleite bleite    0 Nov  6 11:16 'ThinBackup Worker Thread.log'
4 -rw-r--r--  1 bleite bleite 1663 Nov  6 11:16  config.xml
4 -rw-r--r--  1 bleite bleite  200 Nov  6 00:22  copy_reference_file.log
4 -rw-r--r--  1 bleite bleite  156 Nov  6 11:16  hudson.model.UpdateCenter.xml
4 -rw-------  1 bleite bleite 1680 Nov  6 00:17  identity.key.enc
4 -rw-r--r--  1 bleite bleite 3225 Nov  6 11:16  installedPlugins.xml
4 -rw-r--r--  1 bleite bleite    7 Nov  6 00:22  jenkins.install.InstallUtil.lastExecVersion
4 -rw-r--r--  1 bleite bleite    7 Nov  6 00:16  jenkins.install.UpgradeWizard.state
4 -rw-r--r--  1 bleite bleite  171 Nov  6 11:16  jenkins.telemetry.Correlator.xml
4 drwxr-xr-x  6 bleite bleite 4096 Nov  6 11:16  jobs
4 drwxr-xr-x  2 bleite bleite 4096 Nov  6 00:22  log
4 drwxr-xr-x  3 bleite bleite 4096 Nov  6 07:26  logs
4 -rw-r--r--  1 bleite bleite  907 Nov  6 11:16  nodeMonitors.xml
4 drwxr-xr-x  2 bleite bleite 4096 Nov  6 00:15  nodes
4 -rw-r--r--  1 bleite bleite  801 Nov  6 11:16  periodicBackup.xml
4 drwxr-xr-x 29 bleite bleite 4096 Nov  6 00:22  plugins
4 -rw-r--r--  1 bleite bleite  129 Nov  6 11:16  queue.xml
4 -rw-r--r--  1 bleite bleite  129 Nov  6 00:21  queue.xml.bak
4 -rw-r--r--  1 bleite bleite   64 Nov  6 00:15  secret.key
0 -rw-r--r--  1 bleite bleite    0 Nov  6 00:15  secret.key.not-so-secret
4 drwx------  2 bleite bleite 4096 Nov  6 11:15  secrets
4 -rw-r--r--  1 bleite bleite 1019 Nov  6 11:16  thinBackup.xml
4 drwxr-xr-x  2 bleite bleite 4096 Nov  6 00:15  updates
4 drwxr-xr-x  2 bleite bleite 4096 Nov  6 11:16  userContent
4 drwxr-xr-x  3 bleite bleite 4096 Nov  6 11:16  users
4 drwxr-xr-x 11 bleite bleite 4096 Nov  6 00:15  war
4 drwxr-xr-x  3 bleite bleite 4096 Nov  6 11:15  workspace

Docker Logs

Running from: /usr/share/jenkins/jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
2022-11-06 18:49:18.578+0000 [id=1]     INFO    winstone.Logger#logInternal: Beginning extraction from war file
2022-11-06 18:49:18.631+0000 [id=1]     WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
2022-11-06 18:49:18.688+0000 [id=1]     INFO    org.eclipse.jetty.server.Server#doStart: jetty-10.0.11; built: 2022-06-21T21:12:44.640Z; git: d988aa016e0bb2de6fba84c1659049c72eae3e32; jvm 11.0.16.1+1
2022-11-06 18:49:18.897+0000 [id=1]     INFO    o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2022-11-06 18:49:18.941+0000 [id=1]     INFO    o.e.j.s.s.DefaultSessionIdManager#doStart: Session workerName=node0
2022-11-06 18:49:19.270+0000 [id=1]     INFO    hudson.WebAppMain#contextInitialized: Jenkins home directory: /var/jenkins_home found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
2022-11-06 18:49:19.408+0000 [id=1]     INFO    o.e.j.s.handler.ContextHandler#doStart: Started w.@5a9800f8{Jenkins v2.361.3,/,file:///var/jenkins_home/war/,AVAILABLE}{/var/jenkins_home/war}
2022-11-06 18:49:19.422+0000 [id=1]     INFO    o.e.j.server.AbstractConnector#doStart: Started ServerConnector@5b94b04d{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2022-11-06 18:49:19.436+0000 [id=1]     INFO    org.eclipse.jetty.server.Server#doStart: Started Server@2f54a33d{STARTING}[10.0.11,sto=0] @1262ms
2022-11-06 18:49:19.438+0000 [id=35]    INFO    winstone.Logger#logInternal: Winstone Servlet Engine running: controlPort=disabled
2022-11-06 18:49:19.592+0000 [id=41]    INFO    jenkins.InitReactorRunner$1#onAttained: Started initialization
2022-11-06 18:49:19.656+0000 [id=48]    INFO    jenkins.InitReactorRunner$1#onAttained: Listed all plugins
2022-11-06 18:49:20.670+0000 [id=49]    INFO    jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
2022-11-06 18:49:20.678+0000 [id=51]    INFO    jenkins.InitReactorRunner$1#onAttained: Started all plugins
2022-11-06 18:49:20.683+0000 [id=62]    INFO    jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
2022-11-06 18:49:20.936+0000 [id=71]    INFO    jenkins.InitReactorRunner$1#onAttained: System config loaded
2022-11-06 18:49:20.938+0000 [id=49]    INFO    jenkins.InitReactorRunner$1#onAttained: System config adapted
2022-11-06 18:49:20.957+0000 [id=64]    INFO    jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
2022-11-06 18:49:20.963+0000 [id=57]    INFO    jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
2022-11-06 18:49:20.977+0000 [id=84]    INFO    hudson.model.AsyncPeriodicWork#lambda$doRun$1: Started Download metadata
2022-11-06 18:49:20.982+0000 [id=84]    INFO    hudson.model.AsyncPeriodicWork#lambda$doRun$1: Finished Download metadata. 4 ms
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/var/jenkins_home/war/WEB-INF/lib/groovy-all-2.4.21.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2022-11-06 18:49:21.118+0000 [id=60]    INFO    jenkins.InitReactorRunner$1#onAttained: Completed initialization
2022-11-06 18:49:21.180+0000 [id=32]    INFO    hudson.lifecycle.Lifecycle#onReady: Jenkins is fully up and running
2022-11-06 18:49:50.114+0000 [id=108]   INFO    hudson.model.AsyncPeriodicWork#lambda$doRun$1: Started PeriodicBackup
2022-11-06 18:49:50.123+0000 [id=108]   INFO    hudson.model.AsyncPeriodicWork#lambda$doRun$1: Finished PeriodicBackup. 9 ms
2022-11-06 18:50:03.738+0000 [id=22]    INFO    o.j.h.p.t.ThinBackupMgmtLink#doRestore: Starting restore operation.
2022-11-06 18:50:04.241+0000 [id=22]    INFO    o.j.h.p.t.restore.HudsonRestore#restoreFromDirectories: No backup directories with date '2022-11-06 14:20' found. Will try to find a backup in ZIP files next...
2022-11-06 18:50:04.264+0000 [id=22]    SEVERE  o.j.h.p.t.ThinBackupMgmtLink#doRestore: Could not restore. Aborting.

Welcome back @bleite :wave:

I’m afraid I can’t help but you could maybe have a look at the current issues list for this plugin, or create a new one.

FWIW, JENKINS_HOME is just a filesystem, using standard file-level backup/restore should be sufficient

2 Likes

Thanks for your reply.

1 Like

Yes I am doing this now.
Thanks for your reply.

1 Like