Backing up Plone
Process for configuring Plone backups.
Repozo.py
It is possible to backup Plone data incrementally using the Zope utility called 'repozo.py'. This utility is shipped with Zope 2.7 onwards and can only be used on repositories 2.7 onwards.
In order to be able to configure the script to work, the Zope libraries need to be added to the Python library path. By default these are not.
When the Python interpreter starts up, it has a predefined (defined at compile time) list of paths for which to search for Python libraries. It is possible to add a 'path' file to any of these directories to get Python to automatically add user defined paths to the library path.
A path file is a text file with a '.pth' extention. These files contain 1 path statement per line. On startup Python goes through each of its initial path directories and looks for '.pth' files and then incorporates any directories listed in them into its path.
I have created a path file at '/usr/local/lib/python2.4/site-packages/paths.pth'. This file contains the library path for Zope2.9 which is '/usr/lib/zope2.9/lib/python/'.
All Python scripts will now have access to the Zope libraries, including the repozo.py script.
Details on using the repozo.py script can be found here.
Backups
A cron job has been created under the root account to perform incremental backups, which have been scheduled to run at midnight every night. The cron job executes the following script: '/usr/local/bin/repozo.sh'-------------------------------------------------------
#!/bin/sh
#repozo backup that logs results
#example usage:
# Repozo Backups -- Do Not Delete!
#14 3 * * * ~/bin/repozo.sh >> ~/zope/instance1/log/repozobackups.log
#You may need to updated the Zope version being used according to your circumsta
nces.
PYTHONPATH=/usr/lib/zope2.9/bin/python
REPOZOPATH=/usr/lib/zope2.9/bin/repozo.py
BACKUPPATH=/var/local/backups/zope
DATAFILE=/var/lib/zope2.9/instance/ramp/var/Data.fs
echo
echo "backup starting"
date
$PYTHONPATH $REPOZOPATH -B -v -r $BACKUPPATH -f $DATAFILE >> $BACKUPPATH/repozob
ackups.log 2>&1
echo "backup finished"
echo
-------------------------------------------------------
As one can see from the script the following are the relevant locations:
- /usr/lib/zope2.9/bin/python
This is the python executable that comes with Zope. It is recommended to use this as Zope occassionally has issues with different versions of Python - /usr/lib/zope2.9/bin/repozo.py
This is the location of the backup script - /var/local/backups/zope
This is where the backups get stored. The logs of the backups are also stored here. - /var/lib/zope2.9/instance/ramp/var/Data.fs
This is the location of the Zope transactional datafile that needs to be backed up.