#!/bin/sh # Local-stack bootstrap (S-B04, #110, ADR-0020) — the "seed zaaktype + wire the ACL" step. # # Runs as the `local-seed` init container of infra/docker-compose.local.yml. It seeds + publishes # the BIG zaaktype (and the Diploma informatieobjecttype) into OpenZaak, then writes the resulting # **server-assigned** URLs into /out/acl.env, which the ACL entrypoint sources before starting. This # is the local-stack equivalent of what infra/run-domain-check.sh does for CI: the zaaktype UUID is # assigned by OpenZaak at creation, so it can't be a static value in the compose file. # # Why the container IP and not the `openzaak` service name: OpenZaak validates URL query params # (e.g. ?catalogus=) with Django's URLValidator, which rejects a single-label host like `openzaak`. # Seeding against the resolved IP keeps the seeded URLs valid AND host-consistent with the ACL, which # we point at the same IP below. See docs/runbooks/gitea-actions-gotchas.md and ADR-0020. set -eu oz_ip="$(python3 -c "import socket;print(socket.gethostbyname('openzaak'))")" OZ_BASE="http://${oz_ip}:8000" export OZ_BASE OZ_PUBLISH=1 echo ">> seeding + publishing the BIG zaaktype at ${OZ_BASE} (idempotent)" out="$(python3 /work/seed_catalogus.py)" echo "$out" zt="$(printf '%s\n' "$out" | sed -n 's/^ZAAKTYPE_URL //p' | head -1)" iot="$(printf '%s\n' "$out" | sed -n 's/^INFORMATIEOBJECTTYPE_URL //p' | head -1)" [ -n "$zt" ] || { echo "ERROR: seed did not report a ZAAKTYPE_URL" >&2; exit 1; } [ -n "$iot" ] || { echo "ERROR: seed did not report an INFORMATIEOBJECTTYPE_URL" >&2; exit 1; } # The ACL entrypoint sources this; these keys override the placeholder defaults in the compose file. cat > /out/acl.env <> wrote /out/acl.env (base=${OZ_BASE}/ zaaktype=${zt})"