There are different Cloud Container Images you can use so the backup restore procedure may be different depending on the image used, and if your Cloud Container server is managed, we even provide a one click backup restore feature for web, application, and service images.
The /container/backups/
directory is the "base path" for the backups and you should find subdirectories for various dates. The subdirectory names indicate at what day/time the backup was taken so let's call these subdirectories snapshots. There's also a symbolic link named latest
that points to the latest backup taken.
When browsing a snapshot directory you may notice the file structure is very similar to the Container's file structure.
In this article, we explain the procedures we would suggest you follow if you need to restore your Container files or Database from a backup. It's a good idea to back up your Container before applying significant changes. You can read more about Backing up a Container.
This feature is only available on managed Cloud Container servers.
Once you have initiated the restore we will first take a new backup of the container as is so that you can safely roll back if something goes wrong.
Assuming you wish to restore from the latest copy taken, follow the steps below:
cd /container/backups/latest/databases/
ls
gunzip < FILENAME.sql.gz | mysql -h MYSQL_HOSTNAME -u USERNAME -p DATABASE
We would suggest reading the MySQL Databases section in case you are not sure what command parameters to use.
You can use rsync to restore a website snapshot, follow the steps below:
cd /container/backups/
ls
ls /container/backups/latest/application/
rsync --archive --stats --delete /container/backups/latest/application/ /container/application/
You can use the backup files as a reference and restore individual files as needed. It's easy to restore all configuration files though. This is what we are going to do next:
cd /container/backups/
ls
ls /container/backups/latest/config/
rsync --archive --stats --delete /container/backups/latest/config/ /container/config/
PostgreSQL Containers backup happen in two different stages. The first stage is a cron job dumping the databases to a /container/application/backup/
directory. The second stage is when these files are copied over to the secure offsite location.
If you wish to restore the latest backup taken, follow the steps:
cd /container/backups/latest/application/backup/
ls
gunzip < FILENAME.dump.gz | psql -h PGSQL_HOSTNAME -U USERNAME DATABASE
We would suggest reading the Connecting to a Container article if you want to learn more about the parameters used and default passwords.
MongoDB Container backups happen in two different stages. The first stage is a cron job dumping the databases to a /container/application/backup/
directory. The second stage is when these files are copied over to the secure offsite location.
If you wish to restore the latest backup taken, follow the steps:
cd /container/backups/latest/application/backup/
ls
mongo --host MONGO_HOSTNAME
use DATABASE
db.dropDatabase()
exit
mongorestore --host MONGO_HOSTNAME --nsInclude DATABASE.* /container/application/backup/