Backups
On this page
Back up a server's MySQL and PostgreSQL databases to your own S3-compatible bucket: Cloudflare R2, AWS S3, Backblaze B2, Hetzner Object Storage, DigitalOcean Spaces, Vultr, UpCloud or any other S3 service. The server runs the backups itself on a timer, so they keep happening even when the panel is unreachable.
Connect a bucket
Storage belongs to the workspace, so every server in it can use the same bucket.
- In your storage provider, create a bucket and an access key that can read, write and delete in it. Limit the key to that bucket: each server keeps a copy of it so it can upload on its own.
- Open the server's Backups tab and choose Turn on backups, or open the workspace's Cloud providers page and choose Connect under Backup storage.
- Enter the Endpoint, Bucket, Region and the key. The endpoint is your provider's S3 address:
| Provider | Endpoint | Region |
|---|---|---|
| Cloudflare R2 | https://<account-id>.r2.cloudflarestorage.com | auto |
| AWS S3 | https://s3.<region>.amazonaws.com | the bucket's region, such as eu-central-1 |
| Backblaze B2 | https://s3.<region>.backblazeb2.com | such as eu-central-003 |
| Hetzner Object Storage | https://<location>.your-objectstorage.com | such as fsn1 |
| DigitalOcean Spaces | https://<region>.digitaloceanspaces.com | such as ams3 |
An optional Folder keeps the backups under a path in the bucket. Before it saves anything, Crabsmith writes and deletes a small test file. If the provider refuses, the form shows the provider's own reason. The secret key is stored encrypted and never shown again.
Turn on backups
- Choose the storage.
- Choose Every database (including databases you add later) or pick specific ones.
- Choose Daily at a time, or Hourly at a number of minutes past the hour. Times use the server's own clock.
- Set how many Copies to keep for each database (7 by default, at most 90).
Saving runs an operation. It installs rclone from Ubuntu's archive if it isn't there yet, checks from the server itself that it can write to the bucket, and sets up the timer. Nothing else is installed on the server.
Each backup is streamed straight to the bucket, so it never takes up space on the server's disk. A backup is saved as <folder>/<server>-<id>/<engine>/<database>/<time>.sql.gz for MySQL, or .dump for PostgreSQL (the pg_dump custom format). After each successful backup, copies older than the newest ones you chose to keep are deleted from the bucket.
Back up now, download and restore
- Back up now backs up every database on the plan right away. If a scheduled backup is already running, it waits for that one to finish first.
- In the bucket lists the backups, newest first. Download gives you a link to the file that works for 15 minutes.
- Restore writes a backup into a new database by default (
<name>_restored). Your app keeps using the original until you point it at the new one. You can instead restore over the original database after typing its name to confirm. Tables in the backup replace the current ones; tables the backup doesn't contain are left as they are. - Last runs shows what the server reports for each database: backed up (with its size), skipped, or failed (with the reason).
Turn off backups stops the timer and removes the storage key from the server. The backups already in the bucket stay there. rclone stays installed.
Through the API
curl -X POST "$CRAB_URL/api/v1/workspaces/$WORKSPACE/backup-storages" \
-H "Authorization: Bearer $CRAB_TOKEN" -H "Content-Type: application/json" \
-d '{"name":"R2","endpoint":"https://<account-id>.r2.cloudflarestorage.com","bucket":"backups","access_key":"…","secret_key":"…"}'
curl -X PUT "$CRAB_URL/api/v1/servers/$SERVER/backups" \
-H "Authorization: Bearer $CRAB_TOKEN" -H "Content-Type: application/json" \
-d '{"storage_id":1,"frequency":"daily","at":"03:00","keep":7}'
curl -X POST "$CRAB_URL/api/v1/servers/$SERVER/backups/run" -H "Authorization: Bearer $CRAB_TOKEN"See API for tokens. GET /servers/{id}/backups/files lists the backups in the bucket, and POST /servers/{id}/backups/restore takes a backup's key together with either a database_id or a new_name.
When it fails
- The storage does not accept that access key and secret: copy the key again; some providers only show the secret once. On R2, use an S3 API token, not a Cloudflare API token.
- The key is not allowed to write, list or delete: give the key read, write and delete access to the bucket (and to the folder, if your provider supports path rules).
- The region does not match the bucket's: use
autofor R2, or the bucket's own region elsewhere. - Saving works in the panel but fails on the server: the server can't reach the endpoint. Check that outgoing HTTPS isn't blocked by your provider's firewall.
- A database failed in Last runs: the reason shown is the one MySQL, PostgreSQL or rclone gave. If the engine is stopped, start it from Services and choose Back up now.