test: complete grpc data solution validation

This commit is contained in:
Joseph Doherty
2026-11-17 22:01:27 -05:00
parent 4cf3acb1c5
commit 9c8c1054fa
39 changed files with 37835 additions and 160 deletions
+39 -8
View File
@@ -1,6 +1,37 @@
# docker-dev
Mac-friendly OtOpcUa fleet for manual UI exercise + integration smoke tests. Spins up **one single Akka mesh** (hub-and-spoke topology) + SQL Server + Traefik on the same Compose network. All six host nodes share the single `OtOpcUa` ConfigDb — logical separation between MAIN, SITE-A, and SITE-B is enforced by per-row `ServerCluster.ClusterId` scoping, not by mesh isolation.
Mac-friendly OtOpcUa fleet for manual UI exercise and integration smoke tests. MAIN,
SITE-A and SITE-B each run an independent two-node Akka cluster on one Compose
network with SQL Server and Traefik. The MAIN pair manages one `OtOpcUa` ConfigDb.
Site pairs fetch deployed artifacts from MAIN. Each node seeds only itself and its
partner, and the default intercluster command and telemetry transports use gRPC.
## gRPC data connection scope
The development seed leaves the data connection catalog empty and uses the
disabled default for `DataConnections__Enabled`. The Galaxy gateway driver below
uses a gateway credential. OtOpcUa data connections use scoped API keys for
requests between OtOpcUa hosts. A connection
draft in the Admin UI at `/clusters/{ClusterId}/data-connections` must be deployed from
`/deployments` before it affects a node. Exports grant an authenticated data principal access
to a locally owned Raw/UNS root; mappings grant selected consumers a distinct projected view.
The listener is disabled by default and requires a dedicated port, explicit allowed hosts,
TLS certificate and scoped credential/trust provisioning when enabled in production. See
[Data connections](../docs/DataConnections.md) and
[Configuration](../docs/Configuration.md#dataconnections) for rollout, limits and defaults.
For isolated deployment, scoped data credentials and fault validation, use the
[standalone local rig](../scripts/validation/grpc-data/README.md). It starts CONTROL, SOURCE
and CONSUMER pairs with a private CA, generated data keys, disposable SQL and a writable
Modbus simulator. Its Docker context must be local, and its published ports bind to loopback.
It uses its own network and local software fixtures. The coordinator
prepares that rig with `rig.py preflight`, `up`, `seed` and `deploy` under one run ID, then
uses `run-final.py --run-id <same-id>` for the unfiltered whole-solution test gate. The final
runner requires a ready rig and its own owned software fixtures; see
[local prerequisites](../scripts/validation/grpc-data/LOCAL_FIXTURES.md). The fixture helper
also needs an installed PostgreSQL ODBC driver; the current final runner expects the
Homebrew library at `/opt/homebrew/opt/psqlodbc/lib/psqlodbcw.so`. Fixture credentials and
test evidence stay in restricted run files.
## Stack
@@ -17,7 +48,7 @@ Authentication uses the **shared GLAuth** on the Linux Docker host at `10.100.0.
| Service | Roles | Ports |
|---|---|---|
| `central-1` | `OTOPCUA_ROLES=admin,driver`, Akka mesh seed | host `4840` → container `4840`; internal `9000` |
| `central-1` | `OTOPCUA_ROLES=admin,driver`, MAIN seed | host `4840` → container `4840`; internal `9000` |
| `central-2` | `OTOPCUA_ROLES=admin,driver`, joins central-1 | host `4841` → container `4840`; internal `9000` |
`central-1` and `central-2` are the **only** nodes that host the Admin UI and the deploy singleton. They are also the OPC UA publishers for the MAIN cluster. Traefik routes all `PathPrefix(/)` traffic to whichever central node has the leader role.
@@ -26,17 +57,17 @@ Authentication uses the **shared GLAuth** on the Linux Docker host at `10.100.0.
| Service | Roles | Ports |
|---|---|---|
| `site-a-1` | `OTOPCUA_ROLES=driver`, joins the single mesh | host `4842` → container `4840` |
| `site-a-1` | `OTOPCUA_ROLES=driver`, seeds SITE-A | host `4842` → container `4840` |
| `site-a-2` | `OTOPCUA_ROLES=driver` **+** a deliberately miscased `Cluster__Roles__0=Driver` (see below) | host `4843` → container `4840` |
### Site B nodes — driver-only (SITE-B cluster)
| Service | Roles | Ports |
|---|---|---|
| `site-b-1` | `OTOPCUA_ROLES=driver`, joins the single mesh | host `4844` → container `4840` |
| `site-b-1` | `OTOPCUA_ROLES=driver`, seeds SITE-B | host `4844` → container `4840` |
| `site-b-2` | **`Cluster:Roles`-ONLY** — no `OTOPCUA_ROLES` at all (see below) | host `4845` → container `4840` |
Site nodes serve no UI and authenticate no users. The central cluster manages and deploys to them over the shared Akka mesh. All six nodes bind Akka remoting to port `4053` inside their own network namespace; `PublicHostname` for each matches its Compose service name.
The central pair serves the Admin UI and deploys to site pairs through the intercluster gRPC command and artifact services. All six nodes bind Akka remoting to port `4053` inside their own network namespace; `PublicHostname` for each matches its Compose service name.
### Role-authority standing pins (archreview R3-04)
@@ -59,7 +90,7 @@ rig as originally configured. Two nodes deliberately deviate, as standing pins:
## Multi-tenancy
All six host nodes write to the same `OtOpcUa` ConfigDb. The `ServerCluster` table differentiates the three logical clusters: each maps to one row, and each `ClusterNode` row's `ClusterId` ties the runtime node back to its owning cluster scope.
The MAIN pair manages the `OtOpcUa` ConfigDb. The site pairs fetch and cache their deployed configurations. The `ServerCluster` table differentiates the three logical clusters: each maps to one row, and each `ClusterNode` row's `ClusterId` ties the runtime node back to its owning cluster scope.
Two one-shot Compose services bootstrap the DB on bring-up: `migrator` applies the EF Core migrations (so a fresh SQL volume gets the schema with no operator step — the host nodes deliberately do **not** auto-migrate, since production owns schema changes), then `cluster-seed` (image `mcr.microsoft.com/mssql-tools`) INSERTs the rows below. `cluster-seed` and every host node `depend_on` the `migrator` completing (`service_completed_successfully`), so the seed never races an in-progress migration. The seed is **idempotent** — `IF NOT EXISTS` guards every insert — so re-runs on `docker compose up` are no-ops:
@@ -237,14 +268,14 @@ The `-v` drops the SQL volume; remove it to keep ConfigDb state across restarts.
## Resource limits & dev logging
The full single-mesh stack (`central-1`/`central-2` + the four site nodes) can OOM-kill `central-1` on a loaded host. Two settings in the compose file guard against that:
The full three-pair stack (`central-1`/`central-2` + the four site nodes) can OOM-kill `central-1` on a loaded host. Two settings in the compose file guard against that:
- **EF Core + ASP.NET Core logs are pinned to `Warning`** on every host node (`Serilog__MinimumLevel__Override__Microsoft.EntityFrameworkCore` / `…Microsoft.AspNetCore` = `Warning`). The host logs via Serilog (`AddZbSerilog` → `ReadFrom.Configuration`), and a `Development` environment would default to `Debug` (`appsettings.Development.json`) — the rig does NOT set `ASPNETCORE_ENVIRONMENT`, so nodes actually run at the base `Information` default, but these pins keep the SQL chatter out should the rig ever run as Development; without them a Debug/Information-level EF pipeline emits an `Executed DbCommand` / `SELECT … FROM [Deployment]` line, flooding the Serilog pipeline and starving the Akka cluster heartbeat thread. Application + Akka log levels are left untouched, so this only silences the per-poll SQL chatter. To temporarily restore the SQL log flood for debugging, drop those two env vars (or set them back to `Information`) on the node you're inspecting.
To raise Debug logging for chosen categories on `central-1`/`central-2` (e.g. `ZB.MOM.WW.OtOpcUa.Runtime`), use the overlay: `docker compose -f docker-dev/docker-compose.yml -f docker-dev/docker-compose.debug.yml up -d --no-deps central-1 central-2` — it sets `Serilog__MinimumLevel__Override__<Namespace>=Debug`; edit its category list to taste.
- **Each host node has `mem_limit: 1g`** (`mem_reservation: 512m`). A quiet solo `central-1` measures ~357 MiB; the limit leaves headroom for the deploy/UI load and per-cluster driver subscriptions that push a fully-loaded node higher. The limit/reservation live on the `&otopcua-host` anchor, so all six host services inherit them; `sql`, `traefik`, and the one-shot `migrator`/`cluster-seed` are left unbounded.
The full six-node host stack therefore needs roughly **6 GiB** of Docker Desktop VM memory just for the host nodes (plus SQL Server's own footprint on top). On a constrained host, either raise the Docker Desktop VM memory or run fewer host services (e.g. just `central-1` + `central-2`, or a single central node) rather than the full mesh.
The full six-node host stack therefore needs roughly **6 GiB** of Docker Desktop VM memory just for the host nodes (plus SQL Server's own footprint on top). On a constrained host, either raise the Docker Desktop VM memory or run fewer host services (e.g. just `central-1` + `central-2`, or a single central node) to reduce memory use.
## Notes