Sign inSign up

foorschtbar/pyd2b2

By foorschtbar

•Updated about 4 years ago

Python Docker Database Backup is a dockerized service to backup all of your database containers.

Image
1

2.9K

foorschtbar/pyd2b2 repository overview

⁠pyd2b2 - Python Docker Database Backup

⁠

⁠

Python Docker Database Backup is a dockerized service to automatically backup all of your database containers.

⁠Supported Databases

  • MySQL/MariaDB
  • PostgreSQL
  • InfluxDB 2.0 (64-bit only)

⁠Service Configuration

Configure the backup service by specifying environment variables:

NameDefaultDescription
TZUTCTime zone for schedule and times in log messages
SCHEDULE(none)Backup interval in cron like format⁠. If empty or not set, the cycle runs only once (one-time backup).
STARTUPfalseBackup all databases at startup.
SUCCESS_URL(none)A url who called after every successfull backup cycle
HC_UUID(none)Insert a HealthChecks.io⁠ UUID for monitoring
HC_PING_URLhttps://hc-ping.com/HealthChecks.io⁠ Ping Server URL if you run your own server
DEBUGfalseIncreased output
DUMP_UID-1UID of dump files. -1 means default (docker executing user)
DUMP_GID-1GID of dump files. -1 means default (docker executing user)
DUMP_DIR/dumpsFolder where database dumps are saved
DELETE_DAYS14Dump files older than this number of days should be deleted
KEEP_MIN20Number of dump files to keep for each container at least
CONTAINER_FILTER(none)For testing purposes: A comma-separated list of container names. Filter all containers that already have the enable-label. Example: app-db, database2
HELPER_NETWORK_NAMEpyd2b2-helpernetName of the temporary created network that pyd2b2 uses to connect to containers

You can also define global default values for all container specific labels. Do this by prepending the label name by GLOBAL_. For example, to provide a default username, you can set a default value for foorschtbar.pyd2b2.username by specifying the environment variable GLOBAL_USERNAME. See next chapter for reference.

⁠Database Configuration

Configure each database container by specifying labels. Every label must be prefixed by foorschtbar.pyd2b2.:

NameDefaultDescription
enablefalseEnable backup for this container
typeautoSpecify type of database. Possible values: auto, mysql, mariadb, postgres, influxdb. Auto tries to get the type from the image name (for specific well known images)
usernamerootLogin user
password(none)Login password
token(none)InfluxDB 2.0 access token
portautoPort (inside container). Possible values: auto or a valid port number. Auto gets the default port corresponding to the type.
compresstrueCompress SQL Dump with gzip
encryption_passphraseemptyA passphrase to encrypt the backup files. No encryption if empty.

⁠Example

Example docker-compose.yml:

version: "3"

services:
  db-backup: # backup service
    image: foorschtbar/pyd2b2
    environment:
      - TZ=Europe/Berlin
      - SCHEDULE=0 */12 * * *
      - STARTUP=true
      - GLOBAL_USERNAME=root
      - GLOBAL_ENCRYPTION_PASSPHRASE=secret-password
      - HC_UUID=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

  database1: # well known database image
    image: mariadb:latest
    environment:
      - MYSQL_ROOT_PASSWORD=secret-password
    labels:
      - foorschtbar.pyd2b2.enable=true

  database2: # custom database image
    image: user/my-database:latest
    environment:
      - DB_PASSWORD=secret-password
    labels:
      - foorschtbar.pyd2b2.enable=true
      - foorschtbar.pyd2b2.type=postgres
      - foorschtbar.pyd2b2.password=other-password

⁠Credits

Forked from jan-di/docker-database-backup⁠ Inspired by kibatic/docker-mysql-backup⁠

Tag summary

Content type

Image

Digest

sha256:58a9ff194…

Size

365.5 MB

Last updated

about 4 years ago

docker pull foorschtbar/pyd2b2