Commit 6967fb4e authored by Ian Sillitoe's avatar Ian Sillitoe
Browse files
parents cae77f1d a9756a47
## Docker environment
Remove any system docker software (if installed):
```sh
sudo yum remove docker docker-compose docker-common
```
Install latest `docker`:
```sh
# https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-centos-7
curl -fsSL https://get.docker.com/ | sh
sudo systemctl start docker
sudo systemctl enable docker
```
Install latest `docker-compose`:
```sh
# https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-centos-7
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
```
Get the `cathsm-server` code:
```sh
CATHSM_BRANCH=v0.0.1
CATHSM_ENV=production
sudo mkdir cathsm-server-${CATHSM_ENV}
sudo chown ucbcisi:users cathsm-server-${CATHSM_ENV}
git clone --branch=${CATHSM_BRANCH} https://github.com/CATH-SWISSMODEL/cathsm-server.git cathsm-server-${CATHSM_ENV}
```
Build `docker-compose`:
```sh
cd cathsm-server-${CATHSM_ENV}
cp .env.example .env
vim .env
sudo docker-compose -f docker-compose.yml build
```
Run `docker-compose`:
```sh
cd cathsm-server-${CATHSM_ENV}
sudo docker-compose -f docker-compose.yml run
```
## Post install
* Add Django group `API User` with the following permissions:
```
admin | log entry | Can view log entry
auth | group | Can view group
auth | permission | Can view permission
auth | user | Can view user
authtoken | Token | Can add Token
authtoken | Token | Can change Token
authtoken | Token | Can delete Token
authtoken | Token | Can view Token
contenttypes | content type | Can view content type
select_template_api | select template alignment | Can add select template alignment
select_template_api | select template alignment | Can change select template alignment
select_template_api | select template alignment | Can delete select template alignment
select_template_api | select template alignment | Can view select template alignment
select_template_api | select template hit | Can add select template hit
select_template_api | select template hit | Can change select template hit
select_template_api | select template hit | Can delete select template hit
select_template_api | select template hit | Can view select template hit
select_template_api | select template task | Can add select template task
select_template_api | select template task | Can change select template task
select_template_api | select template task | Can delete select template task
select_template_api | select template task | Can view select template task
sessions | session | Can add session
sessions | session | Can change session
sessions | session | Can delete session
sessions | session | Can view session
```
* Add Django users for general functionality:
* `apitest` - see `cathsm-client/tests/api1_test.py`
* `apiuser` - see `cathsm-server/frontend/src/components/WorkFlow.js`
## Manual deployment
The following steps are now deprecated (since the deployment has been moved to `docker-compose`), however
the notes are being left here for reference.
```sh
# https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-centos-7
sudo yum install python36 git redis nginx postgresql postgresql-contrib postgresql-devel
......
# password for the superuser of Postgres
# (note: not the password of the Django user
# accessing the database)
POSTGRES_PASSWORD=
# name of the database that will be created for
# the CATH-SM-API
POSTGRES_DB=
# dedicated datbase user for the Django app,
# postgres will create it in the database on
# first startup, Django uses it to log into the
# database
DJANGO_DB_USR=
# Password for the dedicated database user as
# scram-sha-256 hash. to generate a hash for a
# password, set up a mock-up PostgreSQL database,
# set encryption to scram-sha-256 and create a
# user with DJANGO_DB_USR and DJANGO_DB_CLR_PW.
# Then run
# `select usename,passwd from PG_SHADOW;`.
DJANGO_DB_PW=
# cleartext password for the dedicated database user
DJANGO_DB_CLR_PW=
# the administrative user for Django, the
# one which would normally go into
# eg `manage.py createsuperuser`
DJANGO_DB_ADMIN_USR=
# password for django superuser
DJANGO_DB_ADMIN_PW=
# mail address for the django superuser
DJANGO_DB_ADMIN_ML=
# source of code base:
# 'fromlocal' : local checkout of Git repo
# 'fromgitrepo' : clones the repo during build
CATHSMAPI_CODEBASE=fromlocal
# If CATHSMAPI_CODEBASE=fromgitrepo,
# determines the branch/ tag to be used from
# the Git repository
CATHSMAPI_GITTAG=v0.0.1
......@@ -11,40 +11,14 @@ version: "3.5"
# Please note: Environment variables used by this Docker Compose setup are
# spawned from a '.env' file. This file needs to be in the same
# directory as the docker-compose command is run. Variables in this
# file are defined by '<VARIABLE NAME>=<VALUE>'. Variables needed
# are:
# POSTGRES_PASSWORD - password for the superuser of Postgres, not
# the password of the Django user accessing
# the database
# POSTGRES_DB - name of the database that will be created for
# the CATH-SM-API
# DJANGO_DB_USR - dedicated datbase user for the Django app,
# postgres will create it in the database on
# first startup, Django uses it to log into the
# database
# DJANGO_DB_PW - Password for the dedicated database user as
# scram-sha-256 hash. to generate a hash for a
# password, set up a mock-up PostgreSQL database,
# set encryption to scram-sha-256 and create a
# user with DJANGO_DB_USR and DJANGO_DB_CLR_PW.
# Then run
# `select usename,passwd from PG_SHADOW;`.
# DJANGO_DB_CLR_PW - Cleartext password for the dedicated
# database user
# DJANGO_DB_ADMIN_USR - the administrative user for Django, the
# one which would normally go into
# `manage.py createsuperuser`
# DJANGO_DB_ADMIN_PW - password for the Django superuser
# DJANGO_DB_ADMIN_ML - mail address for the Django superuser
# CATHSMAPI_CODEBASE - there is a default for that one, it
# switches between using a local checkout
# of the Git repository or fetch a new one
# to build images; 'fromlocal' (the default)
# uses the local checkout, 'fromgitrepo'
# clones the repo during build.
# CATHSMAPI_GITTAG - If CATHSMAPI_CODEBASE=fromgitrepo,
# determines the branch/ tag to be used from
# the Git repository
# file are defined by '<VARIABLE NAME>=<VALUE>'.
#
# For convenience, a template `.env` file has been included in this
# repository (called `.env.template`). The easiest way to copy this
# template then change the values for each variable locally.
#
# $ cp .env.template .env
# $ vi .env
volumes:
db-store:
......
Markdown is supported
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