# Off-Site Backups

> Off-site backups keep an encrypted restic copy of your site in your own S3-compatible or Google Cloud Storage bucket, restorable into staging or without us.

Source: https://docs.wpwaterfall.com/off-site-backups

Off-site backups put an encrypted copy of your site in a bucket you own. Each copy is a [restic](https://restic.net) snapshot of the site's code, uploads, and a database dump, and only new data uploads after the first one. You keep the bucket and the repository password, so you can restore without WP Waterfall. The add-on costs $2 a backup plus $1 per GB uploaded, billed as each backup runs. Nothing is charged when you turn it on. Your storage provider bills the bucket separately.

## How do I connect a bucket?

1. Open a site, then **Add-ons**, and select **Enable** on the External backups card. Confirm the purchase. Nothing is charged yet.
2. WP Waterfall takes you to **Backups** and opens the connect dialog. If you closed it, select **Connect a bucket** in **Off-Site Backups**.
3. Pick your storage service. Choose Amazon S3, Backblaze B2, Cloudflare R2, Wasabi, DigitalOcean Spaces, Google Cloud Storage, or Other S3-compatible. The dialog asks only for what that service needs.
4. Fill in the fields, then select **Connect and test**. If you have not entered your password in the last 10 minutes, WP Waterfall asks for it first. WP Waterfall stores the key encrypted, tests the bucket, and creates the repository.
5. Copy the repository password and save it in your password manager. WP Waterfall shows it only once.

The Owners of the account get an email when a bucket is connected, and again when it is replaced by another bucket, with the name of the person who did it.

Removing the last bucket turns External backups off. Turn it on again from **Add-ons** to connect another.

The **Folder** field is the folder in the bucket for this site's repository. It starts as `wpwaterfall/<site slug>`. Use one folder per site.

If you already have a restic repository in that folder, tick **I already have a repository in this folder** and enter its password. WP Waterfall then uses that repository and does not show a new password.

### Amazon S3, Backblaze B2, Wasabi, and DigitalOcean Spaces

Enter the region, the bucket, an access key ID, and a secret access key. WP Waterfall builds the endpoint from the region, so you do not type a URL:

- Amazon S3: a region such as `us-east-1`.
- Backblaze B2: the region in your bucket's S3 endpoint, such as `us-west-004`. Make an application key that can read and write the bucket. The keyID is the access key ID, and the applicationKey is the secret access key.
- Wasabi: a region such as `us-east-1`.
- DigitalOcean Spaces: a region such as `nyc3`.

### Cloudflare R2 and other S3-compatible storage

Enter the endpoint, the bucket, an access key ID, and a secret access key. The endpoint must be an `https` address on the public internet. For R2 it is `https://<account id>.r2.cloudflarestorage.com`. Other S3-compatible services, such as MinIO, Ceph, Linode, and Scaleway, work the same way with their own endpoint.

Make a key that can read, write, list, and delete in this bucket only. WP Waterfall needs delete to apply the retention rules.

### Google Cloud Storage

1. In the Google Cloud console, create a service account.
2. Give it the **Storage Object Admin** role on the bucket.
3. Create a JSON key for the service account.
4. Paste the key into **Service account key (JSON)**, or pick the file.

## When do backups run?

About one hour after the daily backup of live. Turn **Back up every day** off to pause the daily run. To run one now, select **Back up to my bucket**, which backs up the environment you have open, and follow it in the jobs drawer. **Test connection** checks that WP Waterfall can still reach the bucket. If a test or run fails, the card shows the error.

## How long are snapshots kept?

After each run, WP Waterfall removes old snapshots with restic's `forget` and `prune`. The defaults keep:

- 14 daily snapshots.
- 4 weekly snapshots.
- 0 extra latest snapshots.

Change the numbers under **Retention and schedule** and select **Save retention**. Set a rule to 0 to turn it off. At least one rule must keep something.

## Where do I see my snapshots?

The snapshot list shows the bucket's contents, newest first, as of the last read. Select **Refresh list** to read it again.

## How do I restore a snapshot?

1. Select **Restore** on a snapshot.
2. Pick the target: a staging or preview environment of this site. Live is never a target.
3. Pick what to restore: the database, the uploads, the code, or more than one.
4. Type the name of the target environment and select **Restore**.

Code restores only into an environment in SFTP mode, because code in Git mode is a read-only release. New staging environments start in Git mode, so switch staging to SFTP mode first. Restore into staging, check the result, commit it, then push it to live.

## How do I restore without WP Waterfall?

With the bucket and the repository password, you can restore with restic on any computer. For S3-compatible storage:

```bash
export AWS_ACCESS_KEY_ID=<access key id>
export AWS_SECRET_ACCESS_KEY=<secret access key>
export RESTIC_PASSWORD=<repository password>
restic -r s3:https://s3.us-east-1.amazonaws.com/<bucket>/wpwaterfall/<site slug> snapshots
restic -r s3:https://s3.us-east-1.amazonaws.com/<bucket>/wpwaterfall/<site slug> restore latest --target ./restore
```

For Google Cloud Storage, set `GOOGLE_APPLICATION_CREDENTIALS` to the key file and use `-r gs:<bucket>:/wpwaterfall/<site slug>`.

The restored folder holds the site's files and a database dump that you can import with `mysql`.

## How do I remove the connection?

Select **Remove**, then **Remove connection**. WP Waterfall stops the backups, deletes the key it stored, and ends the add-on when the last bucket goes. The snapshots stay in your bucket.

## Who can do what?

- Connect, replace, and remove a bucket: Owners, Admins, and Developers. Each asks for your password if you have not entered it in the last 10 minutes. A Site Admin or Site Developer cannot, because the bucket gets every copy of the database.
- Run a backup, test, refresh the list, and restore: people with database access.
- Change the retention and pause the daily run: people who can update environments.
- See the card: everyone who can see the site.

## API

- `GET /v1/sites/{id}/offsite-backup`
- `PUT /v1/sites/{id}/offsite-backup` (connect; send `confirm: true`)
- `PATCH /v1/sites/{id}/offsite-backup` (retention and pause)
- `DELETE /v1/sites/{id}/offsite-backup?confirm=true`
- `POST /v1/sites/{id}/offsite-backup/test`
- `POST /v1/sites/{id}/offsite-backup/snapshots/refresh`
- `POST /v1/sites/{id}/offsite-backup/restore`
- `POST /v1/environments/{id}/offsite-backup/run`

## MCP

The MCP server offers `get_offsite_backup`, `run_offsite_backup`, `restore_offsite_backup`, and `disconnect_offsite_backup`. Connecting works only in the dashboard or the API, because bucket keys must never go into a chat.

## Related

- [Backups](https://docs.wpwaterfall.com/backups)
- [Staging and preview environments](https://docs.wpwaterfall.com/environments)
- [Add-ons](https://docs.wpwaterfall.com/add-ons)
