From d9c407a182498a75fba19ea6cd3bb5cc2535ed6b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 6 Jun 2019 23:56:44 -0300 Subject: Add ${DESTROY_VOLUME} operational toggle This way I can dynamically control whether to destroy and recreate all the existing infrastructure entirely from scratch. The advantages of doing so are: - test the non-existence of local state on every deployment; - make sure I can always recreate everything from scratch. The disadvantages are: - slower deployment times; - longer downtime during deployments. --- scripts/box/restore-backup.env.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'scripts/box/restore-backup.env.sh') diff --git a/scripts/box/restore-backup.env.sh b/scripts/box/restore-backup.env.sh index 2c12f21..5eb575b 100755 --- a/scripts/box/restore-backup.env.sh +++ b/scripts/box/restore-backup.env.sh @@ -1,6 +1,13 @@ #!/usr/bin/env bash set -Eeuo pipefail +# Check for ${DOLLAR}{DESTROY_VOLUME} interpolated value +[[ "${DESTROY_VOLUME}" != "" ]] || { + echo "Volume is not fresh." + echo "Skipping restoring from backup." + exit 0 +} + export BORG_REMOTE_PATH="${BORG_REMOTE_PATH}" export BORG_PASSPHRASE="${BORG_PASSPHRASE}" -- cgit v1.2.3