Table of Contents
DokuWiki Unison Backup
Using unison to sync a copy of the full dokuwiki data on the VPS to a Dropbox folder on my Shack PC, so that I have a backup copy, in the cloud in case of disaster. I'd hate to lose all the work that goes into writing this stuff…
Config Files
- on the Shack PC create a
~/.unison/dokuwiki.prffile
root = /home/gm4slv/Dropbox/Documents/dokuwiki root = ssh://gm4slv.org.uk//var/www/html/dokuwiki sshargs = -C
To account for making the laptop's copy into a git repository I added:
ignore = Path .git
to the laptop config (see Github Repository ) — John Pumford-Green 29/05/22 00:29
- on the VPS server create a similar
~/.unison/dokuwiki.prffile
root = /home/gm4slv/dokuwiki root = ssh://gm4slv.plus.com:27659/Dropbox/Documents/dokuwiki sshargs = -C
First Run
Run the first time on the Shack PC to download the dokuwiki directory tree from the VPS
Everything is downloaded from the VPS and saved in the Dropbox folder, from where it is uploaded to the cloud.
Future runs...
I could automate the process, using various command line switches to automatically “do the right thing” without needing to answer Yes/No questions
unison -auto -batch -silent dokuwiki
and even put it in a cron job, but for now just running it every now and again manually might be enough.
restore from backup
If the VPS version of the dokuwiki ever gets totally screwed up I can restore it by running the same script from the other side and chosing which direction to do the sync in ( shack → VPS )
- on the VPS server
unison dokuwkiki
which will pull the last sync'd version from my backup to my home directory on the VPS ( i.e. not straight to /var/www/html/dokuwiki) from where I can copy it back to the webserver directory.
I can run this command regularly to keep a mirror of the Dropbox backup on the VPS in case I need it later.
(update 28/5/22) I've added it to crontab to run daily at 04:30:
#!/bin/bash unison -batch -auto -silent dokuwiki
crontab:
30 04 * * * /home/gm4slv/bin/dokuwiki_unison.sh >/dev/null 2>&1
Github Repository
I made a new github repository to hold the Dokuwiki folder tree, too. The laptop / Dropbox backup, taken via Unison from the VPS server, is the local repository.
The workflow to keep things backed up:
- on Shack Laptop
- run unison to retrieve the current production copy of the DokuWiki directory tree:
unison -batch -auto dokuwiki
- there was an error flagged → the
.gitfolder isn't present on the VPS's webserver root but is in the unison backup directory on the laptop. Just ignore it? - I found you can tell
unisonto ignore the.gitfolder by addingignore = Path .git
to the
prfconfig file on laptop — John Pumford-Green 29/05/22 00:30
- cd into
~/Dropbox/Documents/dokuwiki - add all files to git
git add .
- commit
git commit -m "backup"
- push to github
git push
- on VPS
- in
homedirectory, rununison -batch dokuwiki
to pull the
dropboxcopy back to the VPS
- in extremis it should be possible to simply clone the
githubrepository instead of usingunison
Page Updated : 06/03/25 06:49 GMT
