Get the backup bot working

This commit is contained in:
Luke Murphy 2020-09-21 17:15:20 +02:00
parent 63f737ea3e
commit 6ed9626f59
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
2 changed files with 34 additions and 19 deletions

View File

@ -1,27 +1,32 @@
location: location:
source_directories: []
repositories: repositories:
- {{ env "BORGBASE_REPO" }} - {{ env "BORGBASE_REPO" }}
storage: storage:
compression: auto,zstd compression: auto,zstd
encryption_passphrase: CHANGEME encryption_passphrase: {{ secret "backup_bot_password" }}
archive_name_format: "{hostname}-{now}" archive_name_format: "{hostname}-{now}"
ssh_command: ssh -i /run/secrets/backup_bot_ssh_key ssh_command: "ssh -o 'StrictHostKeyChecking no' -i /run/secrets/backup_bot_ssh_key"
retention: retention:
keep_daily: 3 keep_daily: 3
keep_weekly: 4 keep_weekly: 4
keep_monthly: 12 keep_monthly: 12
keep_yearly: 2 keep_yearly: 2
prefix: "{hostname}-" prefix: "{hostname}-"
consistency: consistency:
checks: checks:
- disabled - disabled
check_last: 3 check_last: 3
prefix: "{hostname}-" prefix: "{hostname}-"
hooks: hooks:
before_backup:
- echo "`date` - Starting backup"
after_backup:
- echo "`date` - Finished backup"
mysql_databases: mysql_databases:
- name: {{ env "DB_TABLE" }} - name: {{ env "DB_TABLE" }}
hostname: {{ env "DB_HOST" }} hostname: {{ env "DB_HOST" }}

View File

@ -46,8 +46,12 @@ services:
backupbot: backupbot:
image: "decentral1se/backup-bot:0.0.1" image: "decentral1se/backup-bot:0.0.1"
networks:
- backend
secrets: secrets:
- backup_bot_ssh_key - source: backup_bot_ssh_key
mode: 0400
- backup_bot_password
- db_password - db_password
configs: configs:
- source: borgmatic_config_yml - source: borgmatic_config_yml
@ -62,7 +66,7 @@ services:
replicas: 0 replicas: 0
labels: labels:
- "swarm.cronjob.enable=true" - "swarm.cronjob.enable=true"
- "swarm.cronjob.schedule=0 2 * * *" # "At 02:00 every night" - "swarm.cronjob.schedule=0 2 * * *" # At 02:00
restart_policy: restart_policy:
condition: none condition: none
@ -78,7 +82,7 @@ volumes:
configs: configs:
borgmatic_config_yml: borgmatic_config_yml:
name: borgmatic_config_yml_v1 name: borgmatic_config_yml_v6
file: borgmatic.yml file: borgmatic.yml
template_driver: golang template_driver: golang
@ -89,3 +93,9 @@ secrets:
db_password: db_password:
external: true external: true
name: ${STACK_NAME}_db_password_${DB_ROOT_PASSWORD_VERSION} name: ${STACK_NAME}_db_password_${DB_ROOT_PASSWORD_VERSION}
backup_bot_ssh_key:
name: backup_bot_ssh_key_v1
external: true
backup_bot_password:
name: backup_bot_password_v1
external: true