diff options
| author | EuAndreh <eu@euandre.org> | 2019-05-28 00:46:24 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2019-05-28 00:49:16 -0300 |
| commit | 83b0be5ae5abecd2076cab8b7ab2a84e9756034a (patch) | |
| tree | b0492f618208f5bc9c207721362ce16eba1b9034 /provision.sh | |
| parent | Add secrets/borg_remote{.pub} SSH keypair (diff) | |
| download | toph-83b0be5ae5abecd2076cab8b7ab2a84e9756034a.tar.gz toph-83b0be5ae5abecd2076cab8b7ab2a84e9756034a.tar.xz | |
Add backup routing before possibly tearing down machine
Create a new backup entry before running =terraform apply=, which may (or may
not) destroy the current machine.
This shouldn't be an issue for the backup itself, since all of the data should
be stored in a separate Block Storage Volume, but we can take advantage of the
sevices already needing to be taken down in order to perform a full backup of
the data.
Diffstat (limited to '')
| -rwxr-xr-x | provision.sh | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/provision.sh b/provision.sh index 42e7990..e5f6baf 100755 --- a/provision.sh +++ b/provision.sh @@ -5,8 +5,11 @@ set -Eeuo pipefail cd "$(dirname "${BASH_SOURCE[0]}")" echo "Shutting down running containers and backing up data..." -envsubst < backup-and-shutdown.sh | ssh "$TLD" 'cat > /home/vps/backup-and-shutdown.sh' -ssh "$TLD" /home/vps/backup-and-shutdown.sh +ssh "$TLD" "cd /home/vps/ && docker-compose down" +scp ./secrets/borg_remote.pub "$TLD":/root/.ssh/id_rsa.pub +scp ./secrets/borg_remote "$TLD":/root/.ssh/id_rsa +envsubst < run-backup-template.sh | ssh "$TLD" 'cat > /home/vps/run-backup.sh && chmod +x /home/vps/run-backup.sh' +ssh "$TLD" /home/vps/run-backup.sh echo "Done." echo "Running 'terraform apply'..." |
