This guide will cover how to set up Backblaze as the provider for stateful container backups.
There are 3 main steps to setting up Backblaze for automated backups on Cycle:
- Backblaze asset creation.
- Cycle Hub level integration.
- Container level integration.
If you haven't set up a Backblaze account you can do so as part of this step in just a few moments. Backblaze Signup Page.
Creating A Backblaze Bucket & Application Key
- Create the bucket:
- Bucket option requirements:
- “Files in bucket”, must be private.
- “Object Lock”, must be disabled.
- Other options are up to the user, when satisfied create the bucket.
- Bucket option requirements:
- Create the key:
- Under “Account” click on “App Keys”.
- Scroll down under the master key to add a new “Application Key”.
- The key should be scoped to the bucket you just created.
Cycle Hub Level Integration
- Navigate to Cycle and log into the desired hub.
- Click settings on the left hand navigation - from there select “Integrations”.
- Paste the “Application Key” key, key ID, and the bucket name into the form fields under Backblaze.
- Save the changes using the “Update Integrations” button.
The container to be backed up must be a stateful container, if a container is not stateful the backup integration option in the container config will be disabled.
Cycle Container Level Integration
- Navigate to the container that is to have automatic backups enabled.
- Enter the container modal and click on Config > Integrations > Backups.
- Enter the source name
command- A command to run that results in the files being backed up.
timeout- A time in seconds to allow the backup script and transfer to take place.
cronstring- A string using the cron format, that describes how often the backup wiill run.
command- A command to run that will result in the files being restored to the appropriate place for the given container.
timeout- A time in seconds to allow the restore transfer and command to run.
- Use the "Save Config" button to save the integrations changes.
If you're new to cron and want to know how to format a cron string, this page has an interactive formatter.
Backup & Restore
command used to create the backups should write to
stdout. For example:
tar cf - -C /dir/change directory/to/backup uses the
- flag to signify the intention to write to
stdout. Another example is the popular command line tool
mysqldump which is packaged with most SQL database official images. Given the command:
mysqldump --all-databases -uuser -ppassword, mysqldump will write all the files to
Similar to creating backups, the
command used to restore a backup should read from
stdin. For example the counterpart to the mysqldump command would be:
mysql -uuser -ppassword < /dev/stdin
This pattern allows for maximum flexibility when crafting backup commands. Users should look to provided tools for the software they are running re:
mysqldump. This will provide the most reliable way to snapshot or restore files needed, while minimizing the chance of corruption as these tools were meant to be used to facilitate backups.
It is also perfectly valid to invoke a script via the command. The script needs to write to stdout &or read from stdin for the respective create & restore functions. If the script is not reachable by traversing the container's path make sure to include the absolute path to the script in the command.