From f0b409f999248f41935d72c4146e44a966555569 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Sun, 11 Oct 2026 10:44:45 -0400 Subject: [PATCH] docs(docker-dev): #678.5 debug-logging overlay; correct the default-Debug claim --- docker-dev/README.md | 4 +++- docker-dev/docker-compose.debug.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 docker-dev/docker-compose.debug.yml diff --git a/docker-dev/README.md b/docker-dev/README.md index 6dbdbcb6..fc2e8957 100644 --- a/docker-dev/README.md +++ b/docker-dev/README.md @@ -207,7 +207,9 @@ The `-v` drops the SQL volume; remove it to keep ConfigDb state across restarts. 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: -- **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 in `Development` the default level is `Debug` — without these overrides every Deployment-poll 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. +- **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__=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. diff --git a/docker-dev/docker-compose.debug.yml b/docker-dev/docker-compose.debug.yml new file mode 100644 index 00000000..6f196d80 --- /dev/null +++ b/docker-dev/docker-compose.debug.yml @@ -0,0 +1,26 @@ +# docker-dev/docker-compose.debug.yml — optional overlay: raise Serilog levels per category on the central pair. +# +# The rig nodes run with ASPNETCORE_ENVIRONMENT unset (Production), so there is NO appsettings.Development.json and the +# Serilog default level is Information (the base appsettings.json sets none). Debug is therefore OFF by default; this +# overlay turns it on for chosen namespaces only, via Serilog:MinimumLevel:Override: (env: double underscore +# for ':', and the namespace's own dots stay dots). +# +# Up (recreates only the two central nodes with the extra env): +# docker compose -f docker-dev/docker-compose.yml -f docker-dev/docker-compose.debug.yml up -d --no-deps central-1 central-2 +# Back to normal: re-run `up -d --no-deps central-1 central-2` with the base file alone. +# +# Edit the list below to the categories you care about. Useful ones: +# ZB.MOM.WW.OtOpcUa.Runtime actors: DriverHostActor, OpcUaPublishActor, redundancy, deploys +# ZB.MOM.WW.OtOpcUa.Runtime.Drivers.DriverHostActor one actor only (e.g. the #672 historization verdict logs) +# ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient a single driver +# Opc.Ua OPC Foundation stack (very chatty) +# Akka cluster/remoting internals (chatty; base is Information) +# Leave Microsoft.EntityFrameworkCore / Microsoft.AspNetCore at Warning (see README "Resource limits & dev logging"): +# a Debug SQL flood starves the Akka heartbeat thread. +services: + central-1: + environment: + Serilog__MinimumLevel__Override__ZB.MOM.WW.OtOpcUa.Runtime: "Debug" + central-2: + environment: + Serilog__MinimumLevel__Override__ZB.MOM.WW.OtOpcUa.Runtime: "Debug"