blob: 42e7990a6901803bf9b90fee0a465bacfe5ee1e1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/usr/bin/env nix-shell
#!nix-shell -i bash
# shellcheck shell=bash
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
echo "Done."
echo "Running 'terraform apply'..."
terraform --version
terraform init
terraform apply
echo "Done."
echo "Storing .tfstate file"
pushd ../vps-state/
git add secrets/terraform.tfstate secrets/terraform.tfstate.backup
git commit -m "CI: update Terraform .tfstate files"
git push origin master
popd
echo "Done."
echo "Locking git-crypt repositories back..."
git crypt lock
pushd ../vps-state/
git crypt lock
popd
echo "Done."
|