Skip to content

Backup System

Included in ComputeStacks, is a powerful backup solution that allows for both automated and on-demand backups of your volumes.

Key Features

  • De-Duplication of stored data
  • Encrypted
  • Built-in MySQL agent for low-impact, point in time snapshots.
  • Control how often backups are taken, and how many copies to keep
  • 1-click restore

Configuring Backups

Backups are configured on a per-volume basis, and not per-container. It is primarily for this reason we recommend using a single volume with your container.

Backups Enabled

Enable or Disable backups

Data Type

The default is Files, which will just perform a file-level snapshot. Choosing another option will use a specific recipe for that data type.


Schedule

The cron syntax is a powerful way of defining how often a particular job should run. Using this, you can fully customize when your backup jobs are performed.

We also include some helpful shortcuts, which we recommend for most users:

@hourly
@daily (or @midnight)
@weekly
@monthly
@yearly (or @annually)
* * * * * *
| | | | | |
| | | | | +-- Year              (range: 1900-3000) (optional field)
| | | | +---- Day of the Week   (range: 0-6, 0 standing for Sunday)
| | | +------ Month of the Year (range: 1-12, 1 standing for Jan)
| | +-------- Day of the Month  (range: 1-31)
| +---------- Hour              (range: 0-23)
+------------ Minute            (range: 0-59)

Note: The maximum frequency is every 15 minutes for the file-based volumes, and hourly for everything else.

Scheduled backups may start a little after their cron time. To avoid every backup hitting the backup server in the same minute, each project's backups start at a fixed offset after the scheduled time, up to a quarter of the backup interval and at most 2 hours. All volumes of one project on the same schedule share the same offset, so their backups stay close together. If a backup of a volume is already waiting, the next scheduled slot for that volume is skipped rather than queued behind it.

Retention Settings

Each option corresponds to a backup slot that will be filled. However, if only 1 backup exists that meets multiple retention slots, then only 1 backup will be kept.

For example, if you have a Retention setting of 1 Hourly, and 1 Daily, and your Schedule is @hourly, then at the end of the day you will have 2 backups. 1 Hourly, and 1 Daily.

If, for example, had a Schedule of @daily, you would only have 1 backup.

Custom Hooks

Tell ComputeStacks to run scripts inside your container during certain points of the backup & restore process. You must ensure that your script exits with code 0, otherwise we will assume the script failed.

It's also important that you wrap your scripts in bash or sh.

/bin/bash /path/to/script
/bin/bash -c "whoami"

Only one backup, restore, or deletion runs on a volume at a time; others wait their turn. A restore requested while another restore of the same volume is running fails immediately.

If a backup or restore fails, its event reports the first step that failed, such as the hook that exited with a non-zero code, so you can see where it stopped.

If files or directories vanish while a backup is running, for example because your application deletes temporary files, the backup still succeeds as long as everything that was on the volume before the backup started is in the archive. The vanished paths are listed as a backup warning. If something else is missing from the archive, such as a directory renamed during the backup, the backup fails and names the first missing path.

Note

For all of our Data Types, we already configure snapshots before a restore is performed. This allows us to recover from a failed restore.

During Server Maintenance

While the server running your container is in maintenance or offline, taking a backup, restoring one, deleting a backup and downloading a backup are refused, with a message explaining that the server is in maintenance or offline, rather than failing with a generic error. Scheduled backups that fall inside the maintenance window are skipped. When maintenance ends, each volume that missed a scheduled backup gets one catch-up backup (on servers running cs-agent 3.5 or later), unless its next scheduled backup is due within 2 hours anyway; after that the schedule continues as normal. See Server maintenance and outages.