Disaster recovery
This page is about restoring the data of a project: its database and files. The admins look after the recovery of the hosting itself.
What is backed up
What | When | Kept for |
|---|---|---|
Full dump of the production database | 3 times a day by default (backup.hours in hosty.yaml) | 365 days by default. Projects can't delete them. |
Partial dump, without the data of the tables in excludeTablesFromImportOnDevEnvs | With the full dump, unless backup.partial: false | The same. |
Files of the persistent storages of production | With the dumps | Only the latest copy: a file deleted on the site disappears from the backup on the next run. |
Development environments have no backups: they are created from the backups of production.
Beyond that, the admins can:
- restore the database server to any moment of the last 7 days, from the automatic backups of Aurora;
- bring back a backup that was overwritten or deleted in the last 14 days, as the storage of backups keeps the previous versions of files that long. This also covers files removed from the files backup.
Ask them as soon as you can if you need either: both expire.
Who can do what
| Developer | Lead developer | Release manager |
|---|---|---|---|
List and download partial database backups | Yes | Yes | No |
List and download full database backups | No | Yes | No |
Upload database backups | No | Yes | No |
Download files backups | Yes | Yes | No |
Upload files backups | No | Yes | No |
Run a backup of production now (backup:create) | No | Yes | Yes |
Copy files and run commands on production | No | Yes | Yes |
The commands that read or write backups need two-factor authentication: Hosty CLI asks for a code from your authenticator app, or run hosty auth first. See Roles and permissions for the rest.
Before you restore anything
Back up production as it is now, so that you can go back if the restore goes wrong:
hosty backup:createWith several applications, add --application <name> to this and the other commands.
Restore a development environment
Delete the environment and deploy it again. A new environment imports the latest partial dump and the files of production:
hosty delete <environment>Then deploy it, usually by running its CI job again.
Restore the production database
These steps restore a MySQL database in place. On PostgreSQL, ask the admins.
- Find the backup you need. Names start with the time of the backup in UTC:
hosty backup:database:list --full- Download it. The path is relative to the root of the project. Without --name, you get the latest backup:
hosty backup:database:download --full --name=2026-11-08T08:21:00Z-full.sql.zst backup.sql.zst- Decompress it. Backups are compressed with zstd; older ones may be .sql.gz, which you decompress with gunzip:
zstd -d backup.sql.zst- Copy the dump into a private persistent storage of production, i.e. private. Never use a public one, such as the files of Drupal, from where anyone could download the dump:
hosty cp production backup.sql hosty://private/backup.sql- Import it. hosty run runs the command in a pod of its own, which goes on if your connection drops:
hosty run production --timeout=7200 -- sh -c 'mysql --host="$DB_HOST" --user="$DB_USER" --password="$DB_PASSWORD" "$DB_NAME" < private/backup.sql'On Drupal, sh -c 'drush sql:cli < private/backup.sql' does the same.
- Delete the dump from the storage, and from your computer:
hosty exec production --command "rm private/backup.sql"- Clear the caches of your application, i.e. with drush cache:rebuild.
The dump drops and creates again each table it has. Tables created after the backup, i.e. by a new module, stay in the database.
Restore files
- Download the files backup of a storage into a folder of the project. The command makes the folder the same as the backup, so it asks before it deletes local files that the backup doesn't have:
hosty backup:files:download public restore/public- Copy the files you need back to production, into the path of the storage:
hosty cp production restore/public/images/logo.png hosty://web/sites/default/files/images/logo.pngThe files backup holds only the latest copy. If a file was deleted on the site before the last backup, ask the admins to bring back its previous version from the last 14 days.
Recreate production from a backup
If production is gone, i.e. deleted by the admins, its next deployment creates it again from the latest full dump and the files backup. Deleting production makes a final backup, so to use an older dump, upload it after the deletion and before the deployment, so that it becomes the latest:
hosty backup:database:upload --full backup.sql.zstThe upload takes .sql, .sql.gz, .gz, .gzip, .sql.zst and .zst files. Upload a partial dump the same way with --partial, to change what new development environments get.
To replace the files backup, upload a folder:
hosty backup:files:upload public restore/public/The upload makes the files backup of production the same as the folder: files of the backup that the folder doesn't have are deleted. Hosty CLI shows how many files it would upload and delete, and asks before it changes anything.