Skip to content

Commit

Permalink
Merge pull request #38 from djmaze/add-backup-args
Browse files Browse the repository at this point in the history
Allow custom backup arguments using RESTIC_BACKUP_ARGS
  • Loading branch information
djmaze authored Jun 7, 2020
2 parents 630d1d2 + 5580f50 commit 976d36f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ E.g.
* `RESTIC_REPOSITORY` - location of the restic repository. You can use [any target supported by restic](https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html). Default `/mnt/restic`
* `RESTIC_BACKUP_SOURCES` - source directory to backup. Make sure to mount this into the container as a volume (see the example configs). Default `/data`
* `RESTIC_PASSWORD` - password for the restic repository. Will also be used to initialize the repository if it is not yet initialized
* `RESTIC_BACKUP_ARGS` - Optional. Additional arguments given to *restic backup*.
* `RESTIC_BACKUP_TAGS` - Optional. Tags to set on each snapshot, separated by commas. E.g. `swarm,docker-volumes`
* `RESTIC_FORGET_ARGS` - Optional. If specified `restic forget` is run with the given arguments after each backup. E.g. `--prune --keep-last 14 --keep-daily 1`
* (Additional variables as needed for the chosen backup target. E.g. `B2_ACCOUNT_ID` and `B2_ACCOUNT_KEY` for Backblaze B2.)
Expand Down
2 changes: 1 addition & 1 deletion backup
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ start=`date +%s`
echo Starting Backup at $(date +"%Y-%m-%d %H:%M:%S")

set +e
restic backup ${tag_options} ${RESTIC_BACKUP_SOURCES}
restic backup ${RESTIC_BACKUP_ARGS:-} ${tag_options} ${RESTIC_BACKUP_SOURCES}
if [ $? -ne 0 ]
then
set -e
Expand Down
1 change: 1 addition & 0 deletions docker-compose.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ services:
RESTIC_REPOSITORY: b2:my-repo:/restic
RESTIC_PASSWORD: supersecret
RESTIC_BACKUP_SOURCES: /mnt/volumes
#RESTIC_BACKUP_ARGS: -v
RESTIC_BACKUP_TAGS: docker-volumes
RESTIC_FORGET_ARGS: --prune --keep-last 14 --keep-daily 1
B2_ACCOUNT_ID: xxxxxxx
Expand Down
1 change: 1 addition & 0 deletions docker-swarm.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ services:
RESTIC_REPOSITORY: b2:my-repo:/restic
RESTIC_PASSWORD: supersecret
RESTIC_BACKUP_SOURCES: /mnt/volumes
#RESTIC_BACKUP_ARGS: -v
RESTIC_BACKUP_TAGS: docker-volumes
RESTIC_FORGET_ARGS: --prune --keep-last 14 --keep-daily 1
B2_ACCOUNT_ID: xxxxxxx
Expand Down

0 comments on commit 976d36f

Please sign in to comment.