diff --git a/devices/teal/config/etc/restic/_global.env.sh b/devices/teal/config/etc/restic/_global.env.sh new file mode 100644 index 0000000..486f8b0 --- /dev/null +++ b/devices/teal/config/etc/restic/_global.env.sh @@ -0,0 +1,37 @@ +# shellcheck shell=sh + +# Global environment variables +# These variables are sourced FIRST, and any values inside of *.env.sh files for +# specific configurations will override if also defined there. + + +# Official instructions on how to setup the restic variables for Backblaze B2 can be found at +# https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#backblaze-b2 + + +# The restic repository encryption key +export RESTIC_PASSWORD_FILE="/etc/restic/pw.txt" +# The global restic exclude file +export RESTIC_BACKUP_EXCLUDE_FILE="/etc/restic/backup_exclude.txt" + +# Backblaze B2 credentials keyID & applicationKey pair. +# Restic environment variables are documented at https://restic.readthedocs.io/en/latest/040_backup.html#environment-variables +export B2_ACCOUNT_ID="" # *EDIT* fill with your keyID +export B2_ACCOUNT_KEY="" # *EDIT* fill with your applicationKey + +# How many network connections to set up to B2. Default is 5. +export B2_CONNECTIONS=10 + +# Optional extra space-separated args to restic-backup. +# This is empty here and profiles can override this after sourcing this file. +export RESTIC_BACKUP_EXTRA_ARGS= + +# Verbosity level from 0-3. 0 means no --verbose. +# Override this value in a profile if needed. +export RESTIC_VERBOSITY_LEVEL=0 + +# (optional, uncomment to enable) Backup summary stats log: snapshot size, etc. (empty/unset won't log) +#export RESTIC_BACKUP_STATS_DIR="/var/log/restic-automatic-backup-scheduler" + +# (optional) Desktop notifications. See README and restic_backup.sh for details on how to set this up (empty/unset means disabled) +export RESTIC_BACKUP_NOTIFICATION_FILE= diff --git a/devices/teal/config/etc/restic/backup_exclude.txt b/devices/teal/config/etc/restic/backup_exclude.txt new file mode 100644 index 0000000..c591cbd --- /dev/null +++ b/devices/teal/config/etc/restic/backup_exclude.txt @@ -0,0 +1,10 @@ +/.snapshots/ +/opt +/root/.cache/ +/usr/share/**/*.html +/usr/share/help/ +/usr/share/licenses/ +/usr/share/man/ +/usr/src/ +/var/cache/ +/var/log/ diff --git a/devices/teal/config/etc/restic/default.env.sh b/devices/teal/config/etc/restic/default.env.sh new file mode 100644 index 0000000..4ef9be8 --- /dev/null +++ b/devices/teal/config/etc/restic/default.env.sh @@ -0,0 +1,45 @@ +# shellcheck shell=sh + +# This is the default profile. Fill it with your desired configuration. +# Additionally, you can create and use more profiles by copying this file. + +# This file (and other .env.sh files) has two purposes: +# - being sourced by systemd timers to setup the backup before running restic_backup.sh +# - being sourced in a user's shell to work directly with restic commands e.g. +# $ source /etc/restic/default.env.sh +# $ restic snapshots +# Thus you don't have to provide all the arguments like +# $ restic --repo ... --password-file ... + +# shellcheck source=etc/restic/_global.env.sh +. "/etc/restic/_global.env.sh" + +# Envvars below will override those in _global.env.sh if present. + +export RESTIC_REPOSITORY="sftp:sftpuser@Cygnus:/Backup/restic/teal" # *EDIT* fill with your repo name + +# What to backup. Colon-separated paths e.g. to different mountpoints "/home:/mnt/usb_disk". +# To backup only your home directory, set "/home/your-user" +export RESTIC_BACKUP_PATHS="/mnt/storage/appdata" # *EDIT* fill conveniently with one or multiple paths + + +# Example below of how to dynamically add a path that is mounted e.g. external USB disk. +# restic does not fail if a specified path is not mounted, but it's nicer to only add if they are available. +#test -d /mnt/media && RESTIC_BACKUP_PATHS+=" /mnt/media" + +# A tag to identify backup snapshots. +export RESTIC_BACKUP_TAG=systemd.timer + +# Retention policy - How many backups to keep. +# See https://restic.readthedocs.io/en/stable/060_forget.html?highlight=month#removing-snapshots-according-to-a-policy +export RESTIC_RETENTION_HOURS=1 +export RESTIC_RETENTION_DAYS=14 +export RESTIC_RETENTION_WEEKS=16 +export RESTIC_RETENTION_MONTHS=18 +export RESTIC_RETENTION_YEARS=3 + +# Optional extra space-separated arguments to restic-backup. +# Example: Add two additional exclude files to the global one in RESTIC_PASSWORD_FILE. +#RESTIC_BACKUP_EXTRA_ARGS="--exclude-file /path/to/extra/exclude/file/a --exclude-file /path/to/extra/exclude/file/b" +# Example: exclude all directories that have a .git/ directory inside it. +#RESTIC_BACKUP_EXTRA_ARGS="--exclude-if-present .git" diff --git a/devices/teal/config/etc/restic/pw.txt b/devices/teal/config/etc/restic/pw.txt new file mode 100644 index 0000000..ffb4e7c --- /dev/null +++ b/devices/teal/config/etc/restic/pw.txt @@ -0,0 +1 @@ +LambDuck1977