Make exmaple compose file self-sufficient

This commit is contained in:
Andras Schmelczer 2024-06-02 13:24:32 +01:00
parent d44c96a792
commit eb26865482
2 changed files with 8 additions and 10 deletions

View file

@ -1,31 +1,30 @@
services:
backup:
image: ghcr.io/schmelczer/backup-container:latest
container_name: backup
init: true
tty: true
build:
context: .
environment:
- TZ=Europe/London
- SLEEP_TIME=1h # we will wait an hour between backups
# first backup goes to rsync.net
- BORG_PASSPHRASE_0=$PASSWORD
- BORG_PASSPHRASE_0=MY_PASSWORD_CHANGE_THIS
- BORG_REMOTE_PATH_0=borg1 # we must use this executable in the rsync.net host
- BORG_REPO_0=my-username@my-username.rsync.net:~/backup
- BORG_REPO_0=change-this-username@change-this-username.rsync.net:~/backup
# second backup goes to a local path
- BORG_PASSPHRASE_1=$PASSWORD
- BORG_PASSPHRASE_1=MY_PASSWORD_CHANGE_THIS
- BORG_REPO_1=/local-backup
# the following are passed to `borg prune`
- KEEP_DAILY=6 # default: 6
- KEEP_WEEKLY=3 # default: 3
- KEEP_MONTHLY=48 # default: 48
- KEEP_YEARLY=10 # default: 0
- KEEP_YEARLY=10 # default: 0 (!)
volumes:
- /volumes:/source:ro # we will backup this folder, we mustn't change it, so it's readonly
- /volumes/backup:/snapshot # we must mount a btrfs path for the snapshot to be put at, this is just a temporary path
- /volumes:/source:ro # we backup this folder (which is a BTRFS volume), we mustn't change it, so it's readonly
- /volumes/backup:/snapshot # we must mount a path to a folder on the BTRFS disk for the snapshot to be put at, this is just a temporary path
- /volumes/backup/logs:/backup-logs # we will store the output of the backup commands in this folder
- borg-cache:/root/.cache/borg # speed up subsequent backups
@ -33,7 +32,7 @@ services:
- /volumes/backup/config/id_rsa:/root/.ssh/id_rsa # this is an example for mounting an ssh key for a remote repo (BORG_REPO_0 above)
cap_add:
- SYS_ADMIN # we need this capability to snapshot a btrfs volume
- SYS_ADMIN # we need this capability to snapshot a BTRFS volume
restart: unless-stopped
volumes: