From 7304bb18f583aaf558b97e9244fbec63b6489e53 Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Sat, 23 Sep 2023 21:09:54 +0200 Subject: [PATCH] Put Nextcloud in maintenance mode during backups --- roles/docker_services/defaults/main.yml | 3 ++- roles/docker_services/tasks/services/restic.yml | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/roles/docker_services/defaults/main.yml b/roles/docker_services/defaults/main.yml index 7c1dfb3..2d4b9cc 100644 --- a/roles/docker_services/defaults/main.yml +++ b/roles/docker_services/defaults/main.yml @@ -60,7 +60,8 @@ services: sender_domains: - "{{ services.nextcloud.domain }}" -backup_volumes: +restic_volumes: + - "/var/run/docker.sock:/var/run/docker.sock:rw" - "{{ services.caddy.volume }}:/mnt/volumes/caddy:ro" - "{{ services.postfix.volume }}:/mnt/volumes/postfix:ro" - "{{ services.emby.volume }}:/mnt/volumes/emby:ro" diff --git a/roles/docker_services/tasks/services/restic.yml b/roles/docker_services/tasks/services/restic.yml index 2b33a1e..bb9b1ec 100644 --- a/roles/docker_services/tasks/services/restic.yml +++ b/roles/docker_services/tasks/services/restic.yml @@ -29,10 +29,14 @@ --keep-daily 7 --keep-weekly 5 --keep-monthly 12 + PRE_COMMANDS: |- + docker exec -u www-data nextcloud_app_1 php occ maintenance:mode --on + POST_COMMANDS_EXIT: |- + docker exec -u www-data nextcloud_app_1 php occ maintenance:mode --off B2_ACCOUNT_ID: "{{ secrets.restic.b2.id }}" B2_ACCOUNT_KEY: "{{ secrets.restic.b2.key }}" TZ: "{{ timezone }}" - volumes: "{{ backup_volumes }}" + volumes: "{{ restic_volumes }}" prune: image: mazzolino/restic:{{ services.restic.version }}