Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2023.10.06 #446

Merged
merged 20 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading