Moin Wiki Attachments Backup

With the interwiki synch procedure it is possible to backup (synchronize) to a backup wiki via network, while the wiki is on-line.

Unfortunately up to moinmoin version 1.9.3 attachments to a wiki page can not be synchronized. For that job I have setup a little shell script with a rsync procedure.
You just have to take care, that the actual version 3.07 of rsync is installed in /usr/bin/rsync.

Using rsync to backup attachments

The Linux program rsync looks very good suited for that task. I tried it with the GUI luckyBackup (ver. 0.4.4) under Ubuntu 10.10 on the client computer.
Only the missing attachments are copied to the backup wiki.
The backup wiki has access to the main wiki via in house network. So I could mount the home folder via cifs.

1. Enable the home folder of the main wiki for remote access (Ubuntu 10.04.1)

2. Mount the remote home folder to /media/rudi72home:
   sudo mount -t cifs -o username=rudi,password=<password> //rudiswiki/rudi72home /media/rudi72home

A list will show the setup of luckyBackup:

Task Properties:
Task name: rudi72_moin18
Type: Backup the entire Source directory (by name)
Source: /media/rudi72home/moin-1.8.8/wiki/data/pages
Destination: /home/rudi/moin-1.8.8/wiki/data/

advanced properties:
Include: */attachments/*
Set a mark on:
  Preserve ownership, times
  Preserve permissions
  Preserve symlinks
  Recurse into directories
  Skip newer destination files

This will give the following rsync command string via the "validate" button:
rsync -h --progress --stats -r -tgo -p -l --update --include=*/attachments/* --include=*/ --exclude=* --prune-empty-dirs /media/rudi72home/moin-1.8.8/wiki/data/pages /home/rudi/moin-1.8.8/wiki/data/

rsync use on Mac OS X 10.6.6

A problem will arise, if on the backup side the folder attachments does not exist. Then there is no copying of the attachments files.
The problem was caused from an outdated rsync version (--version 2.6.9) in MAC OS X. A newer version (--version 3.07) works as expected.

In order to make the connection to the Linux Ubuntu 10.04.1 server easier, install there the package netatalk.
Because netatalk uses as name for the home directory HOME DIRECTORY with a space in the name, I changed it in /etc/netatalk/AppleVolumes.default to home_dir, which should be easier in concern of file handling.

The rsync call with an established server connection will look like:

# rsync ver. 3.0.7 in /usr/bin/rsync (old ver. 2.6.9)
rsync  -h --progress --stats -r -tgo -p -l --update --include=*/attachments/* --include=*/ --exclude=* --prune-empty-dirs /Volumes/home_dir/moin-1.8.8/wiki/data/pages /Volumes/hda8/INSTALL/Python/Moin/moin-1.8.8/wiki/data/

ssh use on Mac OS X

If you want to copy the attachments via Internet, it is recommended to use SSH encryption for data transfer. The original description is from http://www.jdmz.net/ssh/. Deviating from that, the Mac OS X ssh-keygen does allow a DSA 1024 bit key only.
If the ssh connection does work, and you want to use the rsync procedure via script automated, you have to generate a public DSA key.
In order to make the procedure more save than I have described, please have a look to the original web site.

For a quick test of the working ssh connection try with option -e ssh, with interactive password input:

# rsync ver. 3.0.7 with ssh
rsync  -h --progress --stats -r -tgo -p -l --update --include=*/attachments/* --include=*/ --exclude=* --prune-empty-dirs  -e ssh rudi@192.168.17.72:/home/rudi/moin-1.8.8/wiki/data/pages /Volumes/hda8/INSTALL/Python/Moin/moin-1.8.8/wiki/data/

Next generate a public key, in order to be able to automate the rsync procedure.

At the question for the passphrase just hit ENTER.

# First create the DSA keys
$ ssh-keygen -t dsa -b 1024 -f mac-rsync-key
Generating public/private dsa key pair.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in mac-rsync-key.
Your public key has been saved in mac-rsync-key.pub.
The key fingerprint is:
d5:04:b4:03:0d:c6:0d:d5:d4:10:85:e9:da:f7:xx:xx rudiuser@rudi-users-iMac.local
The key's randomart image is:
+--[ DSA 1024]----+
|       .=B++=B.  |
...
|               o.|
+-----------------+

# Copy the public key to the server:
$ scp mac-rsync-key.pub rudi@192.168.17.72:/home/rudi
remote password: <password>

# Login to remote computer:
$ ssh rudi@192.168.17.72
remote password: <password>

# If folder .ssh does not exist in the home directory, create it
$ sudo mkdir .ssh ; chmod 700 .ssh

$ sudo mv mac-rsync-key.pub .ssh/

$ sudo cd .ssh/

# If file "authorized_keys" does not exist, create it
$ sudo touch authorized_keys ; chmod 600 authorized_keys

# Insert content of "mac-rsync-key.pub"
$ sudo cat mac-rsync-key.pub >> authorized_keys 

# Now on the host side you can start "rsync" procedure without password question:
# rsync ver. 3.0.7 with ssh
rsync  -h --progress --stats -r -tgo -p -l --update --include=*/attachments/* --include=*/ --exclude=* --prune-empty-dirs  -e "ssh -i mac-rsync-key" rudi@192.168.17.72:/home/rudi/moin-1.8.8/wiki/data/pages /Volumes/hda8/INSTALL/Python/Moin/moin-1.8.8/wiki/data/

List of pages in this category:

-- RudolfReuter 2011-02-08 11:58:03


Go back to CategoryMoinMaintenance or FrontPage ; KontaktEmail (ContactEmail)

MoinAttachmentsBackup (last edited 2011-03-23 08:57:01 by dslb-084-058-142-238)