Skip to main content

Backups

Github Status

Tool to backup databases.

Installation

pip install --upgrade backups

Usage

$ backups --help
Backups mysql databases

Usage:
  backups env
  backups ls                    [--file FILE] [--verbose]
  backups show JOB              [--file FILE] [--verbose]
  backups databases JOB         [--file FILE] [--verbose]
  backups run JOB               [--file FILE] [--verbose] [--dryrun]
  backups run JOB [DATABASE]    [--file FILE] [--verbose] [--dryrun]

Commands:
  env         Show the current environment
  ls          Prints the backup job names
  show        Prints the configuration for a job
  databases   Lists all databases on a backup job server
  run         Runs the backup for a job

Options:
  -f --file FILE    The backups config file (default /etc/backups/backups.yaml)
  -d --dryrun       Just prints the commands but doesn't execute them
  -v --verbose      Adds verbosity
  -h --help         Prints this help
     --version      Prints the current version

Environment variables:
  BACKUPS_FILE          The backups file (default /etc/backups/backups.yaml)
  BACKUPS_DUMPS_DIR     The dumps directory (default /tmp/backups)
  BACKUPS_MYSQLDUMP     The mysqldump binary (default picked from $PATH)
  BACKUPS_LOG_LEVEL     Default INFO
  BACKUPS_STDERR        The stderr log file (default /tmp/backups.err)

Check https://github.com/ptdorf/backups#backups for more info

Setup

Create a backups.yaml file with content similar to:

backups:
  jobs:
    acme:
      connection:
        type:     mysql
        host:     !Env ${BACKUPS_DB_HOST:acme.com}
        username: !Env ${BACKUPS_DB_USERNAME:backup}
        password: !Env ${BACKUPS_DB_PASSWORD}
      options:
        # Dumps the entire server into a single file (this is the default)
        server: true
        # By default it will create a single dump file for each database found
        # Uncomment to only backups specific databases (one on each file)
        # databases:
        # - main_db
        # - other_db
      compress:
      - type:     zip
        pasword:  !Env ${BACKUPS_ZIP_PASSWORD}
      upload:
      - type:     s3
        bucket:   acme-backups
        prefix:   databases
        enabled:  true
      notify:
      - type:     slack
        channel:  "#backups"
        webhook:  !Env ${BACKUPS_SLACK_WEBHOOK:https://hooks.slack.com/services/x/y/z}

Notice the use of the environment variables, like BACKUPS_DB_HOST, used in combination with the !Env yaml resolver. If they exist they get resolved to their values. Use the format ${VAR_NAME:default_value} to use default_value if $VAR_NAME is not defined.

Now run it with

backups run acme --file backups.yaml

You can use the BACKUPS_FILE env var instead:

export BACKUPS_FILE=backups.yaml
backups run acme

Metadata

Release files for backups 0.3.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for backups 0.3.7
File Size Uploaded Provenance
backups-0.3.7.tar.gz 9.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for backups 0.3.7
File Interpreter ABI Platform
backups-0.3.7-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 21.8 kB

Release files / backups-0.3.7.tar.gz

Download URL backups-0.3.7.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7eee92e4c1d7f1237e7ab65ab44d2b0f2db00c6fccda558ec4c09bafa628a584
BLAKE2b-256 checksum
How to use checksums
b1c194eb6d098512de09c86bae2423bdc4775e091253dd1ad6fbeefa8721c6f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.3.3 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release files / backups-0.3.7-py2.py3-none-any.whl

Download URL backups-0.3.7-py2.py3-none-any.whl
Size 11.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
abb7189c6960697dc34663a4aa101ded54814adbcc63248f302cda8fe5168c39
BLAKE2b-256 checksum
How to use checksums
8ccd7e29869b1ee23bbd763d8667300a0c10ed7865373c9988256ff31a5eef48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.3.3 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Security for backups 0.3.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page