28 lines
1.6 KiB
Markdown
28 lines
1.6 KiB
Markdown
# Database Backup
|
|
|
|
Periodically do a backup of a database
|
|
|
|
This app uses [Ofelia](https://hub.docker.com/r/mcuadros/ofelia) to schedule a backup routine which may store one or more databases according to configuration.
|
|
|
|
## Configuration
|
|
|
|
Setup is made populating the _BACKUP_DATABASES_ environment variable with a list of backup configuration. Each backup setup must be in a single line and have two items: a database URL and a cron-like string indicating the periodicity of the backup.
|
|
|
|
### Examples
|
|
|
|
All examples listed refer to the (hipotetical) *mysql* server *mydatabase.com.br* logged with the username *db_user*:
|
|
- *schema*: mysql (at this moment is the only database supported)
|
|
- *username*: db_user
|
|
- *host*: mydatabase.com.br
|
|
|
|
mysql://db_user:123456@mydatabase.com.br:3306/database-to-backup @hourly
|
|
- *password*: 123456 (login will be attempted with this password)
|
|
- *port*: 3306 (as it is the default port for mysql it could be ommited)
|
|
- *database*: database-to-backup (only this database are going to be backuped and ommiting this value will vary depending on the database, generaly meaning backuping all accessible databases)
|
|
- *schedule*: @hourly (each 60 minutes, with the first occurence 60 minutes after starting the system)
|
|
mysql://db_user:123456@mydatabase.com.br 0 0 1 * * *
|
|
- *password*: 123456 (login will be attempted with this password)
|
|
- *schedule*: 0 0 1 * * * (in (GO implementation cron format)[https://godoc.org/github.com/robfig/cron])meaning on this case every night at 01h00)
|
|
mysql://db_user@mydatabase.com.br/* @daily
|
|
- *schedule*: @daily (onde a day starting 24h from starting)
|