backup-docker/README.md

67 lines
1.5 KiB
Markdown
Raw Normal View History

2021-03-29 20:36:48 +00:00
Use [restic](https://restic.net/) together with rclone for a poor mans backup solution.
2022-03-20 20:06:53 +00:00
# Configuration
2021-03-29 20:36:48 +00:00
Environment variables:
`RCLONE_REMOTE` remote for rclone e.g. `gdrive:/backup`
`RCLONE_CONFIG` file path for the rclone config file e.g. `/config/rclone.conf`
2022-03-20 20:06:53 +00:00
`RESTIC_PASSWORD` or `RESTIC_PASSWORD_FILE` password for the repo
`RCLONE_CONFIG_FILE` content of the rclone config.
2021-06-17 20:49:09 +00:00
For the database:
`MYSQL_DUMP_DB` all databases comma sperated: `db1,db2`
`MYSQL_HOST`
`MYSQL_USERNAME`
`MYSQL_PASSWORD` or `MYSQL_PASSWORD_FILE`
2021-07-01 09:58:02 +00:00
2022-03-20 20:06:53 +00:00
`POSTGRES_DUMP_DB` all databases comma sperated: `db1,db2`
`POSTGRES_HOST`
`POSTGRES_USERNAME`
`POSTGRES_PASSWORD` or `POSTGRES_PASSWORD_FILE`
Use the `/app/init.sh` script to init a new remote.
# Directorys
`/config` Contains the rclone config.
`/backup` Contains the mounted volumes as read only
`/restore` Contains volumes to restore
# Usage
Here is an example of the script i use to backup my volumes:
```sh
#!/usr/bin/env sh
set -e
# get all volumes with the "backup.enable" lable on it
BACKUP_VOL=$(docker volume ls --filter "label=backup.enable" --format '-v {{ .Name }}:/backup/{{ .Name }}:ro ')
docker run \
--rm \
-e "RCLONE_REMOTE=gdrive:/backup" \
-e "RCLONE_CONFIG=/config/rclone.conf" \
-e "ENC_PASSWORD=MyPassword" \
-e "MYSQL_USERNAME=root" \
-e "MYSQL_PASSWORD=dbPassword" \
-e "MYSQL_DUMP_DB=db1,db2" \
-e "MYSQL_HOST=databaseHost" \
--network "dbNet" \
-v "/var/docker/backup:/config" \
$BACKUP_VOL \
2022-03-27 00:31:46 +00:00
djeeberjr/backup \
backup
2022-03-20 20:06:53 +00:00
```