Introduction
Configuration
In order to configure the Remote Backup plugin for Craft, you need to first set up the remote cloud destination of your choice, then configure the plugin.
Overview
There are two steps to configuring Remote Backup:
- Setting up your cloud destination.
- Configuring the plugin itself.
Configuration is handled in the Control Panel settings page for Remote Backup:
Cloud Destination Configuration
Craft Remote Backup supports a number of remote cloud destinations. Each destination provider requires slightly different setup & configuration.
You can select your provider via the dropdown menu in the Remote Backup settings page:
To see the details on how to configure your provider, see the following pages:
- Amazon S3
- Backblaze B2
- Google Drive
- Digital Ocean Spaces
Dropboxβ Not currently working due to API changes.
Once you have set up your destination, you'll generally need to return to the plugin settings page and add the credentials required to connect to the cloud location:
π Connection Testing
When setting up your remote destination, you can test the connection right from the settings page making it easy to troubleshoot issues. Use the "Test Connection" button below your provider settings to try it out.
Bear in mind that if you change the configuration, you need to save and reload the page before testing the connetion again.
Plugin Configuration
Once you have configured your particular cloud destination, there are a number of other settings you can configure:
Queue
You can optionally use Craft's built-in queue to create new backups. This is useful when your backups are large and you don't want to have to wait on the Control Panel interface every time you backup. Instead, the backups will be pushed to the queue and completed in the background.
You can enable this via the "Use Queue" light-switch in the settings or via the useQueue
setting in your config.
β οΈ CLI commands and the queue
The CLI commands ignore the queue setting. In other words, they will always run synchronously. This is by design as it's likely you will want to see the results of these operations if they are part of your crontab or deployment script.
Local Copies
You can choose to keep local copies of database and volume backups that are created on the server before being pushed to your remote provider. By default Remote Backup will delete these local copies after they have been pushed.
If you'd prefer to keep them, enable the "Keep Local" light-switch on the settings page or via the keepLocal
setting in your config.
Deleting/Pruning Old Backups
Remote Backup supports automatically pruning/deleting of old backups. To enable this feature toggle the "Prune Backup" setting or use the prune
setting in your config.
When you toggle this setting you will see a number of inputs for controlling the number of backups to be retained for a number of backup periods: hourly, daily, weekly, monthly, yearly. By default Remote Backup will keep:
- The 6 most recent hourly backups
- The 14 most recent daily backups
- The earliest backups of the 4 most recent weeks
- The earliest backups of the 6 most recent months
- The earliest backups of the 3 most recent years
Bear in mind that depending on how many backups you have, some of these might overlay. For example, a backup that is retained as part of the 4 most recent weekly backups might also be one of the 6 most recent monthly backups too.
When enabled, backups will be pruned whenever a new backup is created via the Control Panel. You can also prune database or volume backups independently on the command line:
./craft remote-backup/database/prune
./craft remote-backup/volume/prune
Bear in mind these commands will respect the settings. In other words, you won't be able to prune backups via the command line if the setting in the control panel is disabled.
Also note that the ./craft remote-backup/[database|volume]/create
command does not automatically run the prune
command (unlike the control panel).
Pruning involves automatically deleting old, out-of-date backups according to a schedule/configuration.
Multi-Environment Configuration
If you want to configure the plugin on a per-environment basis, you can copy the config/remote-backup.example.php
to your project's config/remote-backup.php
file. These settings will override the Control Panel settings.
<?php
return [
'*' => [
'cloudProvider' => 's3',
//...
'useQueue' => false,
'keepLocal' => false,
'prune' => true,
'pruneHourlyCount' => 6,
'pruneDailyCount' => 14,
'pruneWeeklyCount' => 4,
'pruneMonthlyCount' => 6,
'pruneYearlyCount' => 3,
],
'dev' => [],
'staging' => [],
'production' => [],
];