Skip to content

Command Line Interface

A command line interface is used to backup and restore the databases. For a one time backup the backup subcommand is used, to run it as a cron job the backup-cron subcommand is used.

db-backup-runner backup-cron

Usually the cron job is started as docker compose service, which is the default entry point. The documented arguments can be used either in command or environment section.

db-backup-runner

Main command to backup and restore databases.

Usage:

db-backup-runner [OPTIONS] COMMAND [ARGS]...

Options:

  -v, --verbose  Enable verbose output.  [env var: DB_BACKUP_VERBOSE]
  --help         Show this message and exit.

Subcommands

  • backup: Run a manual backup.
  • backup-cron: Run backup based on the schedule.
  • restore: Restore a backup for a specific container.

db-backup-runner backup

Run a manual backup.

Usage:

db-backup-runner backup [OPTIONS]

Options:

  -c, --compression [gzip|lzma|xz|bz2|plain]
                                  Compression algorithm.  [env var:
                                  DB_BACKUP_COMPRESSION; default: plain]
  -p, --project TEXT              Project name, used if it is not started with
                                  docker compose.  [env var:
                                  DB_BACKUP_PROJECT_NAME]
  -b, --backup-dir TEXT           Backup directory.  [env var: DB_BACKUP_DIR;
                                  default: /tmp/db_backup_runner]
  -t, --use-timestamp             Add a timestamp to the backup filename.
                                  [env var: DB_BACKUP_USE_TIMESTAMP]
  -w, --webhook TEXT              Heartbeat webhook address.  [env var:
                                  DB_BACKUP_WEBHOOK]
  -g, --global                    Run in global mode, backup any container
                                  (e.g. not just the one defined in
                                  'project'.).  [env var: DB_BACKUP_GLOBAL]
  --help                          Show this message and exit.

db-backup-runner backup-cron

Run backup based on the schedule.

Usage:

db-backup-runner backup-cron [OPTIONS]

Options:

  -c, --cron TEXT                 Cron schedule (https://crontab.guru), per
                                  default it runs at 2am every day.  [env var:
                                  DB_BACKUP_CRON; default: 0 2 * * *]
  -o, --on-startup                Run backup on startup as well.  [env var:
                                  DB_BACKUP_ON_STARTUP]
  -c, --compression [gzip|lzma|xz|bz2|plain]
                                  Compression algorithm.  [env var:
                                  DB_BACKUP_COMPRESSION; default: plain]
  -p, --project TEXT              Project name, used if it is not started with
                                  docker compose.  [env var:
                                  DB_BACKUP_PROJECT_NAME]
  -b, --backup-dir TEXT           Backup directory.  [env var: DB_BACKUP_DIR;
                                  default: /tmp/db_backup_runner]
  -t, --use-timestamp             Add a timestamp to the backup filename.
                                  [env var: DB_BACKUP_USE_TIMESTAMP]
  -w, --webhook TEXT              Heartbeat webhook address.  [env var:
                                  DB_BACKUP_WEBHOOK]
  -g, --global                    Run in global mode, backup any container
                                  (e.g. not just the one defined in
                                  'project'.).  [env var: DB_BACKUP_GLOBAL]
  --help                          Show this message and exit.

db-backup-runner restore

Restore a backup for a specific container.

Usage:

db-backup-runner restore [OPTIONS] RESTORE_FILE

Options:

  -p, --project TEXT              Project name, used if it is not started with
                                  docker compose.  [env var:
                                  DB_BACKUP_PROJECT_NAME]
  -t, --target CONTAINER|SERVICE  Optional target which is either a container
                                  id, name or service name.
  --help                          Show this message and exit.