-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lab: add automatic restic offsite backup
Closes #142
- Loading branch information
Showing
6 changed files
with
96 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# SPDX-FileCopyrightText: Andrew Hayzen <[email protected]> | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
services: | ||
restic-offsite: | ||
container_name: restic_offsite | ||
image: docker.io/restic/restic:0.17.1@sha256:424a4e1fcc6fe2557b5614239dc71a2c793acb33a83ea217171bd7edc1862dcb | ||
entrypoint: | ||
- /bin/sh | ||
# Check if a repo exists | ||
# If it doesn't create one | ||
# Then wait forever to keep the container running so we can exec on it | ||
command: ["-c", "(/usr/bin/restic cat config || /usr/bin/restic init) && tail -F /dev/null"] | ||
env_file: | ||
- /etc/restic/offsite.env | ||
environment: | ||
RESTIC_PASSWORD_FILE: /etc/restic/password | ||
XDG_CACHE_HOME: /var/cache | ||
# Set a host to ensure that caches and settings are correct in restic | ||
# as docker containers have a new host name every time | ||
hostname: restic-offsite | ||
# Allocate a tty then restic prints more info used for testing | ||
tty: true | ||
volumes: | ||
- /etc/restic/offsite_env:/etc/restic/offsite_env:ro | ||
- /etc/restic/password:/etc/restic/password:ro | ||
# The source data | ||
- /mnt/data:/mnt/data:ro | ||
# Cache uses XDG_CACHE_HOME/restic | ||
# https://restic.readthedocs.io/en/stable/manual_rest.html#caching | ||
- /var/cache/docker-compose-runner/restic:/var/cache/restic:rw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
AWS_ACCESS_KEY_ID=aaaaaa | ||
AWS_SECRET_ACCESS_KEY=bbbbbb | ||
RESTIC_REPOSITORY=s3:domain/bucket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# SPDX-FileCopyrightText: Andrew Hayzen <[email protected]> | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters