diff --git a/infrastructure/docker-backup/image/resources/install.sh b/infrastructure/docker-backup/image/resources/install.sh index 7dec1b7..1fe81e5 100755 --- a/infrastructure/docker-backup/image/resources/install.sh +++ b/infrastructure/docker-backup/image/resources/install.sh @@ -6,5 +6,6 @@ install -m 0700 /tmp/entrypoint-start-and-wait.sh / install -m 0700 /tmp/init.sh /usr/local/bin/ install -m 0700 /tmp/backup.sh /usr/local/bin/ install -m 0700 /tmp/restore.sh /usr/local/bin/ +install -m 0700 /tmp/list-snapshots.sh /usr/local/bin/ install -m 0700 /tmp/start-maintenance.sh /usr/local/bin/ install -m 0700 /tmp/end-maintenance.sh /usr/local/bin/ diff --git a/infrastructure/docker-backup/image/resources/list-snapshots.sh b/infrastructure/docker-backup/image/resources/list-snapshots.sh new file mode 100755 index 0000000..b62a34a --- /dev/null +++ b/infrastructure/docker-backup/image/resources/list-snapshots.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -o pipefail + +function list-snapshot-files() { + if [ -z ${CERTIFICATE_FILE} ]; + then + restic -r ${RESTIC_REPOSITORY}/${backup_file_path} snapshots + else + restic -r ${RESTIC_REPOSITORY}/${backup_file_path} snapshots --cacert ${CERTIFICATE_FILE} + fi +} + +function main() { + file_env AWS_ACCESS_KEY_ID + file_env AWS_SECRET_ACCESS_KEY + + file_env POSTGRES_DB + file_env POSTGRES_PASSWORD + file_env POSTGRES_USER + + list-snapshot-roles + list-snapshot-db + list-snapshot-files +} + +source /usr/local/lib/functions.sh +source /usr/local/lib/file-functions.sh +source /usr/local/lib/pg-functions.sh + +main diff --git a/infrastructure/docker-backup/image/resources/restic-snapshots.sh b/infrastructure/docker-backup/image/resources/restic-snapshots.sh deleted file mode 100755 index ca889ce..0000000 --- a/infrastructure/docker-backup/image/resources/restic-snapshots.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -o pipefail - -function main() { - file_env AWS_ACCESS_KEY_ID - file_env AWS_SECRET_ACCESS_KEY - - restic -r ${RESTIC_REPOSITORY}/files snapshots -} - -source /usr/local/lib/functions.sh -source /usr/local/lib/file-functions.sh - -main