Brewless Brewless Docs

Backups

Restore tests

Once a month Brewless restores your newest backup into temporary databases in your own account, checks it, and removes them again.

On this page

A backup is only as good as its last restore. A restore test takes the newest successful backup of an environment that saved something, loads every PostgreSQL database of it into a temporary database in your own Scaleway account, checks what arrived, reads a sample of every bucket back, and removes the temporary databases again. The test runs as a job in your account, like the backups themselves: no data passes through Brewless, and Brewless only learns counts and table names.

Note

Restore tests are being rolled out. Until they are available for your organisation, the Backups tab says so and nothing below runs.

Switching them on

Restore tests are off until you switch them on. Open an environment, choose Backups, and tick Test a restore every month under Restore tests; choose the day of the month (1 to 28). On that day, or the first hour after it that the environment's backups are on and a successful backup exists, Brewless starts one test. One a month, however it ended.

Test now starts a test at once. Both need the right to manage applications.

One restore or restore test of an environment runs at a time: a test is refused while a restore runs, and the other way round.

What it checks

Per database of the backup:

Check Passes when
Loaded The dump loads into the temporary database, in one transaction
Tables Every table the backup listed exists, and the tables your framework needs (for Laravel: migrations)
Row counts Every table of at least 1,000 rows has an exact count within 10% of the number the backup noted
Extensions Every extension the database used is there

A MySQL database is skipped for now and named as such. Per bucket, 20 objects of at most 100 MB are picked at random and read back from the backup, without being written anywhere, and compared with what the backup noted of them: their checksum where the backup has one, otherwise their MD5, otherwise only their size.

A test that passed every check reads Restore checked, on the test and on the recovery point it tested. That is more than a successful backup: it says the backup could be restored. A test that found nothing to restore or read back, such as a backup whose only bucket is empty, reads Nothing to check: it proves nothing, so the recovery point gets no Restore checked, and as nothing failed there is no mail or webhook either. A test that failed or partly failed is listed with the check that failed and, for tables, which ones; the owners and admins of the organisation get a mail, and webhooks that listen hear restore_test.failed.

What it costs

A test runs in your account, so Scaleway bills it: the temporary databases while they exist, the job while it runs, and reading the backup from the other region. Before it makes anything, Brewless estimates the most a test can cost at Scaleway's list prices, for two hours, and refuses a test above the limit, € 2.00 unless your policy says otherwise. The estimate is shown with every test. A test that ends sooner costs less.

What it makes, and removes again

For each PostgreSQL database a Serverless SQL Database in Paris (fr-par), named brewless-restore-test-…. While the test runs, the restore's identity in your account may sign in to Serverless SQL Databases and write to buckets; both rights are taken back when the test ends. The job never deletes or overwrites anything: not your databases, not your buckets, not a backup.

When the test ends, however it ends, Brewless removes its temporary databases. Once an hour it also looks for temporary databases of a restore test that are older than six hours, removes them, notes it in the audit trail, mails the owners and admins, and sends restore_test.leftovers to webhooks that listen.

The API

Endpoint What it does
POST /api/environments/{environment}/backups/restore-tests Start a restore test now; answers 202 with the test
PATCH /api/environments/{environment}/backups restore_test.enabled and restore_test.day switch the monthly test on or off and set its day
GET /api/environments/{environment}/backups restore_test (the monthly test as set) and restore_tests (the newest tests with their checks)