-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from GeneriekPublicatiePlatformWoo/odrc-in-doc…
…ker-compose odrc in docker compose
- Loading branch information
Showing
16 changed files
with
410 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ services: | |
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=localdev | ||
- ASPNETCORE_FORWARDEDHEADERS_ENABLED=true | ||
- ODRC_BASE_URL=http://odrc/ | ||
- ODRC_API_KEY=xxx | ||
image: ${DOCKER_REGISTRY-}odpc | ||
build: | ||
context: . | ||
|
@@ -16,14 +18,123 @@ services: | |
depends_on: | ||
- postgres-db | ||
postgres-db: | ||
image: postgres | ||
image: postgis/postgis:${PG_VERSION:-16-master} | ||
volumes: | ||
- db:/var/lib/postgresql/data | ||
- postgres-db:/var/lib/postgresql/data | ||
- ./docker/odrc/db/init-db.sql:/docker-entrypoint-initdb.d/init_db.sql | ||
- ./docker/open-zaak/db/0001-init-open-zaak-db.sql:/docker-entrypoint-initdb.d/0001-init-open-zaak-db.sql | ||
- ./docker/open-zaak/db/0002-extensions.sh:/docker-entrypoint-initdb.d/0002-extensions.sh | ||
environment: | ||
- POSTGRES_PASSWORD=localdev | ||
restart: always | ||
ports: | ||
- "5432:5432" | ||
redis: | ||
image: redis:7 | ||
command: ["redis-server", "--appendonly", "yes"] | ||
volumes: | ||
- redis-data:/data | ||
|
||
openzaak-web: | ||
image: openzaak/open-zaak:${OPENZAAK_VERSION:-1.14.0} | ||
environment: &openzaak_web_env | ||
- DJANGO_SETTINGS_MODULE=openzaak.conf.patched_settings | ||
- SECRET_KEY=${SECRET_KEY:-django-insecure-^#9nzgn*@-@0szv+$$)6th!i+$$ks^+bt@&ejcgzqt==7af(a(u3} | ||
- ALLOWED_HOSTS=openzaak-web,openzaak.docker.internal,localhost | ||
- DB_NAME=openzaak | ||
- DB_USER=postgres | ||
- DB_PASSWORD=localdev | ||
- DB_HOST=postgres-db | ||
- IS_HTTPS=no | ||
- CACHE_DEFAULT=redis:6379/1 | ||
- CACHE_AXES=redis:6379/1 | ||
- SUBPATH=${SUBPATH:-/} | ||
- OPENZAAK_SUPERUSER_USERNAME=admin | ||
- DJANGO_SUPERUSER_PASSWORD=admin | ||
- OPENZAAK_SUPERUSER_EMAIL=admin@localhost | ||
- DISABLE_2FA=true | ||
- CELERY_BROKER_URL=redis://redis:6379/2 | ||
- CELERY_RESULT_BACKEND=redis://redis:6379/2 | ||
- NOTIFICATIONS_DISABLED=true | ||
- JWT_EXPIRY=99999999999 # Roughly 3170 years. This is required for tests with time frozen to work | ||
- CELERY_WORKER_CONCURRENCY=${CELERY_WORKER_CONCURRENCY:-2} | ||
volumes: | ||
&openzaak_web_volumes # mount fixtures dir to automatically populate the DB | ||
- ./docker/open-zaak/fixtures/:/app/fixtures | ||
- ./docker/open-zaak/patched_settings.py:/app/src/openzaak/conf/patched_settings.py | ||
- oz-media:/app/media # Shared media volume to get access to saved OAS files | ||
- oz-private-media:/app/private-media | ||
depends_on: | ||
- postgres-db | ||
- redis | ||
- openzaak-celery | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
ports: | ||
- 8001:8000 | ||
|
||
openzaak-celery: | ||
image: openzaak/open-zaak:${OPENZAAK_VERSION:-1.14.0} | ||
environment: *openzaak_web_env | ||
volumes: *openzaak_web_volumes | ||
command: /celery_worker.sh | ||
depends_on: | ||
- postgres-db | ||
- redis | ||
|
||
odrc-django: &odrc_build | ||
image: maykinmedia/woo-publications:${ODRC_VERSION:-latest} | ||
pull_policy: always | ||
environment: &odrc_env | ||
- DJANGO_SETTINGS_MODULE=woo_publications.conf.docker | ||
- SECRET_KEY=${SECRET_KEY:-django-insecure-fgggi4*bl2wdg&@0&)t7ewy5-2!b3l4lhx4_+^zpw%x2i28v8} | ||
- DB_NAME=woo_publications | ||
- DB_USER=postgres | ||
- DB_HOST=postgres-db | ||
- DB_PASSWORD=localdev | ||
- CACHE_DEFAULT=redis:6379/0 | ||
- CACHE_AXES=redis:6379/0 | ||
- ODRC_SUPERUSER_USERNAME=admin | ||
- [email protected] | ||
- DISABLE_2FA=true | ||
- DJANGO_SUPERUSER_PASSWORD=admin | ||
- ALLOWED_HOSTS=* | ||
# Environment labeling | ||
- SHOW_ENVIRONMENT=yes | ||
- ENVIRONMENT_LABEL=docker-compose | ||
- ENVIRONMENT_BACKGROUND_COLOR=#1d63ed | ||
- ENVIRONMENT_FOREGROUND_COLOR=white | ||
- DEBUG=True | ||
volumes: &odrc_volumes | ||
- ./docker/odrc/fixtures/:/app/fixtures | ||
- media:/app/media | ||
- log:/app/log | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
# required because Open Zaak otherwise treats our /catalogi/api/v1/ endpoints as | ||
# internal | ||
- "openzaak.docker.internal:host-gateway" | ||
ports: | ||
- 8000:8000 | ||
depends_on: | ||
- postgres-db | ||
- redis | ||
|
||
# we need a reverse proxy for odrc because django doesn't support chunked requests | ||
odrc: | ||
image: nginx:stable-alpine | ||
restart: always | ||
ports: | ||
- 8002:80 | ||
volumes: | ||
- ./docker/nginx:/etc/nginx/conf.d/ | ||
depends_on: | ||
- odrc-django | ||
|
||
volumes: | ||
db: | ||
postgres-db: | ||
redis-data: | ||
oz-media: | ||
oz-private-media: | ||
log: | ||
media: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
server { | ||
listen 80 default_server; | ||
|
||
location / { | ||
proxy_pass http://odrc-django:8000/; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CREATE USER woo_publications; | ||
CREATE DATABASE woo_publications WITH OWNER woo_publications; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[ | ||
{ | ||
"model": "zgw_consumers.service", | ||
"pk": 1, | ||
"fields": { | ||
"label": "Documenten API [Open Zaak]", | ||
"oas": "http://openzaak.docker.internal:8001/documenten/api/v1/openapi.yaml", | ||
"oas_file": "", | ||
"uuid": "4f88855e-e0a3-4d4b-80fb-c7774d965a92", | ||
"slug": "documenten-api", | ||
"api_type": "drc", | ||
"api_root": "http://openzaak.docker.internal:8001/documenten/api/v1/", | ||
"api_connection_check_path": "", | ||
"client_id": "woo-publications-dev", | ||
"secret": "insecure-yQL9Rzh4eHGVmYx5w3J2gu", | ||
"auth_type": "zgw", | ||
"header_key": "", | ||
"header_value": "", | ||
"nlx": "", | ||
"user_id": "woo-publications-dev", | ||
"user_representation": "Woo Publications (dev)", | ||
"client_certificate": null, | ||
"server_certificate": null, | ||
"timeout": 10 | ||
} | ||
}, | ||
{ | ||
"model": "zgw_consumers.nlxconfig", | ||
"pk": 1, | ||
"fields": { | ||
"directory": "", | ||
"outway": "", | ||
"certificate": "", | ||
"certificate_key": "" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Open Zaak docker configuration | ||
|
||
This directory contains supporting configuration and infrastructure to run Open Zaak | ||
via `docker compose`. | ||
|
||
You need Docker Engine v20.10 or newer for the documented setup to work. | ||
|
||
## Spinning up the services | ||
|
||
In the root of the project, spin up Open Zaak via `compose`: | ||
|
||
```bash | ||
docker compose up --detach openzaak-web # or just `docker compose up` to bring everything up | ||
``` | ||
|
||
Open Zaak binds to port 8001 on the host system. | ||
|
||
## Accessing the admin environment | ||
|
||
Open your browser and navigate to http://localhost:8001/admin/, where you can log in | ||
with the credentials `admin` / `admin`. | ||
|
||
## API client | ||
|
||
One API client is configured, with all permissions enabled. The credentials are: | ||
|
||
* Client ID: `woo-publications-dev` | ||
* Secret: `insecure-yQL9Rzh4eHGVmYx5w3J2gu` | ||
|
||
## API connection from Open Zaak to WOO Publications | ||
|
||
Open Zaak will make certain API calls to API endpoints exposed by WOO Publications. This | ||
requires some specific setup - most notably the Woo Publications must be listening on | ||
port 8000 on the host system. | ||
|
||
If you're bringing up the whole compose stack, this is taken care of already. If you run | ||
the development server, it's easiest to bind to all ports: | ||
|
||
```bash | ||
src/manage.py runserver 0.0.0.0:8000 | ||
``` | ||
|
||
## Dumping the fixture | ||
|
||
The service automatically loads the fixtures provided in the `fixtures` directory. When | ||
making changes in the web interface to the configuration, you must update these | ||
fixtures: | ||
|
||
```bash | ||
# from the root of the repository | ||
docker compose run openzaak-web \ | ||
python src/manage.py dumpdata \ | ||
--indent=4 \ | ||
--output /app/fixtures/configuration.json \ | ||
authorizations.applicatie \ | ||
vng_api_common.jwtsecret \ | ||
config \ | ||
zgw_consumers | ||
``` | ||
|
||
Depending on your OS and local user ID, you may need to grant additional write permissions: | ||
|
||
```bash | ||
chmod -R o+rwx ./docker/open-zaak/fixtures | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CREATE USER openzaak; | ||
CREATE DATABASE openzaak WITH OWNER openzaak; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "openzaak" <<-EOSQL | ||
CREATE EXTENSION postgis; | ||
CREATE EXTENSION pg_trgm; | ||
EOSQL |
Oops, something went wrong.