Go to file
kolaente 02ba460b3a
Add tests to build mysql args
2021-08-18 22:34:28 +02:00
.gitignore Add postgres dumper 2021-08-18 21:50:04 +02:00
README.md Fix typo 2021-08-18 22:05:17 +02:00
client.go Add methods to get containers 2021-08-18 20:09:45 +02:00
config.go Add readme 2021-08-18 22:05:02 +02:00
dump.go Add dump helpers 2021-08-18 21:29:17 +02:00
dump_mysql.go Add tests to build mysql args 2021-08-18 22:34:28 +02:00
dump_mysql_test.go Add tests to build mysql args 2021-08-18 22:34:28 +02:00
dump_postgres.go Add tests for building the postgres backup command 2021-08-18 22:27:21 +02:00
dump_postgres_test.go Add tests for building the postgres backup command 2021-08-18 22:27:21 +02:00
go.mod Add methods to get containers 2021-08-18 20:09:45 +02:00
go.sum Add methods to get containers 2021-08-18 20:09:45 +02:00
helper.go Add dump helpers 2021-08-18 21:29:17 +02:00
main.go Add todos 2021-08-18 21:50:15 +02:00
save.go Add dump helpers 2021-08-18 21:29:17 +02:00
store.go Add todos 2021-08-18 21:50:15 +02:00

README.md

Zero-Fuss Docker Database Backup

A simple tool to create backup of all databases on a host. Supports postgres and mysql/mariadb.

Successor to this script.

Usage

Simply point it at your docker socket, mount a backup volume and be done:

docker run -v $PWD:/backups -v /var/run/docker.sock:/var/run/docker.sock kolaente/db-backup

The tool will find all database containers and create backups of them periodically. It will also discover new containers as they are started and won't try to back up containers which have gone away.

When running, all backups for the current run are time-stamped into a sub folder of the backup directory (see below).

Config

All config is done with environment variables.

BACKUP_FOLDER

Where all backup files will be stored.

Default: /backups

BACKUP_INTERVAL

The interval at which backups will happen. Must be a parsable string as time.Duration. Must be positive.

Default: 3h

BACKUP_MAX

How many backups to keep. If more backups are stored in the backup folder, the oldest one will be removed until there are only as many as this config variabls.

Default: 24