Backup files
Published
Updated
📦
Files and dumps, packed and ready.
A fortrabbit backup is a downloadable archive with the files of the environment and, with MySQL booked, a database dump. Caches, logs, archives and Git folders are left out. Use it to restore single files, the database, or a local copy.
The backup component creates archives of an environment, and its plan sets how many are kept. An archive holds:
- Files: the file system of the environment, without the excludes
- Database: a dump, when the MySQL component is booked
Download
Download a backup in the dashboard, or with the frbit CLI:
# List the backups of the environment, with their IDs
$ frbit backups list {{app-env-id}}
# Download the files, then the database dump
$ frbit backups download <backup-id>
$ frbit backups download <backup-id> --type database
Use cases
- Get back a single deleted file
- Restore the database without the files
- Keep copies offsite for longer
- Set up a local development environment for a new developer
- Check a backup before restoring it
Backups VS git deployment
With Git deployment, the repository holds the history of the code. A backup adds what Git does not have: the vendor folder, uploads and other runtime data.
Backup file sizes
The size of a backup differs from the storage and MySQL usage of the environment: backups are compressed, and the excludes are left out.
The size in the dashboard also differs from the downloaded file. The dashboard counts in binary units (MiB), most operating systems in decimal units (MB), and file systems use different block sizes.
Excludes
Caches, logs, archives and Git folders are left out of every backup:
# Craft
'storage/backups/',
'storage/logs/',
'storage/runtime/',
'web/cpresources/',
# Laravel
'storage/framework/',
'storage/logs/',
# Symfony
'var/cache/',
'var/log/',
# WordPress
'wp-content/cache/',
# Archives
'*.zip',
'*.tar',
'*.tar.gz',
'*.tgz',
'*.tar.bz2',
'*.tbz',
# Misc
'.git/',
'*.sql',
Restore from backup files
Besides the restore in the dashboard, parts of a backup can be restored by hand.
Restore files
Unpack the archive locally, then upload the files with SFTP or rsync. Include hidden files such as .htaccess, and remove files from the environment that the backup does not have.
Restore database
The database file is a standard mysqldump dump. Import it like any other, see database export and import. Drop tables that the backup does not contain first.