# Open Notificaties (NRC) stack (S-01-c). Lean adaptation of the upstream dev compose: # db (PostGIS) + redis (also the Celery broker) + migrate-init + the API + a celery worker. # # Shares the `cg` network with the OpenZaak stack so the two can reach each other. # Run BOTH together (NRC needs OpenZaak's Autorisaties API for auth wiring): # # docker compose -f infra/openzaak/docker-compose.yml -f infra/opennotificaties/docker-compose.yml up -d # curl -s -o /dev/null -w '%{http_code}\n' http://localhost:8001/admin/ # -> 302 # # NRC is published on host :8001 (OpenZaak holds :8000). services: nrc-db: image: docker.io/postgis/postgis:17-3.5 environment: POSTGRES_USER: opennotificaties POSTGRES_PASSWORD: opennotificaties POSTGRES_DB: opennotificaties command: postgres -c max_connections=300 volumes: - nrc-db:/var/lib/postgresql/data healthcheck: # pg_isready only checks TCP; the second clause verifies PostGIS is installed # so nrc-init migrations can safely start (avoids race on cold container start). test: ["CMD-SHELL", "pg_isready -U opennotificaties -d opennotificaties && psql -U opennotificaties -d opennotificaties -c 'SELECT PostGIS_Version();' -q 2>/dev/null"] interval: 5s timeout: 5s retries: 30 start_period: 15s networks: [cg] nrc-redis: image: docker.io/library/redis:7 networks: [cg] nrc-init: build: context: . dockerfile: Dockerfile args: OPENNOTIFICATIES_TAG: ${OPENNOTIFICATIES_TAG:-1.16.1} image: register-referentie/opennotificaties:dev environment: &nrc-env DJANGO_SETTINGS_MODULE: nrc.conf.docker SECRET_KEY: ${NRC_SECRET_KEY:-dev-only-not-for-production} DB_HOST: nrc-db DB_NAME: opennotificaties DB_USER: opennotificaties DB_PASSWORD: opennotificaties IS_HTTPS: "no" ALLOWED_HOSTS: "*" CACHE_DEFAULT: nrc-redis:6379/0 CACHE_AXES: nrc-redis:6379/0 CELERY_BROKER_URL: redis://nrc-redis:6379/1 CELERY_RESULT_BACKEND: redis://nrc-redis:6379/1 DISABLE_2FA: "true" OPENNOTIFICATIES_SUPERUSER_USERNAME: admin DJANGO_SUPERUSER_PASSWORD: admin OPENNOTIFICATIES_SUPERUSER_EMAIL: admin@localhost # Migrations only for now. No setup_configuration steps are enabled yet (the # OZ<->NRC notification wiring lands in S-06), and NRC's `setup_configuration` # aborts with "No steps enabled" on the empty data.yaml — so we run `migrate` # directly instead of /setup_configuration.sh. See data.yaml and ADR-0002. command: ["sh", "-c", "/wait_for_db.sh && OTEL_SDK_DISABLED=True python src/manage.py migrate"] depends_on: nrc-db: condition: service_healthy nrc-redis: condition: service_started networks: [cg] nrc-web: image: register-referentie/opennotificaties:dev environment: *nrc-env healthcheck: test: ["CMD", "python", "-c", "import requests,sys; sys.exit(0 if requests.head('http://localhost:8000/admin/').status_code in (200,302) else 1)"] interval: 10s timeout: 5s retries: 10 start_period: 30s ports: - "8001:8000" depends_on: nrc-init: condition: service_completed_successfully networks: [cg] nrc-celery: image: register-referentie/opennotificaties:dev environment: *nrc-env command: /celery_worker.sh depends_on: nrc-init: condition: service_completed_successfully networks: [cg] volumes: nrc-db: networks: cg: