Skip to content

Commit

Permalink
Merge pull request #446 from openstates/develop
Browse files Browse the repository at this point in the history
2023.10.06
  • Loading branch information
NewAgeAirbender authored Oct 6, 2023
2 parents c6b2536 + 96009f5 commit d3c61d0
Show file tree
Hide file tree
Showing 7 changed files with 208 additions and 611 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ jobs:
- 5432:5432
steps:
- name: check out code
uses: actions/checkout@v2
uses: actions/checkout@v3
# Python dependencies
- name: setup Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: install Poetry
uses: snok/install-poetry@v1
- name: cache Poetry virtualenv
uses: actions/cache@v2
uses: actions/cache@v3
id: poetry-cache
with:
path: ~/.virtualenvs/
Expand All @@ -60,7 +60,7 @@ jobs:
with:
node-version: '12'
- name: cache node_modules
uses: actions/cache@v2
uses: actions/cache@v3
id: node-cache
with:
path: ./node_modules
Expand Down
24 changes: 17 additions & 7 deletions docker/cron/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ 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..."
pg_dump -Fc openstatesorg --schema-only > schema.pgdump
aws s3 cp --acl public-read schema.pgdump "s3://data.openstates.org/postgres/schema/$(date +%Y-%m)-schema.pgdump" > /dev/null
rm -f schema.pgdump

echo "Executing public data backup..."
pg_dump -Fc openstatesorg --data-only \
Expand All @@ -34,4 +35,13 @@ 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"
#aws s3 cp openstates-geo.pgdump "s3://openstates-backups/full-backup/$(date +%Y-%m-%d)-openstates-geo.pgdump" > /dev/null
#rm -f openstates-geo.pgdump
Loading

0 comments on commit d3c61d0

Please sign in to comment.