## What & why The host-browser stack (`make local`) had drifted behind three slices, so a fresh bring-up couldn't complete the flow: registrations stuck at `OpenZaakAanmaken`, the behandel werkbak stayed empty, and the openbaar register showed nothing. The `verify-*` scripts do this setup for CI at test time; `make local` had no equivalent. This makes the local stack **self-seed at bring-up** so it just works in a browser: - **DMN** — `flowable-init` now also deploys `diploma-eligibility.dmn` (was BPMN-only), so completing `WachtOpDocumenten` routes through the DMN to `Beoordelen` instead of 404ing. - **Zaaktype + ACL** — a `local-seed` one-shot publishes the BIG zaaktype (whose UUID is server-assigned, hence not static in the compose file) and writes the real URLs to `seed-env:/acl.env`; the ACL sources it on startup via an entrypoint override. - **NRC abonnement** — an `nrc-subscribe` one-shot registers the `zaken` subscription at the event-subscriber callback, so notifications reach the projection/openbaar register. Both one-shots reach OpenZaak/NRC by **container IP** (a single-label host fails their Django URLValidator), mirroring the CI verify scripts. Design + trade-offs in **ADR-0020**. Closes #110 ## Definition of Done - [x] Linked Gitea issue (#110). - [x] Failing test committed before the implementation — `test(infra): …` adds `infra/run-local-flow-check.sh` / `make verify-local`; the three gaps' failures were observed live on a fresh `make local` (red), and the fix turns it green. - [x] Implementation makes the test pass; docs commit follows. - [x] Conventional Commits referencing the issue (`refs #110`). - [ ] CI green — running on the restored runner. Infra-only change; the CI `verify-stack` job uses `docker-compose.yml` (untouched). Also validated locally: `make verify-local` passes against a fresh `make local` (see below). - [x] `docker compose up` from a fresh clone reaches green health checks — verified: `make local` healthy in ~2m20s, then `make verify-local` green. - [x] Docs updated — ADR-0020 + demo-script note. - [x] ADR added in `docs/architecture/` — ADR-0020. - [x] Demo note in `docs/demo-script.md`. ## Notes for reviewers - **Infra-only** — no service code changes; the ACL image and the CI stack (`docker-compose.yml`) are untouched. - **Verified end-to-end on a fresh stack** (`make local-down && make local && make verify-local`): ``` >> 2. zaak opened (zaaktype seeded + wired) >> 3. documents accepted 204 (DMN deployed) >> 4. in the werkbak (DMN routing → Beoordelen) >> 5. visible in the openbaar register (NRC abonnement) OK — a fresh local stack completed the flow with no manual seeding ``` - **Follow-up:** the cleaner design — ACL resolving its zaaktype by `identificatie` instead of a pinned server-assigned URL — is split out as **S-27 (#113)**; landing it would remove the `acl.env` injection here. ADR-0020 records this. - The `seed-env` volume carries the generated `acl.env` from `local-seed` to the ACL; a `down --volumes` (as `make local-down` does) resets it cleanly. Reviewed-on: #114
68 lines
3.5 KiB
Bash
Executable File
68 lines
3.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Acceptance check for the local stack (S-B04, #110): a fresh `make local` must complete the whole
|
|
# flow with NO manual seeding. Run against an already-up local stack (infra/docker-compose.local.yml)
|
|
# via the host-published ports. It exercises, and thereby covers, the three bring-up gaps the slice
|
|
# fixes:
|
|
#
|
|
# 1. zaaktype seeded + ACL wired -> a submitted registration opens a zaak (zaakUrl gets filled).
|
|
# 2. diploma-eligibility DMN deployed -> providing documents completes WachtOpDocumenten, routes
|
|
# through the DMN, and the case lands on Beoordelen (visible in the behandel werkbak).
|
|
# 3. NRC abonnement registered -> the zaak shows up in the openbaar (public) register.
|
|
#
|
|
# Before the fix this fails at step 1 (ACL points at a placeholder zaaktype -> OpenZaak 400).
|
|
set -euo pipefail
|
|
|
|
DOM=${DOM:-http://localhost:8130} # domain
|
|
BFF=${BFF:-http://localhost:8080} # bff (openbaar register)
|
|
BSN=${BSN:-123456782}
|
|
# A minimal, valid PDF, base64-encoded (the diploma upload).
|
|
PDF_B64="$(printf '%%PDF-1.4\n1 0 obj<</Type/Catalog>>endobj\ntrailer<</Root 1 0 R>>\n%%%%EOF\n' | base64 | tr -d '\n')"
|
|
|
|
echo ">> 1. submit a registration (no manual seeding expected)"
|
|
loc="$(curl -fsS -D - -o /dev/null -X POST "$DOM/registrations" \
|
|
-H 'Content-Type: application/json' -d "{\"bsn\":\"$BSN\"}" \
|
|
| sed -n 's/\r$//; s/^[Ll]ocation: //p' | head -1)"
|
|
[ -n "$loc" ] || { echo "FAIL: POST /registrations returned no Location" >&2; exit 1; }
|
|
id="${loc##*/}"
|
|
echo " accepted: $id"
|
|
|
|
echo ">> 2. poll until the ACL opens the zaak (proves the zaaktype is seeded + wired)"
|
|
zaak=""
|
|
for _ in $(seq 1 30); do
|
|
zaak="$(curl -fsS "$DOM$loc" | python3 -c 'import sys,json;print(json.load(sys.stdin).get("zaakUrl") or "")' 2>/dev/null || true)"
|
|
[ -n "$zaak" ] && break
|
|
sleep 3
|
|
done
|
|
[ -n "$zaak" ] || { echo "FAIL: zaak never opened — ACL zaaktype not wired (gap 1)" >&2; exit 1; }
|
|
echo " zaak opened: $zaak"
|
|
|
|
echo ">> 3. provide documents (proves the diploma-eligibility DMN is deployed)"
|
|
code="$(curl -s -o /dev/null -w '%{http_code}' -X POST "$DOM/registrations/$id/documents" \
|
|
-H 'Content-Type: application/json' \
|
|
-d "{\"bsn\":\"$BSN\",\"contentBase64\":\"$PDF_B64\",\"fileName\":\"diploma.pdf\",\"contentType\":\"application/pdf\"}")"
|
|
[ "$code" = "204" ] || { echo "FAIL: provide documents -> $code (DMN missing routes WachtOpDocumenten to a 404 — gap 2)" >&2; exit 1; }
|
|
echo " documents accepted (204)"
|
|
|
|
echo ">> 4. poll the werkbak until the registration awaits beoordeling (reached Beoordelen)"
|
|
in_werkbak=""
|
|
for _ in $(seq 1 20); do
|
|
in_werkbak="$(curl -fsS "$DOM/behandel/werkbak" | python3 -c "import sys,json;print(any(r.get('registrationId')=='$id' for r in json.load(sys.stdin)))" 2>/dev/null || true)"
|
|
[ "$in_werkbak" = "True" ] && break
|
|
sleep 3
|
|
done
|
|
[ "$in_werkbak" = "True" ] || { echo "FAIL: registration never reached the werkbak (gap 2)" >&2; exit 1; }
|
|
echo " in the werkbak"
|
|
|
|
echo ">> 5. poll the openbaar register until the reference is publicly visible (proves NRC abonnement)"
|
|
public=""
|
|
for _ in $(seq 1 30); do
|
|
public="$(curl -fsS "$BFF/openbaar/register" | python3 -c "import sys,json;print(any(r.get('reference')=='$id' for r in json.load(sys.stdin)))" 2>/dev/null || true)"
|
|
[ "$public" = "True" ] && break
|
|
sleep 3
|
|
done
|
|
[ "$public" = "True" ] || { echo "FAIL: reference never appeared in the openbaar register — NRC abonnement not registered (gap 3)" >&2; exit 1; }
|
|
echo " visible in the openbaar register"
|
|
|
|
echo "OK — a fresh local stack completed the flow with no manual seeding (zaaktype + DMN + abonnement)"
|