...
These are stored in S3, and are backed up within S3 by a process managed by AWS. The backups are then copied to long-term storage by SyncBackPro, which is Windows software running on Promethium managed by Chuck and Ponce (see https://www.2brightsparks.com/syncback/sbpro.html ). (None of this will change when we get rid of Ansible.)
See more at S3 Digital CollecS3 Bucket Setup and Architecture and Backups and Recovery (Historical notes) https://sciencehistory.atlassian.net/wiki/pages/createpage.action?spaceKey=HDCSD&title=Backups%20and%20Recovery%20%28Historical%20notes%29
Heroku database backups
We have three backup/restore mechanisms under Heroku:
...
To verify that we have scheduled backups, run
heroku pg:backups:schedules --app scihist-digicoll-production
, to see that we have a 2AM backup ever night.List what backups exist by running
heroku pg:backups -a scihist-digicoll-production
Note the first section is “backups” (which may scroll off screen), and the first column is a backup ID, such asa189
.With the backup ID, you can restore production to a past backup (eg id
a189
), withheroku pg:backups:restore a189 -a scihist-digicoll-production
Warning: this will overwrite current production data, with the restored backup!
Warning: see note below re:
--extensions
.
Maybe instead you want to restore a production backup to staging, to just look at the data, without actually (yet?) restoring to and overwriting current production? You can do this too:
heroku pg:backups:restore scihist-digicoll-production:a189 -a scihist-digicoll-staging
💡 Warning: the above command will fail if the database you are restoring from has extensions installed in the
public
schema, subsequent to some changes in how Heroku works with extensions). There is a workaround: using theextensions
flag as in the example below allows you topg:restore
from a database that has extensions inpublic
(like the current production DB, as of Sept 2022)
Code Block |
---|
heroku pg:backups:restore scihist-digicoll-production::a661 DATABASE_URL \
--extensions 'public.pg_stat_statements,public.pgcrypto' \
--app scihist-digicoll-staging |
💡To find out what extensions are installed and in what schemas, just execute
\dx
at the psql prompt.
For our standard-0
heroku postgres plan, heroku will keep 7 daily backups, and four weeks of one-per-week backups.
...