Skip to content

Implementation plan / Session plan / Handover FN-S02

Handover FN-S02 Foundation: Local integration environment

Card: FN-S02. Issue: cema-care/his#2. Branch: session/FN-S02.

What was built and where

All code is in platform/dev-environment/, and its README.md is the reference for using it. The decision is recorded in ADR-HIS-043 Local integration environment per session.

  • compose.yaml: the environment, run with Docker Compose. Images are pinned by version and digest.
  • The light profile is PostgreSQL 18.7.
  • The full profile adds:
    • Kafka 4.3.2 in KRaft mode, with Apicurio Registry 3.3.4 as the schema registry (data kept in the session's PostgreSQL);
    • Keycloak 26.8.1 with the synthetic test realm his;
    • OpenBao 2.6.6 in development mode;
    • the telemetry stack of technology stack row 15 (OpenTelemetry collector, Prometheus, Loki, Tempo, Grafana) as the single grafana/otel-lgtm 0.41.0 container.
  • his-env: the one command, with these subcommands:
  • start [light|full], smoke, env, status, stop, reset, psql;
  • compose <args> to pass any other command to Docker Compose.

On every start it creates one database per folder under services/, named after the folder in snake case. Each is owned by a role of the same name and password and closed to every other role. A new unit therefore gets its database without a change here. - Session separation. - The project name is COMPOSE_PROJECT_NAME, which must equal his-<HIS_SESSION in lowercase>, the value the launcher sets. Any other value is refused, so a leftover variable cannot act on another session's environment. - Every container, volume and network is prefixed with the project name and labelled care.cema.his.session. - Every port is published on 127.0.0.1 only, with no fixed host port. Docker assigns the host port, except for Kafka's host listener and Keycloak. Those two must advertise their own address, so his-env picks free ports for them at the first start and keeps them in .state/ (git-ignored). - reset removes only resources carrying the session's project label, including any left by an earlier version of compose.yaml, then verifies that none is left. - lib/smoke.py: the smoke check, using the Python standard library only. It reaches every service from the host, the way a test does. - test/isolation-check.sh: the "Ends when" check of the card, repeatable by any later session. - config/: the test realm (keycloak/his-realm.json: clients his-test and his-web, four synthetic users with no roles) and the init script that creates the databases of the registry and Keycloak. - CLAUDE.md section 3: a new paragraph "Integration environment" with the commands and the naming rule, and the FN-S02 entry marked as landed. - Decision record index: the row of ADR-HIS-043 and the count of 43, in the form build_adrs.py writes. This was checked by running the generator on a scratch copy and diffing; the result was identical. The plan build was not run in the checkout. The record was first numbered 042; FN-S06 merged its own ADR-HIS-042 first, so this one became 043 when the branch was brought up to date with main.

Checks and their result

Host: Docker 29.9.3 with Compose v5.7.1, 4 CPUs, 15 GB of memory, other unrelated containers running.

Check Command Result
Start, smoke check and reset from a fresh checkout, full profile git clone of the branch into an empty directory, then HIS_SESSION=FN-S02 platform/dev-environment/test/isolation-check.sh full (starts, smoke-checks and resets both environments) Passed. Both full environments started side by side in about 1.5 minutes, and each passed 9 of 9 smoke checks
Two environments under different session names at the same time; resetting one leaves the other untouched Same run: FN-S02 and FN-S02-twin Passed. The two share no container, volume, network or host port. After the twin's reset nothing of it was left, the twin's state file was gone, and FN-S02 had the same running containers and volumes. A marker row written before the reset was still in its database, and its smoke check passed again (9 of 9)
Same, light profile test/isolation-check.sh light Passed. 4 of 4 checks in each environment
Data survives stop and start start, write a row as cli_orders, stop, start, read it back The row was read back
Mismatched session variables are refused HIS_SESSION=X COMPOSE_PROJECT_NAME=his-fn-s02 his-env status Refused with exit status 1
Decision record index matches the generator build_adrs.py on a scratch copy, then diff -r Identical
Link check of docs/ python3 docs/implementation_plan/tools/check_links.py 0 broken links, 0 duplicate anchors
Documentation site build mkdocs build Builds

The smoke check of the full profile checks the following:

  • the session's naming, labels and loopback-only ports;
  • PostgreSQL: reachable from the host (protocol answer), each of the 25 unit databases open to its own role and closed to another, write and read back;
  • Kafka: a message produced through the host listener and consumed on the session network;
  • Apicurio: a JSON schema registered, read back and deleted;
  • Keycloak: discovery, an issuer equal to the host address, password and client-credentials grants for synthetic users;
  • OpenBao: a secret written, read and deleted;
  • telemetry: a trace, a log and a metric sent over OTLP and found in Tempo, Loki and Prometheus.

No environment of this session is left running.

Requirements and test scenarios

The card implements no functional requirement and lists no test scenario. It supports architecture section 10.2 (separate development and integration environments with their own credentials, synthetic data only).

Differences from the card or specification

  • The telemetry stack runs as one container (grafana/otel-lgtm), not as five separate ones. It holds the same products as technology stack row 15 and receives the same OTLP. ADR-HIS-043 gives the reasons: memory per session and start-up time. The production arrangement belongs to platform/observability/.
  • Docker Compose rather than a local Kubernetes cluster. Production runs on RKE2. The local environment provides the backing services only, and the Kubernetes deployment is the work of the platform sessions (ADR-HIS-043).
  • Development-only security. Credentials are known development values. OpenBao is unsealed and in memory. Keycloak has no MFA and no directory federation. Production requires both (technology stack row 10); this environment holds synthetic data only.
  • No authorization data in the test realm. The realm has users and clients but no roles or facility attributes. Access decisions belong to the policy decision point (row 11, architecture 7.5), and what goes into a token is for the ESS and RC-1 sessions to specify. This card does not.

Questions for a person

None left. The product owner approved ADR-HIS-043 on 2026-11-24, in the review of the FN-S02 pull request; its Record line and its row in the decision record index say so.

Follow-ups outside the card

  • Policy decision point, gateway, integration engine, object store. The environment has no Open Policy Agent, APISIX, Camel or RustFS. The first card that needs one (RC-1 for the policy decision service) adds it to compose.yaml under the same naming rules, as a service in the full profile or a profile of its own.
  • his-web redirect URIs. The public client allows http://localhost/* and http://127.0.0.1/*. FN-S06 sets the redirect URI of the shell's development server in the realm file, since a port in the URI must match.
  • Pipeline. FN-S05 can run test/isolation-check.sh light (or full) when platform/dev-environment/ changes, and must enter the six pinned images in the software bill of materials and the image scan (DEP-004).
  • Kafka topics are not created on first write. FN-S04 (contract tooling) or FN-S03 (template) decides how a unit creates the topics it owns in this environment, for example from its contract.