Making backups
Introduction
For backing up Daisy there is an application which will help you create and restore backups. You can find it in
<DAISY_HOME>/bin/daisy-backup-tool
This tool in its current form can backup :
- daisy-repository
- repository database
- blobstore
- indexstore
- configuration
- openjms
- database
- configuration
- daisy-wiki
- cocoon.xconf
- web.xml
- skins
- sites
- you name it (this will be elaborated on further in this document)
Your backup will contain database dumps of the configured databases and zip files containing the content of directories or files.
Running the backup tool
Prerequisites
The following DBMS can be backed up :
- MySQL (binaries used : mysql, mysqldump, mysqladmin)
MySQL 4.0 users will not be able to restore backups.
- PostgreSQL (binaries used : psql, pg_dump, dropdb)
For succesful completion of a backup it is required that the binaries can be found in the environments PATH variable.
PostgreSQL backup and/or restore has not been tested yet. Feedback on this subject is always welcome.
Running
Running the tool without any parameters will just display the help which should look something like this :
usage: daisy-backup-tool [-s smtp-server] [-d daisydata-path] [-b | -r][-o
openjms-home-path] [-h] [-r backup-name] [-e email-address] [-a
entry-configuration-file] -l backup-path
-d,--daisy-data-dir <daisydata-path> Daisy data directory
-a,--additional-entries <entry-configuration-file> Path to
configuration of additional backup entries
-o,--openjms-home <openjms-home-path> Openjms installation
directory
-s,--smtp-server <smtp-server> Smtp server
-b,--backup Create a new backup
-e,--emailaddress <email-address> Where emails will be
sent to incase of an exception
-h,--help Show this message
-l,--backuplocation <backup-path> Location where
backups are stored
-r,--restore <backup-name> Restore an existing
backup
Compulsory options
-b or -r <backup-name>
- The -b option is used to create a backup.
- Specifying the -r <backup-name> option will allow you to restore a backup. The name of the backup can be found in the backup location directory. You will be looking for a directory name of the form <DATE>_<SEQUENCE> or YYYYMMDD_### (e.g. 20051124_001), the directory name is thus the same name as the backup.
Minimally the Daisy repository will be backed up or restored. By specifying different options you are able to backup or restore OpenJMS, Daisy Wiki, ...
-l <backup-path>
Specifies where the backups will be created in or restored from.
-d <daisydata-path> (when using -b)
This option is mandatory when using -b. The daisydata-path is where your blobstore, indexstore, configuration and logs are stored.
Facultative options
-o <openjms-home>
Specifies where OpenJMS is located. When this option is used OpenJMS will be backed up or restored.
-e <email-address>
Should exceptions occur during backup, notification emails can be sent to the specified address. These emails will contain the stacktrace of the exception. Do not forget to set the SMTP server using the next option.
-s <smtp-server>
Configures the smtp server to use to send emails in case of exceptions.
-a <entry-configuration-file>
If you want to backup other files you can create a configuration file to pass
to the backup tool. In essence the configuration file contains a list of paths
(files or directories) relative to a base directory. The content of these paths
will be stored in a zip file in the backup directory.
Here is wat the configuration file should look like :
<backup-entries>
<backup-entry name="..." basedir="...">
<paths>
<path>...</path>
...
</paths>
</backup-entry>
...
</backup-entries>
And here is an example you might use to backup the most important daisy-wiki files :
<?xml version="1.0" encoding="UTF-8"?>
<backup-entries>
<backup-entry name="daisywiki" basedir="/usr/lib/daisy">
<paths>
<path>daisywiki/conf</path>
<path>daisywiki/webapp/WEB-INF/cocoon.xconf</path>
<path>daisywiki/webapp/WEB-INF/web.xml</path>
<path>daisywiki/webapp/daisy/external-include-rules.xml</path>
<path>daisywiki/webapp/daisy/books/publicationtypes</path>
<path>daisywiki/webapp/daisy/bookstore</path>
<path>daisywiki/webapp/daisy/resources/skins</path>
<path>daisywiki/webapp/daisy/resources/document-styling</path>
<path>daisywiki/webapp/daisy/resources/query-styling</path>
<path>daisywiki/webapp/daisy/resources/parteditors</path>
<path>daisywiki/webapp/daisy/sites</path>
</paths>
</backup-entry>
</backup-entries>
Postgresql notes
Supplying the Postgresql commandline tools with a database password is not possible, therefore the Postgresql commandline tools will prompt for a password when needed. However, there are some ways of bypassing the password prompt :
Password file
This password file is only used for the password prompt during a database dump. This means that it is only useful when you only want to automate backups. If you want to restore a database you will be prompted for a password twice, once for dropping the database and again for creating/restoring it. The password file is found here :
$HOME/.pgpass
This file MUST have the following permissions -rw------- (chmod 600)
It has this format :
host:port:databasename:username:password
Here is an example
localhost:*:daisyrepository:daisy:daisy localhost:*:openjms:openjms:openjms
More information on the .pgpass file can be found here.
Trusted users
If you trust certain users they will not be prompted for passwords either.
This is interesting when you couldn't be bothered to supply passwords to the
commandline during backup or restore. Information can be found
here.
Example :
#TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD host daisyrepository daisy 127.0.0.1 255.255.255.255 trust host openjms openjms 127.0.0.1 255.255.255.255 trust host template1 daisy 127.0.0.1 255.255.255.255 trust host template1 openjms 127.0.0.1 255.255.255.255 trust host all all 127.0.0.1 255.255.255.255 md5
Be sure to place the users you trust before the users you do not (md5)
The database 'template1' must also be added because during the restore of a database a connection must be made with the Postgresql server and some database (the template1 database is sure to exist).



There are no comments.