Skip to content

Commit

Permalink
Merge pull request #3143 from SEED-platform/pgtarball
Browse files Browse the repository at this point in the history
cleanup scratch dir before starting restore
  • Loading branch information
nllong committed Feb 23, 2022
2 parents 1408325 + 35d7d5f commit fdd7a36
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docker/backup_k8s/tar_backup_database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ fi

# work in the scratch volume for storage
cd /scratch
# make sure that the scratch volume does not have
# any preexisting dumps as it will crash the pg_restore
# command below.
rm -f seed*.dump

# Download latest S3 backup
aws s3 cp $S3_BUCKET/$LATEST_DIR . --recursive --exclude "*" --include "seed*.dump"
Expand All @@ -88,4 +92,6 @@ tar -cJf $ARCHIVE /var/lib/postgresql/data
# push archived db to s3
aws s3 cp $ARCHIVE $S3_BUCKET/$LATEST_DIR

send_slack_notification "[$ENVIRONMENT]-tar-db-backup-uploaded-to-$S3_BUCKET/$LATEST_DIR/$ARCHIVE"

exit 0

0 comments on commit fdd7a36

Please sign in to comment.