Package: serapeum.backup
serapeum.backupwill perform a back-up of a list of directories, as
well as your MySQL database, and store them on the server you’re running
the application on. It is designed to run on your back-up server and
uses`rdiff-backup<http://www.nongnu.org/rdiff-backup/>`__ to run
the backup.ConfigurationThe application is designed to be used when you have a lot of servers,
which contain mostly web applications, with assorted databases, and you
want them all backed up hassle-free to a remote backup server. It is
meant to be used on your backup server, but it can optionally run from
your server and push to the backup server as well.All configuration options are in either in/etc/serapeum/backup.inior a configuration file provided via the--configcommand line
switch. Copy the providedexample.inifile and update it to reflect
your personal situation.RoleThe settingremote_roledetermines whetherserapeum.backupwill
attempt to backup servers to the local system (source) or backup the
local system to some remote server (backup). By default, it’s set tosource.Setting it tobackupwill create a backup of the local system and
use the remote (hence the termremote_role) as its backup
location.Setting it tosourcewill create a backup of the remote system
and store the backup locally.The keybackup_pathcontains the path the backups will be written
to, either a local path (source) or a remote (backup) one.Note that whenremote_roleisbackupand thusbackup_pathis
a remote path, you do not have to includeuserandhost(e.g.user@host::path), as this will be generated automatically from the
remote configuration.File selectionsources_fileandexcludes_filerefer to the selection of files
(or directories) you want to backup. Both files must be json-files which
have a key calledlist. Thelistkey contains a list of fully
qualified directories to backup.sources_filecontains a list of directories or files you want to
have backed up.excludes_filehas a list of files or directories inside your
source directories you want to exclude from backing up. If, for
example, you have/home/pieterin yoursources_file, but want
to excludeLargeDirfrom the backup, you specify/home/pieter/LargeDirinside yourexcludes_file.Your entire path will be replicated inside your backup location. If you
specified/home/pieterinsidesources_fileyour remote location
will contain/home/pieter(and not justpieter, which some
applications might do).Remote configurationThe application interacts with your remote backup server using
rdiff-backup and ssh keys. You must have rdiff-backup installed on the
remote server as well as locally, inside/usr/bin. You must also
have a user that is allowed to connect via ssh, with a key, and has the
necessary rights to run/usr/bin/rdiff-backupassudowithout a
password.remote_user,remote_sshandremote_locconfigure the
remote.remote_loccontains the address (IP or FQDN) of your
remote system.userandsshrefer to the user you want to log
in as and the location of the private ssh key on this system.Multiple remotesIt is possible to define multiple remotes, which will, depending on the
setting ofremote_role, be used to store your backups (backup) or
be backed up (source). The remotes must be in a file in JSON-format
with a key calledlist, containing either the IP addresses or the
FQDN of every remote.You must specify the location of the list as theremote_listparameter and remove theremote_lockey. Only one of those can
appear in your configuration file.If theremote_roleissource, the script will create a
subdirectory insidebackup_pathfor every remote (using the IP/FQDN
as defined in the list), in which the backups will be stored. This
should prevent backup mix-ups.Theremote_-configuration in the MySQL section has the same
functionality and is configured in the same manner.MySQL configurationBacking up a MySQL installation can be enabled or disabled through thebackup_mysqlsetting.The application uses themysqldumputility to perform backups of
your MySQL (or equivalent) server. All databases will be dumped and the
dump will be stored locally and then transferred to the remote location
using rdiff-backup. The local copy will be deleted (for security
reasons).local_pathis the directory the dump will be stored in. This
directory must exist. Not that this can be a path on a remote system
ifremote_roleis set tosource.host,usernameandpasswordmust refer to a user that has
the necessary rights to execute a dump of the entire MySQL
installation. This requiresSELECT,LOCK TABLES,SHOW VIEWandRELOADprivileges on all databases.remote_user,remote_ssh,remote_loc/remote_listandbackup_pathare used to configure rdiff-backup for the backup of
the MySQL dump. They can be the same settings as for the back-up of
your files (seeRemote configuration), but this is not a
requirement.Email configurationWhen a backup job fails, the application sends of an email with the
output of rdiff-backup or mysqldump.mail_desthas the email address of the recipient (e.g. you).smtp_server,smtp_port,smtp_usernameandsmtp_passwordconfigure the connection to a SMTP server.UsageThis script is designed to run in a cron job without any intervention.
All settings must be set in the configuration file.Run the application as:serapeum-backupOptionally, you can provide a configuration file (in the same format as/etc/serapeum/backup.ini) on the command line via the--configor-cswitch. This file will be used instead of the general
configuration file.serapeum-backup --config /etc/serapeum/specific_site.ini