Skip to content

Commit

Permalink
Merge pull request #46 from minvws/update-container-docs
Browse files Browse the repository at this point in the history
Update docs to build with pre built containers
  • Loading branch information
underdarknl authored Oct 4, 2022
2 parents b7be880 + 8ad0de2 commit caca73e
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
- crux
ports:
- "127.0.0.1:8001:80"
image: "ghcr.io/minvws/nl-kat-octopoes:container-image"
image: "ghcr.io/minvws/nl-kat-octopoes:latest"
command: uvicorn octopoes.api.api:app --host 0.0.0.0 --port 80
env_file:
- .env
Expand All @@ -38,7 +38,7 @@ services:
depends_on:
- crux
- rabbitmq
image: "ghcr.io/minvws/nl-kat-octopoes:container-image"
image: "ghcr.io/minvws/nl-kat-octopoes:latest"
command: celery -A octopoes.tasks.tasks worker --loglevel=INFO
env_file:
- .env
Expand All @@ -48,12 +48,12 @@ services:
depends_on:
- rabbitmq
- bytes
image: "ghcr.io/minvws/nl-kat-boefjes:container-image"
image: "ghcr.io/minvws/nl-kat-boefjes:latest"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
deploy:
replicas: 1
command: python3 -m bin.worker boefje
command: python3 -m boefjes boefje
env_file:
- .env

Expand All @@ -62,10 +62,10 @@ services:
depends_on:
- rabbitmq
- bytes
image: "ghcr.io/minvws/nl-kat-boefjes:container-image"
image: "ghcr.io/minvws/nl-kat-boefjes:latest"
deploy:
replicas: 1
command: python3 -m bin.worker normalizer
command: python3 -m boefjes normalizer
env_file:
- .env

Expand Down Expand Up @@ -107,12 +107,11 @@ services:
- rocky-db
- boefje
- normalizer
- flower
- katalogus
- scheduler
ports:
- "127.0.0.1:8000:8000"
image: "ghcr.io/minvws/nl-kat-rocky:container-image"
image: "ghcr.io/minvws/nl-kat-rocky:latest"
env_file:
- .env
environment:
Expand All @@ -124,33 +123,20 @@ services:
- bytes-db
ports:
- "127.0.0.1:8002:8000"
image: "ghcr.io/minvws/nl-kat-bytes:container-image"
image: "ghcr.io/minvws/nl-kat-bytes:latest"
env_file:
- .env
environment:
- BYTES_DATA_DIR=/data
volumes:
- bytes-data:/data

flower:
restart: on-failure
image: mher/flower:latest
command: ["celery", "--workdir", "/flower", "--config", "celery_config", "flower", "--port=5555"]
env_file:
- .env
volumes:
- ./flower:/flower
ports:
- "127.0.0.1:5555:5555"
depends_on:
- rabbitmq

katalogus:
restart: on-failure
depends_on:
- katalogus-db
image: "ghcr.io/minvws/nl-kat-boefjes:container-image"
command: ["python", "-m", "uvicorn", "--host", "0.0.0.0", "katalogus.api:app"]
image: "ghcr.io/minvws/nl-kat-boefjes:latest"
command: ["python", "-m", "uvicorn", "--host", "0.0.0.0", "boefjes.katalogus.api:app"]
ports:
- "127.0.0.1:8003:8000"
env_file:
Expand All @@ -175,7 +161,7 @@ services:

scheduler:
restart: on-failure
image: "ghcr.io/minvws/nl-kat-mula:container-image"
image: "ghcr.io/minvws/nl-kat-mula:latest"
command: python -m scheduler
ports:
- "127.0.0.1:8004:8000"
Expand All @@ -187,6 +173,15 @@ services:
- octopoes_api
- katalogus

keiko:
restart: on-failure
image: "ghcr.io/minvws/nl-kat-keiko:latest"
command: uvicorn keiko.app:api --host 0.0.0.0 --port 8000
ports:
- "127.0.0.1:8005:8000"
env_file:
- .env

volumes:
rocky-db-data:
bytes-db-data:
Expand Down
44 changes: 38 additions & 6 deletions docs/containers.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ OpenKAT can be deployed using containers. We aim to support both simple docker /
docker-compose setups and container orchestration systems like Kubernetes and
Nomad.

There is a docker-compose.prod-example.yml in the docs directory that can be
There is a docker-compose.release-example.yml in the root directory that can be
used as an example how to deploy using docker-compose.

**Note: This is still a work in progress.**

## Container images

The container images can be found here:
Expand All @@ -18,23 +16,43 @@ The container images can be found here:
- https://github.com/minvws/nl-kat-mula/pkgs/container/nl-kat-mula
- https://github.com/minvws/nl-kat-octopoes/pkgs/container/nl-kat-octopoes
- https://github.com/minvws/nl-kat-rocky/pkgs/container/nl-kat-rocky
- https://github.com/minvws/nl-kat-keiko/pkgs/container/nl-kat-keiko

## Setup

To set up an installation with pre-built containers, you can pull the repository using:

```shell
git clone https://github.com/minvws/nl-kat-coordination.git
```

If this is your first install, and you do not have an .env file yet, you can create an .env file using the following command:

```shell
make env
```

This will create an .env file with the default values. You can edit this file to change the default values. Now you can pull and start the containers using the following command:

```shell
docker-compose -f docker-compose.release-example.yml up -d
```


The container image run the necessary database migration commands in the
entrypoint if DATABASE_MIGRATION is set. You manually need to run setup commands
in the katalogus and rocky containers to initialize everything. In the katalogus
container we need to create an organisation, we can do this by running the
following in the katalogus container:

```shell
python3 -m seed
python3 -m boefjes.seed
```

With docker-compose you would run this as:

```shell
docker-compose -f docker-compose.prod-example.yml exec katalogus python3 -m seed
docker-compose -f docker-compose.release-example.yml exec katalogus python3 -m boefjes.seed
```

In the rocky container we first need to import the OOI database seed:
Expand All @@ -46,7 +64,7 @@ python3 manage.py loaddata OOI_database_seed.json
With docker-compose you would run this as:

```shell
docker-compose -f docker-compose.prod-example.yml exec rocky python3 manage.py loaddata OOI_database_seed.json
docker-compose -f docker-compose.release-example.yml exec rocky python3 manage.py loaddata OOI_database_seed.json
```

Next we need to create the superuser, this will prompt for the e-mail address and password:
Expand All @@ -55,12 +73,26 @@ Next we need to create the superuser, this will prompt for the e-mail address an
python3 manage.py createsuperuser
```

With docker-compose you would run this as:

```shell
docker-compose -f docker-compose.release-example.yml exec rocky python3 manage.py createsuperuser
```


We also need to create an organisation, this command will create a development organisation:

```shell
python3 manage.py setup_dev_account
```

With docker-compose you would run this as:

```shell
docker-compose -f docker-compose.release-example.yml exec rocky python3 manage.py setup_dev_account
```


## Env variables

Each container needs to be configured using a set of environment variables
Expand Down

0 comments on commit caca73e

Please sign in to comment.