diff --git a/infrastrucure/docker/image/resources/backup.sh b/infrastrucure/docker/image/resources/backup.sh index bdff344..4db63cc 100755 --- a/infrastrucure/docker/image/resources/backup.sh +++ b/infrastrucure/docker/image/resources/backup.sh @@ -4,7 +4,7 @@ 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 +restic -r $RESTIC_REPOSITORY/db backup --stdin # backup nextcloud filesystem -restic -r $RESTIC_REPOSITORY backup /var/backups/ --tag Nextcloud_Filesystem +restic -r $RESTIC_REPOSITORY/files backup /var/backups/ diff --git a/infrastrucure/docker/image/resources/init.sh b/infrastrucure/docker/image/resources/init.sh index 15b970b..8f619eb 100755 --- a/infrastrucure/docker/image/resources/init.sh +++ b/infrastrucure/docker/image/resources/init.sh @@ -1,3 +1,4 @@ #!/bin/bash -restic -r $RESTIC_REPOSITORY --verbose init +restic -r $RESTIC_REPOSITORY/db --verbose init +restic -r $RESTIC_REPOSITORY/files --verbose init diff --git a/infrastrucure/docker/image/resources/restore.sh b/infrastrucure/docker/image/resources/restore.sh index c5f54d2..94b20b0 100755 --- a/infrastrucure/docker/image/resources/restore.sh +++ b/infrastrucure/docker/image/resources/restore.sh @@ -4,13 +4,13 @@ # TODO: describe input params # Reads restore snapshot_ID from first CLI Argument -restic -r $RESTIC_REPOSITORY restore $1 --target / +restic -r $RESTIC_REPOSITORY/files restore latest --target /var/backups/ # Delete DB psql -d template1 -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USER_FILE}) --no-password -c "DROP DATABASE \"cloud\";" # Create DB again psql -d template1 -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USER_FILE}) --no-password -c "CREATE DATABASE \"cloud\";" # create folder from db backup -restic -r $RESTIC_REPOSITORY restore $2 --target test-stdin-$2 +restic -r $RESTIC_REPOSITORY/db restore latest --target test-stdin # 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/stdin +psql -d $(cat ${POSTGRES_DB_FILE}) -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USER_FILE}) --no-password < test-stdin/stdin