Verified Commit c4b7aa62 authored by Florent Chehab's avatar Florent Chehab
Browse files

feat(doc): how to create a backup of the production db

parent ae0bc9a2
How to deploy
==============
# How to deploy
## Step-by-step
......@@ -13,7 +12,6 @@ If you don't know how to install them, you should look in [this section](Getting
`make prod` will start all the services described in `docker-compose.prod.yml` (in the `server` directory).
## Production architecture
Bellow is a quick nasty schema of the deploy architecture:
......@@ -31,5 +29,33 @@ The important stuff to remember:
- The database and the backend are on a private network.
- All logs are handled through docker volumes and a dedicated service that rotate the logs each day and keep 30 rotations (/days) of logs.
All request coming in `nginx` are logged. backend server errors are logged. If a frontend crash occurres a logging request is sent to the backend that will log it in a dedicated file.
All request coming in `nginx` are logged. backend server errors are logged. If a frontend crash occurs a logging request is sent to the backend that will log it in a dedicated file.
## Creating a database dump
To create a backup of the production database follow these instructions:
- SSH to the REX-DRI VM @UTC, then
```bash
rm -rf /tmp/rex-dri.*
sudo docker exec server_database_1 bash -c 'pg_dump -Fc --no-owner -d postgres -U postgres > /tmp/rex-dri.dump'
sudo docker cp server_database_1:/tmp/rex-dri.dump /tmp/rex-dri.dump
sudo chown $(whoami):$(whoami) /tmp/rex-dri.dump
# Encrypt the database dump
cd /tmp
GPG_TTY=$(tty) gpg-zip -c -o rex-dri.dump.gpg rex-dri.dump
```
- Copy the encrypted dump to your computer:
```bash
rm -rf /tmp/rex-dri.*
scp user@rex-dri-host:/tmp/rex-dri.dump.gpg /tmp/rex-dri.dump.gpg
```
The dump will be available on your computer at location `/tmp/rex-dri.dump.gpg`.
:warning: **Never share the decrypted version of the dump.**
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment