# Recovering without Brewless

Restore a database, a bucket or the configuration from your backups with the Recovery Kit and your recovery key, with brewless-backup or plain restic.


Your backups do not depend on Brewless. Every destination is a standard [restic](https://restic.net) repository in a bucket of your own, and the open-source tool that made it can read it back without asking Brewless anything. This page is for the day Brewless is not there: you left, your access is gone, or you simply want to know it works.

[Restoring from backups](/running/restoring-backups) is the everyday way, from the console. Use that when you can.

## What you need

1. **The Recovery Kit**: `RECOVERY.md` and `recovery.json`. They are at the root of every destination, next to the repository, and the runner rewrites them after every successful backup. Download them from the environment's Backups tab, or with `brewless backup:kit <environment>`, while you still can.
2. **Your recovery key**, which you stored when you [made it](/backups/getting-started#the-recovery-key). The runner key in your Secret Manager works too, as long as you still have your Scaleway account.
3. **An access key that can read the bucket** of the destination.

Neither file of the kit holds a key or a password. `recovery.json` says where every repository is, which recovery points there were, which databases and buckets are in them with their versions and extensions, and what is not in the backup. `RECOVERY.md` is the same in plain language, with the commands for that environment filled in.

## Get the tool

Download `brewless-backup` for Linux or macOS (amd64 or arm64) from the [releases of brewless/backup](https://github.com/brewless/backup/releases), with `SHA256SUMS` and `SHA256SUMS.sigstore.json`. Check that the files are the ones the release built, with [cosign](https://docs.sigstore.dev):

```bash
cosign verify-blob SHA256SUMS --bundle SHA256SUMS.sigstore.json \
  --certificate-identity-regexp '^https://github.com/brewless/backup/.github/workflows/release.yml@refs/tags/v' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com
sha256sum --check --ignore-missing SHA256SUMS
```

The tool calls `restic`, and for buckets `rclone`, so have those installed, and `psql` to load a PostgreSQL database.

## A worked example

Production of `shop` was backed up from Paris to Amsterdam. Paris is down and you want the database and the uploads back somewhere else.

Start in a folder with `recovery.json`, and give the tool the keys. It asks for any you leave out, without echoing them:

```bash
export AWS_ACCESS_KEY_ID=<key that can read the backup bucket>
export AWS_SECRET_ACCESS_KEY=<its secret>
export RESTIC_PASSWORD_FILE=./recovery-key.txt
```

List the recovery points:

```bash
brewless-backup recover --kit recovery.json snapshots
```

Load the newest backup of the database into a new, empty PostgreSQL database. The tool creates the extensions the backup used first:

```bash
brewless-backup recover --kit recovery.json database shop-production \
  --psql "postgresql://shop@new-host:5432/shop"
```

Or write it to a file, from an older recovery point:

```bash
brewless-backup recover --kit recovery.json database shop-production --point run:<run id> --output shop.sql
```

Put the bucket back into a new bucket, with each object's content type and metadata from the backup's manifest. `TO_AWS_ACCESS_KEY_ID` and `TO_AWS_SECRET_ACCESS_KEY` are the key of the new bucket, when it is another one than the backup's:

```bash
brewless-backup recover --kit recovery.json bucket shop-production-files \
  --to s3://shop-files-restored/ --to-endpoint https://s3.nl-ams.scw.cloud --to-region nl-ams
```

Take the configuration: `brewless.yml`, the git commit and image of the release, and the DNS and CDN records, plus the variables when the backup [included them](/backups/encryption-and-keys#your-variables):

```bash
brewless-backup recover --kit recovery.json config --target-dir ./config
```

Then deploy the application from that commit with those settings. `--destination <id>` picks another destination of the kit than the primary, for example a copy at another provider. `check` reads 5% of the repository to see that it is whole.

## With plain restic

The tool is a convenience. With restic and rclone alone:

```bash
export AWS_ACCESS_KEY_ID=… AWS_SECRET_ACCESS_KEY=…
export RESTIC_REPOSITORY=s3:https://s3.nl-ams.scw.cloud/<bucket>/repo
export RESTIC_PASSWORD_FILE=./recovery-key.txt
restic snapshots

# a database: the SQL and its meta file (extensions, roles)
restic dump latest /db/shop-production.sql --tag part:data > shop.sql
restic dump latest /db/shop-production.meta.json --tag part:meta > shop.meta.json
createdb shop
psql --set ON_ERROR_STOP=1 -d shop -f shop.sql

# a bucket: the objects as files, then copy them anywhere with rclone
restic restore latest --tag kind:bucket --include /buckets/shop-production-files --exclude-xattr '*' --target ./restore

# the configuration
restic restore latest --tag kind:config --exclude-xattr '*' --target ./config
```

`RECOVERY.md` in your kit has these commands with the bucket, region and names of your environment filled in, and what to do with a dump of a newer PostgreSQL than the server you load it into.

## A recovery point is a run

One backup run makes several restic snapshots, one or two per database and bucket and one for the configuration, all tagged `run:<run id>`. `brewless-backup recover` keeps them together; with plain restic, filter on the tags `run:`, `kind:` (`database`, `bucket`, `config`) and `part:` (`data`, `meta`).

## On a bucket with Object Lock

What was deleted from a locked bucket stays as an older version until its lock ends. To read the repository as it was at a moment, for example before someone deleted backups with a stolen key, serve it through rclone at that time and point restic at it:

```bash
rclone serve restic --s3-version-at "2026-12-01 03:00:00" <remote>:<bucket>/repo
```

## Try it before you need it

Download the kit, take the recovery key from where you stored it, and restore the database into a scratch database once. A recovery you never tried is a guess.
