Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DIG-1555 & DIG-1595: Update deployment documentation #707

Open
wants to merge 41 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
6610fe8
back up doc, delete old docs
mshadbolt Aug 23, 2024
f0325e8
minor edits
mshadbolt Aug 23, 2024
b3c4b26
update names
mshadbolt Aug 26, 2024
88e9b00
update doc
mshadbolt Sep 6, 2024
a8b7bd5
add interact doc
mshadbolt Sep 10, 2024
f4f008b
update/add docs
mshadbolt Sep 11, 2024
26d8265
add c3g
mshadbolt Sep 11, 2024
94744d0
smaller table
mshadbolt Sep 11, 2024
b233946
fix typo
mshadbolt Sep 11, 2024
79cbe5e
edit for consistency
mshadbolt Sep 11, 2024
bc44ae3
add logs to backup
mshadbolt Sep 11, 2024
3a39fbb
Update docs/production-candig.md
mshadbolt Sep 13, 2024
7fbe578
move province settings
mshadbolt Sep 13, 2024
5d2c06d
update table
mshadbolt Sep 13, 2024
29d4123
add federation
mshadbolt Sep 13, 2024
57abbe7
add link
mshadbolt Sep 13, 2024
7384b1e
rewording from @DavidBrownlee
mshadbolt Sep 13, 2024
c7eec30
add expandables
mshadbolt Sep 13, 2024
b1f92c4
reorg
mshadbolt Sep 13, 2024
cc9c3fb
more collapses
mshadbolt Sep 13, 2024
e460dff
rearrange sections
mshadbolt Sep 13, 2024
c877a76
add stable branch
mshadbolt Sep 13, 2024
766e565
stable
mshadbolt Sep 13, 2024
3252dbf
updates
mshadbolt Sep 15, 2024
df6a6ef
Update install-candig.md
mshadbolt Sep 25, 2024
9739ed7
Merge branch 'develop' into mshadbolt/update-github-docs
mshadbolt Sep 26, 2024
e4d87c6
update to develop
mshadbolt Sep 26, 2024
b74958f
docs updates
mshadbolt Sep 26, 2024
0c0df71
add env section
mshadbolt Sep 26, 2024
3d335f2
rearrange
mshadbolt Sep 26, 2024
1d00919
missing tag
mshadbolt Sep 26, 2024
6141d84
rearrange
mshadbolt Sep 26, 2024
a45d366
add note
mshadbolt Sep 26, 2024
c51ee51
issue and doc update
mshadbolt Sep 26, 2024
907bf22
update prod
mshadbolt Sep 26, 2024
362385b
added backup
mshadbolt Sep 26, 2024
d935cb5
add vault backup, update mods
mshadbolt Sep 27, 2024
a073b9e
update log dir
mshadbolt Sep 27, 2024
9e89b47
more detail to vault backup
mshadbolt Sep 27, 2024
5617d99
add note
mshadbolt Sep 27, 2024
f08d6d2
add double proxy note
mshadbolt Sep 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 0 additions & 54 deletions docs/authx-setup.md

This file was deleted.

188 changes: 0 additions & 188 deletions docs/authz-permissions.md

This file was deleted.

114 changes: 114 additions & 0 deletions docs/backup-restore-candig.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Backing up and restoring CanDIG data

There are three kinds of data stored in CanDIG that we recommend backing up regularly.
1. Clinical and Genomic metadata stored in CanDIGs's postgres databases
2. Authorization data stored in vault that details user's authorization to access/edit ingested data
3. Logs

For data types 1 and 2, we recommend taking back ups after each ingest event and to store one or more copies of your backups on a separate secure server from your CanDIG installation. We also recommend encrypting your backup so that it cannot be accessed by an unauthorizaed user.

Logs can be backed up on a regular schedule and at a minimum, should be saved elsewhere when performing a rebuild of the stack.

## Backing up postgres databases

Both clinical and genomic metadata are stored within databases running in the postgres container `postgres-db`.

The commands below assume that you are connected to the machine that is hosting the dockerized CanDIGv2 stack.

To backup the data stored in these databases:

1. Open an interactive terminal inside the running postgres docker container with:

```bash
docker exec -it candigv2_postgres-db_1 bash
```

1. Dump contents of the two databases to files. `-d` specifies the database to dump, `-f` specifies the filename. Below we use the date and the name of the database being backed up:

```bash
pg_dump -U admin -d genomic -f yyyy-mm-dd-genomic-backup.sql
pg_dump -U admin -d clinical -f yyyy-mm-dd-clinical-backup.sql
```

You should then have two files, each with a complete copy of each of the databases.

You can now exit the container by entering

```bash
exit
```

You should copy these to a secure location outside of the running container and consider encrypting them or otherwise ensuring that unauthorized users will not have access to the information. To copy from the container on to the docker host, you can use a command similar to:

```bash
docker cp candigv2_postgres-db_1:yyyy-mm-dd-genomic-backup.sql /desired/path/target
docker cp candigv2_postgres-db_1:yyyy-mm-dd-clinical-backup.sql /desired/path/target
```

## Restoring postgres databases

To restore the databases that we have backed up, assuming you have the CanDIG stack up and running

1. Stop the running katsu and htsget containers which are connected to the databases

```bash
docker stop candigv2_katsu_1
docker stop candigv2_htsget_1
```

1. Then we need to copy the `sql` backup files into the running postgres container

```bash
docker cp /path/to/backup/yyyy-mm-dd-genomic-backup.sql candigv2_postgres-db_1:/yyyy-mm-dd-genomic-backup.sql
docker cp /path/to/backup/yyyy-mm-dd-clinical-backup.sql candigv2_postgres-db_1:/yyyy-mm-dd-clinical-backup.sql
```

Next we need to delete the initialized databases so we can replace them with the backed up versions.

1. Open an interactive terminal to the postgres container

```bash
docker exec -it candigv2_postgres-db_1 bash
```

1. Then connect to the psql commandline prompt with a database other than the ones we want to drop:

```bash
psql -U admin -d template1
```

1. Then drop the two existing databases, create empty replacement databases then quit the psql commandline prompt

```bash
DROP DATABASE clinical;
CREATE DATABASE clinical;
DROP DATABASE genomic;
CREATE DATABASE genomic;
\q
```

1. Load the backed up copies from file with these commands:

```bash
psql -U admin -d clinical < yyyy-mm-dd-clinical-backup.sql
psql -U admin -d genomic < yyyy-mm-dd-genomic-backup.sql
```

1. Exit the interactive terminal with the `exit` command.

1. Restart the katsu and htsget services

```bash
docker start candigv2_katsu_1
docker start candigv2_htsget_1
```

You should be able to see the restored data in the data portal.

## Backing up Authorization data
mshadbolt marked this conversation as resolved.
Show resolved Hide resolved

## Backing up logs

Logs are stored in `tmp/logging`. The contents of this folder should be saved periodically.


Loading
Loading