If your database is in a paid plan (i.e. it’s not “free plan”), Scalingo makes automated backups of your database on a daily basis. During your application lifetime, you might feel the need to restore your database at a previous state. We will guide you through the different steps to download a specific backups and restore the database with its content.
As an example we use a MongoDB database but these instructions do not differ a lot for different databases.
Download Automated Backups
Automated backups are listed in the database specific dashboard.
- Go to your app on Scalingo Dashboard
- Click on Addons tab
- Click Dashboard open_in_new which will take you to the MongoDB dashboard
- Click on Backups tab
- Download the backup you want
Restore the Backup
We now start a one-off container and upload the downloaded backup into it:
$ scalingo -a my-app run --file 20180727110302_my-app-3519.tar.gz bash
The file is uploaded to the
/tmp/uploads directory. Extract the content of the archive in
[one-off] $ tar xvfz /tmp/uploads/20190727110302_my-app-3519.tar.gz
Then restore the backup. In order to do that you first need to download your
database client (replace
mongo with your database type):
[one-off] $ dbclient-fetcher mongo [one-off] $ mongorestore -u <username> -p <password> -h <host>:<port> -d <db> ./my-app-3519