diff --git a/Makefile b/Makefile index 3075548..d785565 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ COMPOSE := infra/docker-compose.yml # Long-running services with a healthcheck — the smoke polls these for readiness # (infra/wait-healthy.sh). One-shot init jobs (oz-init, nrc-init, flowable-init) # are not polled; they only need to have run. See docs/runbooks/gitea-actions-gotchas.md. -WAIT_SVCS := openzaak nrc-web acl bff domain event-subscriber projection-api self-service +WAIT_SVCS := openzaak nrc-web acl bff domain event-subscriber projection-api self-service openbaar # Config files (OpenZaak data.yaml, Keycloak realms, Flowable BPMN) are streamed # into external named volumes via `docker cp` (infra/seed-config.sh) instead of # bind-mounted, because bind mounts don't reach sibling containers on the diff --git a/apps/openbaar/Dockerfile b/apps/openbaar/Dockerfile new file mode 100644 index 0000000..ffeacf6 --- /dev/null +++ b/apps/openbaar/Dockerfile @@ -0,0 +1,21 @@ +# Multi-stage build for the openbaar portal (Angular → nginx). +# Build context is the repo root (the app needs the pnpm workspace + libs). See infra/docker-compose.yml. +FROM node:24-slim AS build +WORKDIR /src +RUN corepack enable && corepack prepare pnpm@11.5.2 --activate + +# Restore first (cached unless the manifests change). +COPY package.json pnpm-lock.yaml pnpm-workspace.yaml nx.json tsconfig.base.json eslint.config.mjs ./ +RUN pnpm install --frozen-lockfile + +# Sources (only what the app + its libs need). +COPY apps/openbaar apps/openbaar +COPY libs libs +RUN pnpm nx build openbaar + +FROM nginx:1.27-alpine AS runtime +COPY apps/openbaar/nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=build /src/dist/apps/openbaar/browser /usr/share/nginx/html +# No runtime config: the openbaar register is anonymous (no OIDC authority to inject). + +EXPOSE 80 diff --git a/apps/openbaar/nginx.conf b/apps/openbaar/nginx.conf new file mode 100644 index 0000000..aafc06b --- /dev/null +++ b/apps/openbaar/nginx.conf @@ -0,0 +1,23 @@ +server { + listen 80; + server_name _; + root /usr/share/nginx/html; + index index.html; + + # Resolve the BFF via Docker's embedded DNS at request time (variable proxy_pass), so nginx starts + # even before the BFF is up and picks up restarts — instead of failing to load the config. + resolver 127.0.0.11 ipv6=off valid=30s; + + # Same-origin API: proxy the anonymous openbaar endpoint group to the bff service. The api-client + # uses relative URLs, so the browser calls this origin and nginx forwards to the BFF — no CORS. + location /openbaar/ { + set $bff http://bff:8080; + proxy_pass $bff; + proxy_set_header Host $host; + } + + # SPA fallback — Angular client-side routing. + location / { + try_files $uri $uri/ /index.html; + } +} diff --git a/infra/docker-compose.yml b/infra/docker-compose.yml index 4dceacd..48c3853 100644 --- a/infra/docker-compose.yml +++ b/infra/docker-compose.yml @@ -458,6 +458,27 @@ services: condition: service_started networks: [cg] + # The openbaar (public) register portal: nginx serves the Angular app and reverse-proxies + # /openbaar to the BFF. Anonymous — no DigiD, no Keycloak dependency (S-09). + openbaar: + build: + context: .. + dockerfile: apps/openbaar/Dockerfile + image: register-referentie/openbaar:dev + ports: + - "8141:80" + healthcheck: + # 127.0.0.1, not localhost: nginx listens on IPv4 only, but localhost resolves to ::1 first. + test: ["CMD-SHELL", "wget -q -O /dev/null http://127.0.0.1/ || exit 1"] + interval: 5s + timeout: 3s + retries: 5 + start_period: 10s + depends_on: + bff: + condition: service_healthy + networks: [cg] + volumes: oz-db: nrc-db: