Backup and Restore
SupportPal provides CLI commands for backing up and restoring installations.
Requirements
The following CLI applications must be installed on the server:
mysql
mysqldump
tar
gzip
They will be searched for via the PATH
environment variable. If you're using Docker you're all set,
other deployment methods may require the software to be installed.
The disable_functions
php.ini directive must not be set.
Backup
SupportPal provides a command line interface to backup your entire instance, including:
- Database
- All files present in the installation path
Output Directory
All backups are generated in the storage/app/backups
directory.
If you're using AWS S3 to store storage/app
files, the backup will be automatically written to your S3 bucket. Upload speeds may be slow.
Usage
By default the command will backup the database and all files except those in the storage/
directory. See
Additional Options to include the storage directory.
Docker
docker exec -it -u www-data supportpal bash -c "php artisan app:backup"
Linux
php artisan app:backup
Additional Options
The following parameters are available on the command.
Option | Description |
---|---|
--mysqldump-binary-path |
The command will try to automatically find mysqldump . If it returns an error,
you can manually specify the absolute path to mysqldump. For example:
|
--tar-binary-path |
The command will try to automatically find tar . If it returns an error,
you can manually specify the absolute path to tar. For example:
|
--full |
By default the command excludes the contents of the storage directory to improve the speed
of the backup and also the amount of space it uses. The --full option will backup all SupportPal
files - nothing will be excluded.
|
--verify |
All backups contain an integrity file named .supportpal , the file contains
hashes of all backed up files. When the --verify option is used we compare the file
hashes to verify the integrity of the backup.This option significantly increases the runtime and also size of the backup. |
--no-compress |
Do not compress the backup file using gunzip .
|
--force |
Run the command non-interactively. |
For further assistance, please refer to the help information which can be found by running:
php artisan help app:backup
Troubleshooting
Slow Runtime
All files in the SupportPal directory are backed up, including those which are not shipped in the SupportPal archive. If it takes a long time to generate a backup, please clean your SupportPal directory so it only contains files shipped by SupportPal.
The command will clone the filesystem to a temporary location and then use tar
and gzip
commands to backup that directory. This avoids errors when backing up files which are regularly changing - at the
expensive of 1X additional disk space and slower command speed. Unfortunately it is not possible to change the
backup strategy.
Restore
SupportPal provides a command line interface to restore your entire installation. Be sure to test the complete restore process at least once before attempting to perform it in a production environment.
Usage
If a backup path is not provided, the command will automatically search the backup output directory for the latest backup.
Docker
docker exec -it -u www-data supportpal bash -c "php artisan app:restore"
Linux
php artisan app:restore
Additional Options
Option | Description |
---|---|
--mysql-binary-path |
The command will try to automatically find mysql . If it returns an error,
you can manually specify the absolute path to mysql . For example:
|
--gzip-binary-path |
The command will try to automatically find gzip . If it returns an error,
you can manually specify the absolute path to gzip . For example:
|
--tar-binary-path |
The command will try to automatically find tar . If it returns an error,
you can manually specify the absolute path to tar. For example:
|
--no-verify |
All backups contain an integrity file named .supportpal , the file contains
hashes of all backed up files. By default the command verifies that all commands are correctly
restored. Use --no-verify to skip verification and improve the runtime speed.
|
--force |
Run the command non-interactively. |
For further assistance, please refer to the help information which can be found by running:
php artisan help app:restore