  You're browsing the documentation for an old version of SupportPal. Consider upgrading to the [latest version](https://docs.supportpal.com/current/Backup+And+Restore+Generic). 

# Backup and Restore (Generic)

 **Docker Deployments**  
 If you're using a Docker deployment, please refer to [Backup and Restore (Docker)](Backup+and+Restore+Docker) instead. 

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 back up your entire instance, including:

- Database
- All files present in the installation path

  **Symbolic Links**  
 The target file/directory of symbolic links is not copied into the backup. It is important that target files are backed up separately. 

#### Output Directory

All backups are generated in the `storage/app/backups` directory.

 If you're using [AWS S3](Changing+File+Storage+Path#amazon-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. See [Additional Options](#BackupAdditionalOptions) to exclude the storage directory.

```
php app-manager/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: ```
php app-manager/artisan app:backup --mysqldump-binary-path="C:\laragon\bin\mysql\mysql-5.7.24-winx64\bin\mysqldump"
```

    `--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: ```
php app-manager/artisan app:backup --tar-binary-path="C:\Program Files\Git\bin\tar.exe"
```

    `--minimal`  By default, all files are included in the backup. The `--minimal` option will exclude the storage/ directory (which stores ticket attachments, avatars, images and more). It is intended to improve the speed of the backup and reduce the amount of space used. We strongly recommend taking a full backup from time to time so that storage/ data can be restored.    `--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 app-manager/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 that 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 back up that directory. This avoids errors when backing up files which are regularly changing - at the expense 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.

```
php app-manager/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: ```
php app-manager/artisan app:restore --mysql-binary-path=/bin/mysql
```

    `--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: ```
php app-manager/artisan app:restore --gzip-binary-path=/bin/gzip
```

    `--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: ```
php app-manager/artisan app:restore --tar-binary-path="C:\Program Files\Git\bin\tar.exe"
```

    `--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 app-manager/artisan help app:restore
```