Skip to content

Commit

Permalink
Save old deployment before saving new one
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljharvey committed Nov 1, 2023
1 parent e0552cc commit f4a79d7
Show file tree
Hide file tree
Showing 3 changed files with 2,103 additions and 0 deletions.
2 changes: 2 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ test *args: start-dependencies create-aurora-deployment

# re-generate the deployment configuration file
generate-chinook-configuration: build start-dependencies
./scripts/archive-old-deployment.sh '{{POSTGRES_CHINOOK_DEPLOYMENT}}'
exit 0
./scripts/generate-chinook-configuration.sh 'ndc-postgres' '{{POSTGRESQL_CONNECTION_STRING}}' '{{POSTGRES_CHINOOK_DEPLOYMENT}}'
./scripts/generate-chinook-configuration.sh 'ndc-postgres' '{{CITUS_CONNECTION_STRING}}' '{{CITUS_CHINOOK_DEPLOYMENT}}'
./scripts/generate-chinook-configuration.sh 'ndc-postgres' '{{COCKROACH_CONNECTION_STRING}}' '{{COCKROACH_CHINOOK_DEPLOYMENT}}'
Expand Down
22 changes: 22 additions & 0 deletions scripts/archive-old-deployment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -e -u -o pipefail

# before we generate a new deployment, save the current one in
# `/static/deployment-snapshots` so we can ensure they can all be read over
# time

CHINOOK_DEPLOYMENT="$1"

CURRENT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" > /dev/null && echo "$PWD")"

SNAPSHOT_DIR="$(realpath ${CURRENT_DIR}/../static/deployment-snapshots)"

mkdir -p "$SNAPSHOT_DIR"

NEW_FILENAME="$(sha256sum "${CHINOOK_DEPLOYMENT}" | cut -f1 -d' ').json"

echo "$SNAPSHOT_DIR"

echo "${CHINOOK_DEPLOYMENT}"

cp "${CHINOOK_DEPLOYMENT}" "${SNAPSHOT_DIR}/${NEW_FILENAME}"
Loading

0 comments on commit f4a79d7

Please sign in to comment.