We are using the [`backups_role`](https://github.com/coopdevs/backups_role/) to manage the backups in the OC instances. This role uses Backblaze (B2) and Restic to encrypt and upload the backup.
## Context
We are using the `backups_role` to create and save the snapshot in B2 with Restic.
In other projects with this backups strategy, we use the `restic` command-line tool to download and decrypt the snapshot from B2. This process take 10-30 mins. In this project, this strategy spends more than 5h and we need to change the strategy to download and decrypt a snapshot.
We must follow the next steps:
## Needed data
We need the keys of Backblaze and the Restic password. These secrets are saved in the [`opencell-provisioning`](https://gitlab.com/coopdevs/opencell-provisioning/) project. Show the decrypted secrets with:
```
$ ansible localhost -m debug -a var="<var_name>" -e "@inventory/host_vars/<host>/backups.yml" --ask-vault-pass
We have two options at this point: Create a new server or restore the backup in the current server.
### Create and provision a new server
Buy a new VPS and execute the [`opencell-provisioning`](https://gitlab.com/coopdevs/opencell-provisioning/) to prepare the server.
### Create and provision a new server
If you want to use the same server you need to be sure that you have space to download all the B2 bucket in the server. You can check the size of the bucket in https://secure.backblaze.com/b2_buckets.htm and searching the bucket. Then, if you don't have the space in the server, we can attach a new volume (double the size of the bucket to be more comfortable). This new volume attached can be find inside the server running `df -h`:
```
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 151G 119G 26G 83% /
/dev/sdc 246G 105G 128G 46% /mnt/HC_Volume_8507646 --> The new volume mounted on /mnt/HC_Volume_8507646
```
## 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:
4. With the `b2` configured we can download the bucket. You can find the bucket name listing the buckets with `b2 list-buckets`. Be sure that you start a `screen` session to avoid lost the output of the download process, that can take a lot of time:
We use the `restic` command-line tool to interact with the encrypted bucket.
1. Install `restic`. If the server had installed the `backup_role`, `restic` was installed, else please follow the installation instructions: https://restic.readthedocs.io/en/stable/020_installation.html#installation
2. Browse snapshots with `restic snapshots` and select which snapshot you want to restore.
4. Restore the dump in the new DB. Inside the snapshot, we can find a dump of OpenCell, a dump of Keycloak and the OC filesystem with all the printed invoices:
We are using the [`backups_role`](https://github.com/coopdevs/backups_role/) to manage the backups in the OC instances. This role uses Backblaze (B2) and Restic to encrypt and upload the backup.
## Context
We are using the `backups_role` to create and save the snapshot in B2 with Restic.
In other projects with this backups strategy, we use the `restic` command-line tool to download and decrypt the snapshot from B2. This process take 10-30 mins. In this project, this strategy spends more than 5h and we need to change the strategy to download and decrypt a snapshot.
We must follow the next steps:
## Needed data
We need the keys of Backblaze and the Restic password. These secrets are saved in the [`opencell-provisioning`](https://gitlab.com/coopdevs/opencell-provisioning/) project. Show the decrypted secrets with:
```
$ ansible localhost -m debug -a var="<var_name>" -e "@inventory/host_vars/<host>/backups.yml" --ask-vault-pass
We have two options at this point: Create a new server or restore the backup in the current server.
### Create and provision a new server
Buy a new VPS and execute the [`opencell-provisioning`](https://gitlab.com/coopdevs/opencell-provisioning/) to prepare the server.
### Create and provision a new server
If you want to use the same server you need to be sure that you have space to download all the B2 bucket in the server. You can check the size of the bucket in https://secure.backblaze.com/b2_buckets.htm and searching the bucket. Then, if you don't have the space in the server, we can attach a new volume (double the size of the bucket to be more comfortable). This new volume attached can be find inside the server running `df -h`:
```
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 151G 119G 26G 83% /
/dev/sdc 246G 105G 128G 46% /mnt/HC_Volume_8507646 --> The new volume mounted on /mnt/HC_Volume_8507646
```
## 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:
4. With the `b2` configured we can download the bucket. You can find the bucket name listing the buckets with `b2 list-buckets`. Be sure that you start a `screen` session to avoid lost the output of the download process, that can take a lot of time:
We use the `restic` command-line tool to interact with the encrypted bucket.
1. Install `restic`. If the server had installed the `backup_role`, `restic` was installed, else please follow the installation instructions: https://restic.readthedocs.io/en/stable/020_installation.html#installation
2. Browse snapshots with `restic snapshots` and select which snapshot you want to restore.