diff options
author | EuAndreh <eu@euandre.org> | 2019-06-06 23:56:44 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2019-06-06 23:56:44 -0300 |
commit | d9c407a182498a75fba19ea6cd3bb5cc2535ed6b (patch) | |
tree | ac58bd1b5b3aa26426a78d1faf2baad5a6198d24 /scripts/box | |
parent | Uncomment docker-compose starting Ansible task (diff) | |
download | server-d9c407a182498a75fba19ea6cd3bb5cc2535ed6b.tar.gz server-d9c407a182498a75fba19ea6cd3bb5cc2535ed6b.tar.xz |
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.
Diffstat (limited to 'scripts/box')
-rwxr-xr-x | scripts/box/restore-backup.env.sh | 7 |
1 files changed, 7 insertions, 0 deletions
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}" |