From 34895b7372d9096936cff355aaed57430f86e483 Mon Sep 17 00:00:00 2001 From: "mattisderbock@gmail.com" Date: Fri, 27 Nov 2020 09:13:18 +0100 Subject: [PATCH 1/2] removed maintenance mode from backup and restore --- infrastrucure/docker/image/resources/backup.sh | 2 ++ infrastrucure/docker/image/resources/restore.sh | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/infrastrucure/docker/image/resources/backup.sh b/infrastrucure/docker/image/resources/backup.sh index 9f5d1b2..719a464 100644 --- a/infrastrucure/docker/image/resources/backup.sh +++ b/infrastrucure/docker/image/resources/backup.sh @@ -1,6 +1,8 @@ +su -s /bin/bash -c 'php occ maintenance:mode --on' www-data set -o pipefail # backup database dump pg_dump -d $(cat ${POSTGRES_DB_FILE}) -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USER_FILE}) --no-password --serializable-deferrable --clean --no-privileges | \ restic -r $RESTIC_REPOSITORY --verbose backup --stdin --tag DB_Backup # backup nextcloud filesystem restic -r $RESTIC_REPOSITORY backup /var/backups/ --tag Nextcloud_Filesystem +su -s /bin/bash -c 'php occ maintenance:mode --off' www-data diff --git a/infrastrucure/docker/image/resources/restore.sh b/infrastrucure/docker/image/resources/restore.sh index 6aa09ed..63a1f80 100644 --- a/infrastrucure/docker/image/resources/restore.sh +++ b/infrastrucure/docker/image/resources/restore.sh @@ -1,4 +1,6 @@ # Restore Nextcloud Filesystem +# turn on maintenance mode +su -s /bin/bash -c 'php occ maintenance:mode --on' www-data # Reads restore snapshot_ID from first CLI Argument restic -r $RESTIC_REPOSITORY restore $1 --target / @@ -9,4 +11,6 @@ psql -d template1 -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USE # create folder from db backup restic -r $RESTIC_REPOSITORY restore $2 --target test-stdin-$2 # read folder and restore db entries -psql -d $(cat ${POSTGRES_DB_FILE}) -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USER_FILE}) --no-password < test-stdin-$2 \ No newline at end of file +psql -d $(cat ${POSTGRES_DB_FILE}) -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USER_FILE}) --no-password < test-stdin-$2 +# turn off maintenance mode +su -s /bin/bash -c 'php occ maintenance:mode --off' www-data From 82751c0b54a3baac7b062b02a1558469aa63f9d0 Mon Sep 17 00:00:00 2001 From: "mattisderbock@gmail.com" Date: Fri, 27 Nov 2020 09:16:25 +0100 Subject: [PATCH 2/2] removed maintenance mode from backup and restore --- infrastrucure/docker/image/resources/backup.sh | 2 -- infrastrucure/docker/image/resources/restore.sh | 5 +---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/infrastrucure/docker/image/resources/backup.sh b/infrastrucure/docker/image/resources/backup.sh index 719a464..9f5d1b2 100644 --- a/infrastrucure/docker/image/resources/backup.sh +++ b/infrastrucure/docker/image/resources/backup.sh @@ -1,8 +1,6 @@ -su -s /bin/bash -c 'php occ maintenance:mode --on' www-data set -o pipefail # backup database dump pg_dump -d $(cat ${POSTGRES_DB_FILE}) -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USER_FILE}) --no-password --serializable-deferrable --clean --no-privileges | \ restic -r $RESTIC_REPOSITORY --verbose backup --stdin --tag DB_Backup # backup nextcloud filesystem restic -r $RESTIC_REPOSITORY backup /var/backups/ --tag Nextcloud_Filesystem -su -s /bin/bash -c 'php occ maintenance:mode --off' www-data diff --git a/infrastrucure/docker/image/resources/restore.sh b/infrastrucure/docker/image/resources/restore.sh index 63a1f80..90972c9 100644 --- a/infrastrucure/docker/image/resources/restore.sh +++ b/infrastrucure/docker/image/resources/restore.sh @@ -1,6 +1,5 @@ # Restore Nextcloud Filesystem -# turn on maintenance mode -su -s /bin/bash -c 'php occ maintenance:mode --on' www-data + # Reads restore snapshot_ID from first CLI Argument restic -r $RESTIC_REPOSITORY restore $1 --target / @@ -12,5 +11,3 @@ psql -d template1 -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USE restic -r $RESTIC_REPOSITORY restore $2 --target test-stdin-$2 # read folder and restore db entries psql -d $(cat ${POSTGRES_DB_FILE}) -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USER_FILE}) --no-password < test-stdin-$2 -# turn off maintenance mode -su -s /bin/bash -c 'php occ maintenance:mode --off' www-data