Package: backupallthethings
PurposeThere is many backup framework, with lots of features, encryption, remote storage, incremental backup, you-name-it… Just to name a fewbup,bacula,zbackup,duplicity,zmanda, etc.But those projects often focus on file backup. What about in-memory data? What about databases that need data consistency?backupallthethingstry to alleviate that concern by providing a simple way to backup those services. Also it provide a very simple CLI that allows you to backup anything anytime.No fancy features, it is the poor man’s backup. Files are backuped locally only (ATM). You may then want to rely on those other projects to backup your … backups.backupallthethingsis averyyoung project and should not be considered stable. The scripts provided to backup each of the services are … well … they are what they are. Simple shell scripts; not much safety nets, poor logging / error reporting, may not follow best practices and may seem complete non-sense to experts.There is a largeTODO list, feel free to look into it and hack at will!InstallFrom pypi:pipinstallbackupallthethingsLatest:pipinstallgit+https://github.com/devo-ps/backupallthethingsConfigurationAll the configuration files are available in/opt/batt/confUsageHelpProvide extensive help about all the supported options.batt-hList supported servicesList the scripts that are enabled when ran without parametersbattlistAdd / Remove service to the defaultsAdd / remove support for the services’ backup scripts. Note that it only applies when ran without parameters.# Add support for the mysql / file and postgresql servicessudobattenablemysqlfilepostgresql# Disable (if enabled previously) the support for redis and mongodbsudobattdisableredismongodbThe logic is similar to Apache/Nginxsites-enabled.battcreates links to the real script in/opt/batt/scripts-enabledand remove those links when disabling services.You need to run the enable/disable feature asrootdue to the permissions.Run BackupRun backup for the enabled servicesWhen ran without parameters,battwill attempt to run every enabled backup script and use their respective configuration files.sudobattYou need to run the backup asroot.Run custom backupWhen passing parameters to thebattcommand, it will effectively bypass the default enabled services and attempt to run each of the service provided on the command line.# Will run the mysql and file backup scripts with the default values provided in
# the script and config file.sudobattmysqlfile# Will backup only the ``wordpress`` database and the ``/var/www/wordpress`` foldersudobattmysqlfile--mysql-dbwordpress--file/var/www/wordpress# Same as above; the service ``mysql`` and ``file`` can be ommitted as they are
# implicitely defined by the
# `--mysql-db` and `--file` optionssudobatt--mysql-dbwordpress--file/var/www/wordpress# You can specify options multiple times as well; it will backup both the
# wordpress and mysql databases (in different files)sudobatt--mysql-dbwordpress--mysql-dbmysqlCustom destination folderBy default the backup archives will be saved in/opt/backup/YYYY/MM/DD/{service}. Beware that the former files will be overwritten if they already exist.You can change the path of the destination folder to be more granular or fully custom with the--pathargument.# Will put the backup archives in ``/custom/path/{service}``sudobatt--path/custom/path# You can specify date patterns (e.g. ``/opt/backup/2014/11/13/22/53/{service}``)sudobatt--path/opt/backup/%Y/%m/%d/%H/%M# Another ... ``/opt/backup/2014/11/13/daily/{service}``sudobatt--path/opt/backup/%Y/%m/%d/dailyMore details about the date format is availablehere.ArchitecturebattPython based script, effectively parses the various arguments and manage the services list. Then it delegates the work to the services scripts.backup scriptsThey are stored in/opt/batt/scripts-available.In practice they can be based on any language; shell, python, ruby, etc. as long as they follow the naming conventionbackup-{service}and are executable.TheBATT_DESTENV variable is passed to them and define the prefix path where to store the resulting backup archive.Space separated arguments are passed to the script (databases, files, etc.) that the script may choose to use or ignore.backup scripts: any language; currently mostly shell script to make use of the regular shell commands.TODOLots of things to do… A quick list below non-prioritized.Better best practices for each of the service’ backup logicBetter error managementUse log file / syslogRemote storage (S3 / etc.)RestoreNotification (email / etc.)More technologiesMore flexible command; allow drop in place of technologiesDocumentation; how to add scripts, etc.Better configuration supportPurge backup support (e.g. after 7 days)MySQL transaction vs lock for InnoDB / MyISAMHandle LVM based backup (and more generally snapshot capable filesystems like ZFS)DisclaimerThebatttool is in early development stage and may break, erase data, corrupt filesytem, burn trees, spill coffee on your keyboard and may even be responsible for global warming (who knows!). Use at your own risk.devo.psis in no way responsible in the event of something wrong happen.LicenseMIT