Host layout
Every machine that runs a stack (dev box, compute, web, iis) has the same folder tree
under one root, NORNIR_DOCKER_USER_ROOT:
Windows:
D:\DockerUbuntu:
/srv/docker
Nothing under the root is committed. Templates live in the repositories (example.* files) and
are copied in by nornir-docker/deploy/Initialize-DockerHost.ps1, which never overwrites an
existing file. Re-run it after adding a stack to a host; it only fills in what is missing.
The tree
<root>/
stack.ps1 forwarding launcher -> <repo>/nornir-docker/deploy/stack.ps1
Run/
_host/
host.env machine settings for every stack on this host
secrets/secrets.env machine-wide secrets (GITHUB_TOKEN)
targets.psd1 remote targets (on the machines you deploy from)
<stack>/
<stack>.run.env settings for one stack
secrets/
secrets.env generated or pasted secrets for that stack
... secret files (Duende_License.key, secrets.json, ...)
nornir-net-mounts/ CIFS shares for nornir-build (compute)
net-mounts/nas-mounts.tsv
secrets/net-creds/*.cred
.run.nornir-net-mounts.env
Builds/<stack>/ build-time env (docker-build.ps1 build.env) and
forwarding launchers for older habits
Data/<stack>/ persistent service data (models, keys, databases)
Certs/<cert-name>/ the TLS certificate shared by every TLS service
cert.pem chain.pem fullchain.pem privkey.pem cert.pfx .renewed-at
Work/nornir-build-<version>-<stamp>/ per-session /workspace for nornir-build
Logs/<stack>/ persistent logs (nornir-build: NORNIR_LOG_ROOT)
What goes where
Folder |
Contents and rules |
|---|---|
|
A small generated launcher that resolves |
|
Settings that apply to the whole host: which stacks it runs, the domain, the TLS mode, the
repository paths. |
|
One folder per stack key (the same name as the compose project and the registry key).
|
|
Build-time overrides for |
|
Data a service must keep across |
|
Written only by |
|
Disposable |
|
Host-side log folders. |
Checkouts are outside the root: /srv/src/nornir and /srv/src/Viking on Ubuntu (created by
bootstrap-ubuntu.sh), any path on Windows (for example D:\src\git\nornir).
Permissions
On Ubuntu bootstrap-ubuntu.sh makes the deploy user own /srv/docker and /srv/src.
Initialize-DockerHost.ps1 and stack.ps1 then set:
Path |
Mode |
Set by |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Files you copy in by hand keep whatever mode they had; fix them with chmod 600. On Windows,
keep D:\Docker\Run readable only by your account (default for a folder outside your profile is
readable by all local users; tighten the ACL with icacls if the box is shared).
Environment merge order
For a stack, stack.ps1 merges these files; a later file wins for the same key:
Run/_host/host.envRun/_host/secrets/secrets.envRun/<stack>/<stack>.run.envRun/<stack>/secrets/secrets.env
Compose stacks get all four as --env-file arguments (in that order) for variable substitution,
and every merged value is also set in the process environment while compose runs. Script stacks
(nornir-build, nornir-dashboard, nornir-dev, nornir-cursor-worker) get the
merged values as process environment for their launcher. A value already set in your shell does
not override the files for stack.ps1; the files win.
Contract variables
After the merge, stack.ps1 adds these. Compose files reference them instead of hard-coding
paths. Paths use forward slashes (D:/Docker/...), which Docker Desktop accepts.
Variable |
Value |
|---|---|
|
The layout root. |
|
The stack key, for example |
|
|
|
|
|
|
|
|
|
|
|
|
|
nornir checkout on this host (from |
|
Viking checkout on this host (from |
|
|
|
|
NORNIR_DOCKER_USER_ROOT, STACK_* and DOCKER_* are always recomputed from the layout
root; values for them in env files are replaced. The other contract variables are only filled in
when empty.