lab-ansible/roles/apps/templates/compose-files/restic.yml.j2

64 lines
2.1 KiB
Plaintext
Raw Normal View History

# code: language=ansible-jinja
version: "3.8"
services:
backup:
image: mazzolino/restic:{{ apps_vars.restic.version }}
restart: always
environment:
RUN_ON_STARTUP: false
BACKUP_CRON: 0 0 3 * * *
2023-11-03 23:38:08 +00:00
RESTIC_REPOSITORY: b2:{{ restic.b2.bucket }}:{{ restic.repo.path }}
RESTIC_PASSWORD: {{ restic.repo.password }}
RESTIC_BACKUP_SOURCES: /mnt/volumes
RESTIC_BACKUP_ARGS: >-
2023-11-05 17:27:49 +00:00
--tag data-volumes
--exclude '*.tmp'
--verbose
RESTIC_FORGET_ARGS: >-
--keep-last 10
--keep-daily 7
--keep-weekly 5
--keep-monthly 12
PRE_COMMANDS: |-
2023-11-05 17:27:49 +00:00
docker compose -f {{ apps_data_root }}/nextcloud/docker-compose.yml exec -u www-data app php occ maintenance:mode --on
POST_COMMANDS_EXIT: |-
2023-11-05 17:27:49 +00:00
docker compose -f {{ apps_data_root }}/nextcloud/docker-compose.yml exec -u www-data app php occ maintenance:mode --off
B2_ACCOUNT_ID: {{ restic.b2.id }}
B2_ACCOUNT_KEY: {{ restic.b2.key }}
TZ: {{ timezone }}
volumes:
2023-11-05 17:27:49 +00:00
- "/var/run/docker.sock:/var/run/docker.sock:rw"
- "/usr/libexec/docker/cli-plugins/docker-compose:/usr/libexec/docker/cli-plugins/docker-compose:ro"
{% for app in apps_backup %}
- "{{ apps_data_root }}/{{ app }}/data:/mnt/volumes/{{ app }}:ro"
{% endfor %}
prune:
image: mazzolino/restic:{{ apps_vars.restic.version }}
restart: always
environment:
RUN_ON_STARTUP: false
PRUNE_CRON: 0 0 4 * * *
2023-11-03 23:38:08 +00:00
RESTIC_REPOSITORY: b2:{{ restic.b2.bucket }}:{{ restic.repo.path }}
RESTIC_PASSWORD: {{ restic.repo.password }}
RESTIC_PRUNE_ARGS: >-
--verbose
B2_ACCOUNT_ID: {{ restic.b2.id }}
B2_ACCOUNT_KEY: {{ restic.b2.key }}
TZ: {{ timezone }}
check:
image: mazzolino/restic:{{ apps_vars.restic.version }}
restart: always
environment:
RUN_ON_STARTUP: false
CHECK_CRON: 0 0 5 * * *
2023-11-03 23:38:08 +00:00
RESTIC_REPOSITORY: b2:{{ restic.b2.bucket }}:{{ restic.repo.path }}
RESTIC_PASSWORD: {{ restic.repo.password }}
RESTIC_CHECK_ARGS: >-
--verbose
B2_ACCOUNT_ID: {{ restic.b2.id }}
B2_ACCOUNT_KEY: {{ restic.b2.key }}
TZ: {{ timezone }}