skillbox/docs/heroku-backup.md

48 lines
986 B
Markdown

### List backups
```
heroku login
heroku pg:backups --app skillbox-prod
```
### Create a backup
`heroku pg:backups:capture --app <appname>`
The following command will provide a URL to where the backup can be downloaded (expires after 60 minutes)
`heroku pg:backups:url b001 --app <appname>`
To restore a backup, use
`heroku pg:backups:restore b001 DATABASE_URL --app <appname>`
To see the backup schedule
`heroku pg:backus:schedules --app <appname>`
To download a backup use
`heroku pg:backups:download --app <appname>`
### Load a backup locally
Be careful since you download user data as well. Therefore use preprod app by
default, it is anonimized. And more or less in sync with the prod app.
Downlaoad backup
`heroku pg:backups:download --app <appname>`
Load dump file into your db
To download a backup
`pg_restore --verbose --clean --no-acl --no-owner -h localhost -U skillbox -d skillbox latest.dump`
Add
python manage.py migrate
python manage.py dummy_users