Commands

The primary usage of DBBackup is made with command line tools. By default, commands will create backups and upload to your defined storage or download and restore the latest.

Commands provide arguments for compress/uncompress and encrypt/decrypt.

dbbackup

Backup of database.

$ ./manage.py dbbackup
Backing Up Database: /tmp/tmp.x0kN9sYSqk
Backup size: 3.3 KiB
Writing file to tmp-zuluvm-2016-07-29-100954.dump

Help

usage: manage.py dbbackup [-h] [--version] [-v {0,1,2,3}]
                          [--settings SETTINGS] [--pythonpath PYTHONPATH]
                          [--traceback] [--no-color] [--noinput] [-q] [-c]
                          [-d DATABASE] [-s SERVERNAME] [-z] [-e]
                          [-o OUTPUT_FILENAME] [-O OUTPUT_PATH]

Backup a database, encrypt and/or compress and write to storage.

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  -v {0,1,2,3}, --verbosity {0,1,2,3}
                        Verbosity level; 0=minimal output, 1=normal output,
                        2=verbose output, 3=very verbose output
  --settings SETTINGS   The Python path to a settings module, e.g.
                        "myproject.settings.main". If this isn't provided, the
                        DJANGO_SETTINGS_MODULE environment variable will be
                        used.
  --pythonpath PYTHONPATH
                        A directory to add to the Python path, e.g.
                        "/home/djangoprojects/myproject".
  --traceback           Raise on CommandError exceptions
  --no-color            Don't colorize the command output.
  --noinput             Tells Django to NOT prompt the user for input of any
                        kind.
  -q, --quiet           Tells Django to NOT output other text than errors.
  -c, --clean           Clean up old backup files
  -d DATABASE, --database DATABASE
                        Database to backup (default: everything)
  -s SERVERNAME, --servername SERVERNAME
                        Specify server name to include in backup filename
  -z, --compress        Compress the backup files
  -e, --encrypt         Encrypt the backup files
  -o OUTPUT_FILENAME, --output-filename OUTPUT_FILENAME
                        Specify filename on storage
  -O OUTPUT_PATH, --output-path OUTPUT_PATH
                        Specify where to store on local filesystem

dbrestore

Restore a database.

Restoring backup for database: /tmp/tmp.x0kN9sYSqk
Finding latest backup
Restoring: tmp-zuluvm-2016-07-29-100954.dump
Restore tempfile created: 3.3 KiB

Help

usage: manage.py dbrestore [-h] [--version] [-v {0,1,2,3}]
                           [--settings SETTINGS] [--pythonpath PYTHONPATH]
                           [--traceback] [--no-color] [--noinput] [-q]
                           [-d DATABASE] [-i INPUT_FILENAME] [-I INPUT_PATH]
                           [-s SERVERNAME] [-c] [-p PASSPHRASE] [-z]

Restore a database backup from storage, encrypted and/or compressed.

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  -v {0,1,2,3}, --verbosity {0,1,2,3}
                        Verbosity level; 0=minimal output, 1=normal output,
                        2=verbose output, 3=very verbose output
  --settings SETTINGS   The Python path to a settings module, e.g.
                        "myproject.settings.main". If this isn't provided, the
                        DJANGO_SETTINGS_MODULE environment variable will be
                        used.
  --pythonpath PYTHONPATH
                        A directory to add to the Python path, e.g.
                        "/home/djangoprojects/myproject".
  --traceback           Raise on CommandError exceptions
  --no-color            Don't colorize the command output.
  --noinput             Tells Django to NOT prompt the user for input of any
                        kind.
  -q, --quiet           Tells Django to NOT output other text than errors.
  -d DATABASE, --database DATABASE
                        Database to restore
  -i INPUT_FILENAME, --input-filename INPUT_FILENAME
                        Specify filename to backup from
  -I INPUT_PATH, --input-path INPUT_PATH
                        Specify path on local filesystem to backup from
  -s SERVERNAME, --servername SERVERNAME
                        Use a different servername backup
  -c, --decrypt         Decrypt data before restoring
  -p PASSPHRASE, --passphrase PASSPHRASE
                        Passphrase for decrypt file
  -z, --uncompress      Uncompress gzip data before restoring

mediabackup

Backup media files, gather all in a tarball and encrypt or compress.

$ ./manage.py mediabackup
Backup size: 10.0 KiB
Writing file to zuluvm-2016-07-04-081612.tar

Help

usage: manage.py mediabackup [-h] [--version] [-v {0,1,2,3}]
                             [--settings SETTINGS] [--pythonpath PYTHONPATH]
                             [--traceback] [--no-color] [--noinput] [-q] [-c]
                             [-s SERVERNAME] [-z] [-e] [-o OUTPUT_FILENAME]
                             [-O OUTPUT_PATH]

