Skip to content

Commit

Permalink
Merge pull request #440 from johnseekins/remove-full-backup
Browse files Browse the repository at this point in the history
remove full backup (we have snapshots)
  • Loading branch information
johnseekins authored Aug 15, 2023
2 parents 3ecfec0 + 96634d7 commit 70e4a85
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions docker/cron/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ set -e
####

# backup everything to private archive
echo "Extracting full backup..."
pg_dump -Fc openstatesorg > openstatesorg.pgdump
echo "Shipping full backup to s3"
aws s3 cp openstatesorg.pgdump "s3://openstates-backups/full-backup/$(date +%Y-%m-%d)-openstatesorg.pgdump" > /dev/null
rm -f openstatesorg.pgdump
# Disabled because we now rely on snapshots from RDS
#echo "Extracting full backup..."
#pg_dump -Fc openstatesorg > openstatesorg.pgdump
#echo "Shipping full backup to s3"
#aws s3 cp openstatesorg.pgdump "s3://openstates-backups/full-backup/$(date +%Y-%m-%d)-openstatesorg.pgdump" > /dev/null
#rm -f openstatesorg.pgdump

# layered approach for public
echo "Executing public schema-only backup..."
Expand All @@ -34,9 +35,11 @@ pg_dump -Fc openstatesorg --data-only \

echo "Uploading public backups to s3..."
aws s3 cp --acl public-read public.pgdump "s3://data.openstates.org/postgres/daily/$(date +%Y-%m-%d)-public.pgdump" > /dev/null
aws s3 cp --acl public-read public.pgdump "s3://data.openstates.org/postgres/monthly/$(date +%Y-%m)-public.pgdump" > /dev/null
# only upload monthly dump on the first of the month
[ "$(date +%d)" -eq 1 ] && aws s3 cp --acl public-read public.pgdump "s3://data.openstates.org/postgres/monthly/$(date +%Y-%m)-public.pgdump" > /dev/null
rm -f public.pgdump

# Currently disabled because it requires different credentials
#echo "Extracting geo backup..."
#pg_dump -Fc geo > openstates-geo.pgdump
#echo "Shipping full backup to s3"
Expand Down

0 comments on commit 70e4a85

Please sign in to comment.