Add backups with gobackup and restic
This commit is contained in:
19
files/backups/gobackup.yml.j2
Normal file
19
files/backups/gobackup.yml.j2
Normal file
@ -0,0 +1,19 @@
|
||||
# https://gobackup.github.io/configuration
|
||||
|
||||
models:
|
||||
|
||||
gramps:
|
||||
compress_with:
|
||||
type: 'tgz'
|
||||
storages:
|
||||
local:
|
||||
type: 'local'
|
||||
path: '{{ (backup_directory, "gramps") | path_join }}'
|
||||
keep: 2
|
||||
archive:
|
||||
includes:
|
||||
- /home/major/applications/gramps/data
|
||||
excludes:
|
||||
- /home/major/applications/gramps/data/gramps_cache
|
||||
- /home/major/applications/gramps/data/gramps_thumb_cache
|
||||
- /home/major/applications/gramps/data/gramps_tmp
|
24
files/backups/restic-backup.sh.j2
Normal file
24
files/backups/restic-backup.sh.j2
Normal file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
echo "Backup: perform backup with gobackup"
|
||||
|
||||
gobackup perform --config={{ backup_gobackup_config }}
|
||||
|
||||
echo "Backup: send backups to remote storage with retic"
|
||||
|
||||
restic-shell.sh backup --verbose {{ backup_directory }} \
|
||||
&& restic-shell.sh check \
|
||||
&& restic-shell.sh forget --compact --prune --keep-daily 90 --keep-monthly 36 \
|
||||
&& restic-shell.sh check
|
||||
|
||||
echo "Backup: send notification"
|
||||
|
||||
curl -s -X POST 'https://api.telegram.org/bot{{ notifications_tg_bot_token }}/sendMessage' \
|
||||
-d 'chat_id={{ notifications_tg_chat_id }}' \
|
||||
-d 'parse_mode=HTML' \
|
||||
-d 'text=<b>{{ notifications_name }}</b>: бекап успешно завершен!'
|
||||
|
||||
echo -e "\nBackup: done"
|
12
files/backups/restic-shell.sh.j2
Normal file
12
files/backups/restic-shell.sh.j2
Normal file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
export RESTIC_REPOSITORY={{ restic_repository }}
|
||||
export RESTIC_PASSWORD={{ restic_password }}
|
||||
export AWS_ACCESS_KEY_ID={{ restic_s3_access_key }}
|
||||
export AWS_SECRET_ACCESS_KEY={{ restic_s3_access_secret }}
|
||||
export AWS_DEFAULT_REGION={{ restic_s3_region }}
|
||||
|
||||
restic "$@"
|
Reference in New Issue
Block a user