-
Notifications
You must be signed in to change notification settings - Fork 1
Database Backups
In the event that the site's data is lost, vandalized, or otherwise out of wack, don't panic: there are backups.
- 7 days of nightly backups are always available,
- 2 manual backups may be captured at any time.
🛈 These exist in addition to the data exports always available through the admin dashboard. These backups will not be human-readable, but will rather restore the website to its exact state when captured.
To interact with the backup system, you need:
- Heroku owner account credentials
- The Heroku command line console
Step 1: Install the Heroku command line console by following the instructions here.
Step 2: Open a console on your computer, e.g. Command Prompt on Windows (Win+R > "cmd" > Enter).
Step 3: Type heroku login and follow the instructions on-screen to log in with the Heroku admin account.
Step 4: Return to the console window.
If the console shows Logged in as <the Heroku owner account email>, you are ready to proceed to either of the following sections.
Type heroku pg:backups --app anspoints-staging to view all available backups, and the status of backup restorations.
Type heroku pg:backups:capture --app anspoints-staging to add a manual backup for the current state of the app.
🛈 If you already have 2 of these, the oldest will be deleted to make room for the new backup.
After finding a suitable backup from heroku pg:backups --app anspoints-staging (i.e. "View backups" above), type heroku pg:backups:restore bXXX --app anspoints-staging to revert the state of the app to that backup, where XXX is a backup number from the list of available backups.
For instance, if you wanted to restore the backup from 3 days ago, you would type:
heroku pg:backups --app anspoints-stagingThen see something like this.
Once you find the one whose date corresponds to the time you want (let's say it's b140), you would type:
heroku pg:backups:restore b140 --app anspoints-stagingThereafter you will be able to view the status of the restore operation under the Restore tab of the backups list.
You may also download backups of the database to your local machine to be stored as long as you wish, remove specific backup states, and a few other niche operations. A full guide is presented by Heroku here.
Please also use the above link for more detailed and up-to-date instructions on any of the above operations. This page exists as a short summary of the content contained therein.