Backup media files, gather all in a tarball and encrypt or compress.

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  -v {0,1,2,3}, --verbosity {0,1,2,3}
                        Verbosity level; 0=minimal output, 1=normal output,
                        2=verbose output, 3=very verbose output
  --settings SETTINGS   The Python path to a settings module, e.g.
                        "myproject.settings.main". If this isn't provided, the
                        DJANGO_SETTINGS_MODULE environment variable will be
                        used.
  --pythonpath PYTHONPATH
                        A directory to add to the Python path, e.g.
                        "/home/djangoprojects/myproject".
  --traceback           Raise on CommandError exceptions
  --no-color            Don't colorize the command output.
  --noinput             Tells Django to NOT prompt the user for input of any
                        kind.
  -q, --quiet           Tells Django to NOT output other text than errors.
  -c, --clean           Clean up old backup files
  -s SERVERNAME, --servername SERVERNAME
                        Specify server name to include in backup filename
  -z, --compress        Do not compress the archive
  -e, --encrypt         Encrypt the backup files
  -o OUTPUT_FILENAME, --output-filename OUTPUT_FILENAME
                        Specify filename on storage
  -O OUTPUT_PATH, --output-path OUTPUT_PATH
                        Specify where to store on local filesystem

mediarestore

Restore media files, extract files from archive and put into media storage.

$ ./manage.py mediarestore
Restoring backup for media files
Finding latest backup
Reading file zuluvm-2016-07-04-082551.tar
Restoring: zuluvm-2016-07-04-082551.tar
Backup size: 10.0 KiB
Are you sure you want to continue? [Y/n]
2 file(s) restored

Help

usage: manage.py mediarestore [-h] [--version] [-v {0,1,2,3}]
                              [--settings SETTINGS] [--pythonpath PYTHONPATH]
                              [--traceback] [--no-color] [--noinput] [-q]
                              [-i INPUT_FILENAME] [-I INPUT_PATH] [-e]
                              [-p PASSPHRASE] [-z] [-r]

Restore a media backup from storage, encrypted and/or compressed.

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  -v {0,1,2,3}, --verbosity {0,1,2,3}
                        Verbosity level; 0=minimal output, 1=normal output,
                        2=verbose output, 3=very verbose output
  --settings SETTINGS   The Python path to a settings module, e.g.
                        "myproject.settings.main". If this isn't provided, the
                        DJANGO_SETTINGS_MODULE environment variable will be
                        used.
  --pythonpath PYTHONPATH
                        A directory to add to the Python path, e.g.
                        "/home/djangoprojects/myproject".
  --traceback           Raise on CommandError exceptions
  --no-color            Don't colorize the command output.
  --noinput             Tells Django to NOT prompt the user for input of any
                        kind.
  -q, --quiet           Tells Django to NOT output other text than errors.
  -i INPUT_FILENAME, --input-filename INPUT_FILENAME
                        Specify filename to backup from
  -I INPUT_PATH, --input-path INPUT_PATH
                        Specify path on local filesystem to backup from
  -e, --decrypt         Decrypt data before restoring
  -p PASSPHRASE, --passphrase PASSPHRASE
                        Passphrase for decrypt file
  -z, --uncompress      Uncompress gzip data before restoring
  -r, --replace         Replace existing files

listbackups

This command helps to list backups filtered by type ('media' or 'db'), by compression or encryption.

Help

usage: manage.py listbackups [-h] [--version] [-v {0,1,2,3}]
                             [--settings SETTINGS] [--pythonpath PYTHONPATH]
                             [--traceback] [--no-color] [--noinput] [-q]
                             [-d DATABASE] [-z] [-Z] [-e] [-E]
                             [-c CONTENT_TYPE]

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  -v {0,1,2,3}, --verbosity {0,1,2,3}
                        Verbosity level; 0=minimal output, 1=normal output,
                        2=verbose output, 3=very verbose output
  --settings SETTINGS   The Python path to a settings module, e.g.
                        "myproject.settings.main". If this isn't provided, the
                        DJANGO_SETTINGS_MODULE environment variable will be
                        used.
  --pythonpath PYTHONPATH
                        A directory to add to the Python path, e.g.
                        "/home/djangoprojects/myproject".
  --traceback           Raise on CommandError exceptions
  --no-color            Don't colorize the command output.
  --noinput             Tells Django to NOT prompt the user for input of any
                        kind.
  -q, --quiet           Tells Django to NOT output other text than errors.
  -d DATABASE, --database DATABASE
                        Filter by database name
  -z, --compressed      Exclude non-compressed
  -Z, --not-compressed  Exclude compressed
  -e, --encrypted       Exclude non-encrypted
  -E, --not-encrypted   Exclude encrypted
  -c CONTENT_TYPE, --content-type CONTENT_TYPE
                        Filter by content type 'db' or 'media'