|
|
|
We are using the [`backups_role`](https://github.com/coopdevs/backups_role/) to manage the backups in the OC instances. This role use Backblaze (B2) and Restic to encrypt and upload the backup.
|
|
|
|
|
|
|
|
We must follow the next steps to restore a backup:
|
|
|
|
|
|
|
|
## Download backup from B2
|
|
|
|
To download the bucket we need to install and config the [`b2` command-line tool](https://www.backblaze.com/b2/docs/quick_command_line.html):
|
|
|
|
1. Access to the server where you want to restore:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ ssh <user>@<host>
|
|
|
|
```
|
|
|
|
|
|
|
|
2. Install `b2` with `pip`:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ pip install b2
|
|
|
|
```
|
|
|
|
|
|
|
|
3. Configure `b2`:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ b2 authorize-account [<applicationKeyId>] [<applicationKey>]
|
|
|
|
```
|
|
|
|
|
|
|
|
> You can find the `applicationKeyId` and the `applicationKey` in BW with the name `backblaze - <host>`.
|
|
|
|
|
|
|
|
3. With the
|
|
|
|
|
|
|
|
Get our `applicationKeyId` and `applicationKe
|
|
|
|
|
|
|
|
## Extract the snapshot with Restic
|
|
|
|
|
|
|
|
## Restore backup
|
|
|
|
|
|
|
|
1. Copy the backup into the server.
|
|
|
|
|
|
|
|
2. Stop the OpenCell container:
|
| ... | ... | @@ -12,13 +46,13 @@ $ docker stop opencell |
|
|
|
$ docker exec -ti postgres dropdb -U opencell opencell
|
|
|
|
```
|
|
|
|
|
|
|
|
4. Create the new OpenCell db:
|
|
|
|
4. Create the new OpenCell DB:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ docker exec -ti postgres createdb -U opencell opencell
|
|
|
|
```
|
|
|
|
|
|
|
|
5. Restore the dump in the new db:
|
|
|
|
5. Restore the dump in the new DB:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ cat <DUMP_FILE> | docker exec -i postgres psql -U opencell opencell
|
| ... | ... | @@ -26,7 +60,7 @@ $ cat <DUMP_FILE> | docker exec -i postgres psql -U opencell opencell |
|
|
|
|
|
|
|
6. Restore the filesystem from the backup overriding the `opencelldata` folder.
|
|
|
|
|
|
|
|
7. Up the opencell container:
|
|
|
|
7. Up the OC container:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ docker-compose up -d
|
| ... | ... | |
| ... | ... | |