Debugging
Logs, shells, and exec
Every observation command works locally or with -Target:
stack.ps1 viking-identity logs -Target web # last 200 lines
stack.ps1 viking-identity logs -Follow -Tail 1000 -Target web
stack.ps1 viking-annotation logs -Service <service> -Target web
stack.ps1 viking-identity shell -Target web # bash (or sh) in DefaultService
stack.ps1 viking-corrections exec -Service <service> -Target web -- printenv
stack.ps1 nornir-build shell -Target compute
stack.ps1 nornir-build logs -Target compute
stack.ps1 <stack> config validates the merged env and compose files without starting
anything; stack.ps1 doctor runs it for every stack on the host.
Persistent logs
Container stdout and stderr go to Docker’s log (logs above). Files that must survive a
rebuild go under <root>/Logs/<stack>/ (STACK_LOGS_DIR in compose):
nornir-build:Logs/nornir-buildis mounted at/var/log/nornirandNORNIR_LOG_ROOT=/var/log/nornir, so everynornir-buildsession writes its unified log there (nornir_shared.misc.SetupLogging; see Logging convention).Viking stacks: whatever their compose file mounts from
STACK_LOGS_DIR.
Read them on the host (less /srv/docker/Logs/nornir-build/...) or through VS Code
Remote-SSH.
Health checks
stack.ps1 <stack> status (and up, restart, rebuild) probes the stack’s health URL
after compose ps. Any answer below HTTP 500 counts as healthy; certificate errors are ignored
so a staging certificate does not hide a running service.
Stack |
Health URL |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
none (gRPC only, a renewer, an interactive container) |
Python: debugpy
For nornir-build on compute. NORNIR_DEBUGPY=1 only publishes the port; it does not
start a listener, and debugpy is not baked into the images.
In
Run/nornir-build/nornir-build.run.envoncompute, enable the port and recreate the container (start-nornir-build.ps1then publishes127.0.0.1:<port>on the container):NORNIR_DEBUGPY=1 #NORNIR_DEBUGPY_PORT=5678
stack.ps1 nornir-build rebuild -Target compute
In the container, install debugpy and start the command under it.
nornir_buildmanager.buildis the module behind thenornir-buildcommand:stack.ps1 nornir-build shell -Target compute python -m pip install debugpy python -m debugpy --listen 0.0.0.0:5678 --wait-for-client -m nornir_buildmanager.build <nornir-build arguments>
On the dev box, open the tunnel (
stack.ps1 tunnel -Target compute; itsTunnelsentry forwards 5678, so change it too if you setNORNIR_DEBUGPY_PORT) and attach VS Code tolocalhost:5678with this.vscode/launch.jsonentry.nornir:prodandnornir:cupyrun the packages baked under/opt/nornir; a-Clonesession runs them from/workspace:{ "name": "Attach: nornir-build on compute", "type": "debugpy", "request": "attach", "connect": { "host": "127.0.0.1", "port": 5678 }, "justMyCode": false, "pathMappings": [ { "localRoot": "${workspaceFolder}", "remoteRoot": "/workspace" }, { "localRoot": "${workspaceFolder}", "remoteRoot": "/opt/nornir" } ] }
Breakpoints bind only when your local checkout is at the commit the container runs (
-Syncdeploys keep them equal).
The same attach entry works for the local cursor-dev container when you publish 5678 there.
viking-segmentation has no debugpy wiring.
.NET: remote debugger
The web tunnel forwards port 4024 for the .NET remote debugger attached to the Identity
container (published on loopback only). How the Viking images start vsdbg and which
configuration to attach with are in Viking identity.
Before you change code
Reproduce with
stack.ps1 <stack> logsand the persistent log first.stack.ps1 doctorexplains most start failures (missing keys, secret files, certificate, DNS). The full symptom list is Troubleshooting.