Skip to content

Restoring Database

David Heyman edited this page Sep 18, 2015 · 5 revisions

The Postgres database is automatically backed up every night. The backups are automatically uploaded to S3 (and later moved to Glacier archival storage).

To restore the database, locate the URL of the backup on S3. It will look something like imagine-rio/backup/<backup date>.gz

Download the file with:

sudo aws s3 cp s3://imagine-rio/backup/1413871201000.gz backup.gz

The backup file automatically creates the rio database so it must be deleted first. Delete the rio database using:

pm2 stop all
dropdb rio

Now restore the database from the backup with:

gunzip -c backup.gz | psql
Clone this wiki locally