Manual Backup & Restore #

SetOps supports both Automatic Backups, as well as a manual backup and restore mechanism for Services. This feature allows you to backup your data at a specific point, restore a service to an earlier snapshot and is useful to migrate your apps from and to SetOps. Detailed configuration and usage steps for all of these use cases are outlined below.

πŸ’‘ The default backup mechanism comprises Automatic Backups and is managed automatically by SetOps. This is includes point-in-time recovery as a more fine grained method of restoring service data. For point-in-time recovery get in contact with a SetOps administrator.

List all manual backups #

Use backup to view a list of manual backups for a given Service:

setops -p <PROJECT> -s <STAGE> --service <SERVICE> backup
+--------------------------------------+---------+----------------------+----------+
|                  ID                  | STATUS  |      CREATED AT      |   SIZE   |
+--------------------------------------+---------+----------------------+----------+
| 6a6fcd7a-7063-4cb4-a748-8f765eea39a2 | CREATED | 2021-04-23T12:03:10Z | 150.8 kB |
| 82a08f8e-3392-4211-ac55-6cd9c2884fa4 | CREATED | 2021-04-27T19:07:25Z |  75.3 MB |
+--------------------------------------+---------+----------------------+----------+

The list shows two manual backups. Every manual backup is identified by its ID.

A manual backup can be in one of three states:

  • CREATED: the manual backup has been successfully created and is available for download and restore
  • CREATING: the manual backup is currently being created, it can’t be downloaded, restored, or deleted
  • RESTORING: the manual backup is currently being restored, it can’t be deleted
πŸ’‘ Note that Automatic Backups will not appear in this list as these are managed by SetOps.

Create a manual backup #

Use backup:create to create a backup for a given Service, e.g. database:

setops -p <PROJECT> -s <STAGE> --service database backup:create
ID:       badbbc84-911b-4eb0-89be-bfc3cea5c6ff
Status:   CREATING

Note that the manual backup can only be downloaded or restored when it has the status CREATED. Use backup to check that it is CREATED.

Restore a manual backup #

This will show you how to restore a manual backup for a given Service.

For a restore, you have two options:

Restoring a manual backup will not purge existing data for the service. Existing data will be kept and the manual backup is restored “on top” of it. See Restore manual backup to a new Service to learn how to import an earlier manual backup from SetOps or somewhere else.

Restore an existing service #

Use backup:restore ID to restore a backup for a given Service, e.g. database.

setops -p <PROJECT> -s <STAGE> --service database backup
+--------------------------------------+---------+----------------------+----------+
|                  ID                  | STATUS  |      CREATED AT      |   SIZE   |
+--------------------------------------+---------+----------------------+----------+
| e3e7ccb5-26ff-4946-ad5f-9c97118d77a3 | CREATED | 2021-07-15T16:01:53Z | 139.3 kB |
+--------------------------------------+---------+----------------------+----------+
setops -p <PROJECT> -s <STAGE> --service database backup:restore e3e7ccb5-26ff-4946-ad5f-9c97118d77a3
ID:           e3e7ccb5-26ff-4946-ad5f-9c97118d77a3
Status:       RESTORING
Created At:   2021-04-03T09:41:38Z
Size:         150.8 kB

When backup doesn’t show the manual backup as RESTORING, the restore process has finished. A feature that allows you to view manual backup logs and receive notifications for successful or failed restores will be added in a future version.

Restore to a new service #

Restoring to a new service will create an identical replica of an existing service or custom manual backup you uploaded.

To achieve this, follow these steps:

  1. Create a new Service with the same configuration as the existing one. See Showing information about a Service and Create a new Service. Make sure to apply your changes before continuing.

  2. Download the manual backup from the existing service.

  3. Upload the manual backup to the new service.

  4. Restore the manual backup to the new service.

  5. Link the new service to your app(s). If you want to replace the old service, unlink the old service and link the new service with the same environment key.

Upload a manual backup #

Use backup:upload FILE to upload a manual backup to a given Servie, e.g. database:

setops -p <PROJECT> -s <STAGE> --service database backup:upload backup.psqlcustom
βœ… backup.psqlcustom completed (1.47 mB) with ID b3263ac2-f6e0-4227-a3c7-f197603a386c
setops -p <PROJECT> -s <STAGE> --service database backup
+--------------------------------------+---------+----------------------+----------+
|                  ID                  | STATUS  |      CREATED AT      |   SIZE   |
+--------------------------------------+---------+----------------------+----------+
| b3263ac2-f6e0-4227-a3c7-f197603a386c | CREATED | 2021-07-15T16:01:53Z | 139.3 kB |
+--------------------------------------+---------+----------------------+----------+

You can use --print-url to get a command for uploading the file with an external tool. Add --output plain to only get the URL.

See Backup Formats to learn how to create a valid backup archive.

Download a manual backup #

Use backup:download ID to download a backup for a given Service, e.g. database:

setops -p <PROJECT> -s <STAGE> --service database backup
+--------------------------------------+---------+----------------------+----------+
|                  ID                  | STATUS  |      CREATED AT      |   SIZE   |
+--------------------------------------+---------+----------------------+----------+
| 0b10bc93-5ae7-40ef-ba40-e5110ad2d467 | CREATED | 2021-07-15T16:01:53Z | 139.3 kB |
+--------------------------------------+---------+----------------------+----------+
setops -p <PROJECT> -s <STAGE> --service database backup:download 0b10bc93-5ae7-40ef-ba40-e5110ad2d467
ID:           0b10bc93-5ae7-40ef-ba40-e5110ad2d467
Status:       CREATED
Created At:   2021-04-03T10:55:53Z
Size:         150.8 kB

βœ…  0b10bc93-5ae7-40ef-ba40-e5110ad2d467.psqlcustom completed (150.8 kB) with ID 0b10bc93-5ae7-40ef-ba40-e5110ad2d467

The CLI will download the manual backup to the current directory. To overwrite existing files, add the -f, --force flag.

Instead of downloading the file with the setops CLI, you can use --print-url to get a command for downloading the file with an external tool. Add --output plain to only get the URL.

See Backup Formats to learn how to use the downloaded manual backup.

Delete a manual backup #

Use backup:destroy ID to delete a backup for a given Service, e.g. database:

setops -p <PROJECT> -s <STAGE> --service database backup
+--------------------------------------+---------+----------------------+----------+
|                  ID                  | STATUS  |      CREATED AT      |   SIZE   |
+--------------------------------------+---------+----------------------+----------+
| 0b10bc93-5ae7-40ef-ba40-e5110ad2d467 | CREATED | 2021-07-15T16:01:53Z | 139.3 kB |
+--------------------------------------+---------+----------------------+----------+
setops -p <PROJECT> -s <STAGE> --service database backup:destroy 0b10bc93-5ae7-40ef-ba40-e5110ad2d467
ID:           0b10bc93-5ae7-40ef-ba40-e5110ad2d467
Status:       CREATED
Created At:   2021-04-02T10:21:00Z
Size:         150.8 kB

Reference #

Backup Formats #

Service Type Backup Format Notes
postgresql PostgreSQL Custom Archive with format custom created by pg_dump. See PostgreSQL docs.
s3 .tar.gz Archive Gzipped TAR archive with S3 bucket contents at the root level. Create the archive with tar czf.
redis RDB (Redis Database) See Redis docs.
volume .tar.gz Archive Gzipped TAR archive with volume contents at the root level.
documentdb MongoDB .gz Archive MongoDB archive created by mongodump --gzip. See mongodump.
elasticsearch - Not implemented yet