| ... | ... | @@ -92,60 +92,67 @@ $ sudo restic -r <path-of-bucket> restore <snapshot-id> --target <path-to-restor |
|
|
|
0. Access to the server and change to the app user:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ ssh <user>@<host>
|
|
|
|
$ sudo su - opencell
|
|
|
|
ssh <user>@<host>
|
|
|
|
sudo su - opencell
|
|
|
|
```
|
|
|
|
|
|
|
|
1. Stop the OpenCell container:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ docker stop opencell
|
|
|
|
docker stop opencell
|
|
|
|
```
|
|
|
|
|
|
|
|
2. Drop the OpenCell database:
|
|
|
|
2. Drop the OpenCell & Keycloak database:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ docker exec -ti postgres dropdb -U opencell opencell
|
|
|
|
docker exec -ti postgres dropdb -U opencell opencell
|
|
|
|
docker exec -ti postgres dropdb -U opencell keycloak
|
|
|
|
```
|
|
|
|
|
|
|
|
3. Create the new OpenCell DB:
|
|
|
|
3. Create the new OpenCell & Keycloak DB:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ docker exec -ti postgres createdb -U opencell opencell
|
|
|
|
docker exec -ti postgres createdb -U opencell opencell
|
|
|
|
docker exec -ti postgres createdb -U opencell keycloak
|
|
|
|
```
|
|
|
|
|
|
|
|
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:
|
|
|
|
4. Restore the dump in the new DB.
|
|
|
|
We have the OC filesystem snapshot separated from the Opencell & Keycloak DB dump, which is found in another bucket in BackBlaze.
|
|
|
|
|
|
|
|
- OC DB bucket:
|
|
|
|
```
|
|
|
|
# Estructura interna del snapshot
|
|
|
|
/opt/backup/.tmp/pg_dump_opencell.sql
|
|
|
|
/opt/backup/.tmp/pg_dump_keycloak.sql
|
|
|
|
/mnt/HC_Volume_100466521/backup/pg_dump_opencell.sql
|
|
|
|
/mnt/HC_Volume_100466521/backup/pg_dump_keycloak.sql
|
|
|
|
/home/opencell/input-files/opencell-version.txt
|
|
|
|
/home/opencell/input-files/opencell-admin.properties
|
|
|
|
/home/opencell/opencelldata
|
|
|
|
```
|
|
|
|
|
|
|
|
- OC filesystem bucket:
|
|
|
|
```
|
|
|
|
$ cat <snapshot-path>/opt/backup/.tmp/pg_dump_opencell.sql | docker exec -i postgres psql -U opencell opencell
|
|
|
|
$ cat <snapshot-path>/opt/backup/.tmp/pg_dump_keycloak.sql | docker exec -i postgres psql -U opencell keycloak
|
|
|
|
/mnt/HC_Volume_9375116/opencelldata
|
|
|
|
```
|
|
|
|
The OC filesystem is not growing, since invoices are not stored in it anymore. Therefore, we are not updating its content in its corresponding bucket.
|
|
|
|
|
|
|
|
5. Restore the filesystem from the backup overriding the `opencelldata` folder:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ sudo cp -r <snapshot-path>/home/opencell/opencelldata /home/opencell/opencelldata
|
|
|
|
$ sudo chown -R 1000 /home/opencell/opencelldata
|
|
|
|
cat <db-path>/pg_dump_opencell.sql | docker exec -i postgres psql -U opencell opencell
|
|
|
|
cat <db-path>/pg_dump_keycloak.sql | docker exec -i postgres psql -U opencell keycloak
|
|
|
|
```
|
|
|
|
|
|
|
|
5. Prepare the filesystem from the backup:
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo chown -R 1000 <filesystem-path>/opencelldata
|
|
|
|
```
|
|
|
|
|
|
|
|
6. Restore the OC properties:
|
|
|
|
6. Prepare the OC properties:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ sudo cp -r <snapshot-path>/home/opencell/input-files/opencell-admin.properties /home/opencell/input-files/opencell-admin.properties
|
|
|
|
$ sudo chown -R 1000 /home/opencell/input-files/opencell-admin.properties
|
|
|
|
sudo chown -R 1000 <properties-path>/opencell-admin.properties
|
|
|
|
```
|
|
|
|
|
|
|
|
6. Up the OC container:
|
|
|
|
6. Make sure the <properties-path> and the <filesystem-path> are well placed in the `docker-compose.yml', listed in services / opencell / volumes
|
|
|
|
|
|
|
|
8. Up the OC container:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ docker-compose up -d
|
| ... | ... | |
| ... | ... | |