services: backup: image: ghcr.io/schmelczer/backup-container:latest container_name: backup init: true tty: true environment: - TZ=Europe/London - SLEEP_TIME=1h # we will wait an hour between backups # first backup goes to rsync.net - 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=change-this-username@change-this-username.rsync.net:~/backup # second backup goes to a local path - 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: 10 # Used for determining the health of the container - MAX_BACKUP_AGE_SECONDS=86400 # default: 86400 (1d) volumes: - /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 - health-flag:/health # this is used to determine if the backup was successful and when it was last run - /bulk/backup:/local-backup # this is an example target backup path for BORG_REPO_1 from above - /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 restart: unless-stopped volumes: borg-cache: health-flag: