Docker Compose on One Server
Self-Hosted Only
Containers on One Server
The same parts the development tool starts, described as containers for Docker Compose: the web front end, the API, the engine worker, PostgreSQL and a Redis-compatible cache.
Copyright (c) 1998-2026 DigitalPrez, LLC. Internal working document, not for publication.
Status: Run on 2026-11-23 and 2026-11-24, Tested by the Owner, and in Production Since 2026-11-27
The owner has run this guide themselves (said on 2026-11-29). The two images these files build, from Dockerfile.api and Dockerfile.worker, are the ones DigitalPrez’s own instance runs on Kubernetes since 2026-11-27 (deploy/digitalprez/RELEASES.md). The runs on this development machine are recorded below.
The files were built and run on a Windows development machine with Docker Desktop 4.99.0 (engine 29.9.3, Compose 5.7.0, Linux containers), from Git Bash, on host port 18080. Every check below passed after six faults were fixed on 2026-11-23; on 2026-11-24 five things the first run had left open were fixed too, and the stack was run again from empty volumes. Each fix has a test in tools/test/deploy.test.mjs. “Checks that prove these files” gives each result, and “Known gaps” what was not proved. They have not run on a Linux server, behind a host web server with TLS, or with more than one API container.
The images the files name, as they were pulled that day. Pin them by digest before a release:
| Image | Version Inside | Digest |
|---|---|---|
postgres:18 |
PostgreSQL 18.7 | sha256:f5cbc081c25690710f3fc6f4c61a7565382bae01ca0d0f2028a53d7926b85a20 |
valkey/valkey:8-alpine |
Valkey 8.1.12 | sha256:9971099af41c36e887aabdfe22b80c0fe45df949163dfc9cb434febc57cfc3fc |
node:26-alpine |
Node.js 26.13.1, Alpine 3.24.4 | sha256:6bd9ab43c0ec0190ca7b2d193906cb8b7edf6e7f4afa43ddeccd6452710bffb5 |
nginx/nginx-unprivileged:stable-alpine |
nginx 1.30.8 | sha256:637c35e46af7bc0dd3d3bcf7162e004e13ab3b370fde7cd416e2ac410b5a985a |
mcr.microsoft.com/dotnet/sdk:10.0 |
.NET SDK 10.0.404 | sha256:8c6edfb26c85153f236d26efebd9ad349aec403583f343f201ee67838b23658d |
mcr.microsoft.com/dotnet/aspnet:10.0-noble-chiseled-extra |
ASP.NET Core 10.0.15 | sha256:cae5b962bfb786606def03d250c6a645cc98839095c89e806e4bd8978a68115b |
alpine:3.24, for reading the folder of keys |
Alpine 3.24 | sha256:f59abe656b692d901e184be3445e084786602108599d2a51d229c0f5a48c71bf |
The images built from them: the API 340 MB, the worker 1.53 GB (Chromium is most of it), the web front end 122 MB. A first build took under a minute on that machine with the base images already pulled.
What the run found and fixed:
| # | Fault | Fix |
|---|---|---|
| 1 | The cache restarted for ever with chown: .: Operation not permitted: started as root, its image’s entry script changes the owner of /data and steps down to its own user, and both need capabilities the service drops |
user: valkey in compose.yaml: the script then does neither |
| 2 | In the plain chiseled runtime image .NET runs in its invariant mode. A probe in that image showed string.Normalize handing every string back unchanged, so an operator’s password is not brought to one form before it is hashed and an organization’s handle loses its accented letters; and no time zone but UTC was found, so a list asked for by day in the reader’s own zone is refused |
Dockerfile.api runs on 10.0-noble-chiseled-extra, which carries ICU and the time zone data; the same probe then gave the normalized forms and every zone. 57 MB more |
| 3 | Every connection logged Cannot load library libgssapi_krb5.so.2: Npgsql 10 tries GSS-API encryption first, and the image has no Kerberos library |
GSS Encryption Mode=Disable in the connection string, as Npgsql’s security page gives (read) |
| 4 | Every start warned that ASPNETCORE_URLS overrides HTTP_PORTS: the base image and our files named port 8080 twice |
The port is the base image’s alone (ASPNETCORE_HTTP_PORTS=8080) |
| 5 | The pages nginx serves itself went out without Strict-Transport-Security, which the API sends with its own answers |
Each location that serves files sends it, 30 days as the API, only when X-Forwarded-Proto says https |
| 6 | The console’s files carried X-Robots-Tag twice, and the Server header named nginx’s exact version |
The second header is gone; server_tokens off in both servers |
What the first run left open, fixed on 2026-11-24:
| # | What Was Open | Fix | Seen in the Second Run |
|---|---|---|---|
| 7 | The layout check did not work in a container | “The layout check”, below: a seccomp profile for the worker, a HOME of its own for the browser, and Chromium’s graphics-process filter off |
The check answered 200 with the page’s own report, twice, about 2.5 s each |
| 8 | The worker could reach the API’s port on the engine network, since a Docker network joins its members both ways |
The API listens on its fixed front address alone (ASPNETCORE_URLS), and the base image’s own port setting is emptied |
The worker, the database and the cache were refused on the API’s port; nginx got through, and the API still reached the worker |
| 9 | With nothing in front of the web container, a caller could name its own address in X-Forwarded-For and get past the per-address sign-in limit |
nginx decides who the caller is, believing X-Forwarded-For and X-Forwarded-Proto only from PROXY_ADDRESSES (by default the host), and passes the API that one address; the API believes the web container alone and reads one entry |
With PROXY_ADDRESSES empty, twelve wrong sign-ins each naming another address gave ten 401 and then 429, and a caller’s https brought no HSTS. With the default, the address the host names is the one limited |
| 10 | The API wrote forge-kek.key with mode 644 |
The API makes it 600, and takes a 644 one, and any earlier key beside it, back to 600 when it reads them (FieldEncryption.cs) |
600 on a new volume; a file set to 644 was 600 after the API started again |
| 11 | The clouds’ connection strings would log the same libgssapi line as fault 3 |
GSS Encryption Mode=Disable in the modules of all three clouds |
Not run: nothing has run in a cloud. tofu validate passes |
What Is Here
| File | What It Is |
|---|---|
compose.yaml |
The five services, their networks, their volumes and their log rotation |
Dockerfile.api |
The API on the distroless .NET runtime image |
Dockerfile.worker |
The engine worker; the build verifies the pinned engine archive |
Dockerfile.web |
The built application behind an unprivileged web server |
nginx.conf |
Serves the application and passes /api, /scim and /hubs to the API |
forge-headers.conf |
The security headers of the application’s own files, the same the API sends |
forge-help-headers.conf |
The same for the help at /help/, whose policy also lets its search run WebAssembly |
forge-proxies.sh |
Run by the web image before nginx starts: writes the proxies whose forwarded headers are believed, from PROXY_ADDRESSES |
forge-worker-seccomp.json, forge-worker-seccomp.LICENSE |
The worker’s seccomp profile, Docker’s own with two rules added, and the Apache License 2.0 it comes under |
.env.example |
The settings to supply; copy to .env and fill in |
node --test tools/test reads these files as text and fails when one of the design points below, or one of the fixes above, stops being true. It starts nothing and needs no container runtime, so it is the check every change gets; the run above is the only time the files have been started.
How It Is Meant to Be Run
- Put the engine archive named in
worker/engine.lock.jsoninto.local/at the repository root. - Copy
.env.exampleto.envand generate every value. Compose readsdeploy/compose/.envby itself, besidecompose.yaml, so--env-filemay be left out. - From the repository root:
docker compose -f deploy/compose/compose.yaml --env-file deploy/compose/.env up -d --build- Open
http://<host>:8080. End TLS in front of the web container, with the host’s own web server or a load balancer. A web server on the host is believed about the caller by default (PROXY_ADDRESSES); a load balancer elsewhere is believed once its address is added there. With nothing in front, leavePROXY_ADDRESSESempty. - Back up the two volumes, and keep the copies apart:
pgdata, the database, andkeys, the API’s folder of keys. A copy of the database without the keys opens nothing that is sealed, and losing the keys loses every sealed value for good.
The First Operator
At its first start the API makes the operator operator and writes its first password to first-operator-password.txt on the keys volume (api/README.md, “The first operator, and the way back in”). The API’s image has no shell, so the file is read from a container of its own that mounts the volume and is removed when it ends, leaving no log behind:
docker run --rm -v netblueprint-registry_keys:/k:ro alpine:3.24 cat /k/first-operator-password.txtSign in on the console’s host (CONSOLE_HOST), where the console asks for a password of your own and an authenticator app. Then delete the file:
docker run --rm -v netblueprint-registry_keys:/k alpine:3.24 rm /k/first-operator-password.txtWhen every operator is locked out, operator reset writes a new first password to the same file, good for 24 hours:
docker compose -f deploy/compose/compose.yaml exec -T api dotnet NetBlueprint.Registry.Api.dll operator reset <username>All three ran on 2026-11-23 as written: the first password was read, the console asked for a password of the operator’s own and an authenticator app before it opened, the file was deleted, and operator reset wrote a new one with mode 600 and the API’s user as owner. In Git Bash on Windows, put MSYS_NO_PATHCONV=1 before each docker run: Git Bash rewrites /k/first-operator-password.txt into a Windows path, and cat then finds nothing.
The Layout Check
The worker has the browser measure a built page’s own drawing (POST /v1/layout), with Chromium’s sandbox on. The first run found it failing in the container for three reasons, each fixed on 2026-11-24 and seen working in the second run:
- User namespaces. Chromium’s sandbox makes a user namespace and, inside it, the namespaces its processes run in, and then changes its root. Docker’s default seccomp profile allows none of that to a container without
CAP_SYS_ADMINandCAP_SYS_CHROOT, which the worker drops.forge-worker-seccomp.jsonis Docker’s own profile, as Docker Engine 29.9.3 builds it in (moby/profiles,seccomp/v0.2.4, downloaded on the owner’s yes, Apache-2.0, its licence beside it), with two rules added, each markedNetBlueprint Forge: added:cloneandunsharewithoutCAP_SYS_ADMIN, andchrootwithoutCAP_SYS_CHROOT. The kernel still decides: the worker’s own processes, with no capabilities, may make a user namespace and nothing outside one. In the workerunshare -nandchrootwere still refused.compose.yamlgives the worker the profile; the other services keep Docker’s. - A home of its own. Without one Chromium’s crash reporter reached for the read-only
/home/nodeand the browser stopped. The worker now gives the browser the run’s own folder asHOME(worker/src/layout.mjs,browserEnvironment), deleted with the run. - The graphics process. Alpine’s Chromium is built on musl, which calls
pwritev2; Chromium’s own filter for its graphics process does not expect that call and kills the process until the browser gives up. The worker image setsWORKER_GPU_SANDBOX=off, which adds--disable-gpu-sandbox: the graphics process loses that filter and keeps a process of its own, and the renderer that draws the page keeps its whole sandbox. Elsewhere, the developer’s machine among them, the setting is on.
Asked of the worker in its container, the check answers with the page’s own report:
docker compose -f deploy/compose/compose.yaml exec -T worker node -e 'let t="";process.stdin.on("data",c=>t+=c).on("end",async()=>{const r=await fetch("http://127.0.0.1:5081/v1/layout",{method:"POST",headers:{"Content-Type":"application/json","X-Worker-Key":process.env.WORKER_KEY},body:JSON.stringify({model:JSON.parse(t)})});console.log(r.status,JSON.stringify((await r.json()).layout))})' < <a model's .json file>A seccomp profile in Docker’s format is for Docker and Compose. On Kubernetes a profile is placed on each node in the runtime’s own format (deploy/README.md, defaults F and G), which this one is not.
The Render Host
The diagram’s note markers and picking an element for a note need a second host name for the pages the engine builds, such as render.example.com (docs/architecture/DECISIONS.md O-116). Give it a DNS record and a certificate in the host’s own web server, as for the workspace’s name, pass it to port 8080 like the workspace, and set RENDER_HOST to it. The web container answers it on names that start with render. and passes only /r/ to the API, with no cookie either way; the workspace’s pages may then frame it. RENDER_SECRET is needed whether or not you set RENDER_HOST. Empty RENDER_HOST: everything else works, and the markers fall back to a list. Checked on 2026-11-25 in the web image’s nginx (nginx/nginx-unprivileged:stable-alpine) with these files mounted: nginx -t passes with RENDER_HOST empty and set, a value that is not a host name stops the container, the workspace’s policy names the render host in frame-src, and on the render host / and /index.html answer 404 and /r/ goes to the API. The whole stack was not built and started again; the render host itself was run against the API on a development machine.
Sign-In Registrations and the Operators’ Single Sign-On
All optional, and all variables of .env, described in .env.example. Left empty, as the example leaves them, the stack starts as before and offers passwords, passkeys, the authenticator app and each organization’s own single sign-on.
- Microsoft, Google and Apple accounts (
SIGNIN_*). The instance’s own registration with each provider;docs/architecture/sign-in-registrations.mdsays what to register. The one return address for all three ishttps://<host>/api/auth/accounts/callback. A provider is offered only when everything of its registration is in.env; half of one is ignored without a word, so check the sign-in page after a change. - The operators’ single sign-on (
OPERATOR_SSO_*), through your own OpenID Connect provider, with the return addresshttps://<CONSOLE_HOST>/api/platform/auth/sso/callback. Off while the issuer is empty. - The breach check (
PLATFORM_BREACH_CHECK):on,off, or empty for the mode’s default. - The way out. With any of these the API reaches the provider:
login.microsoftonline.comfor Microsoft;accounts.google.com,oauth2.googleapis.comandwww.googleapis.comfor Google;appleid.apple.comfor Apple; your own issuer; and, for the breach check,api.pwnedpasswords.com. The API’sfrontnetwork has a way out through the host; the network the host is on must allow it. .envnow holds these secrets too. Keep it readable by its owner alone (chmod 600). After a change,docker compose ... up -dmakes the API again with the new values.
Design Points to Keep
- The worker sits on an internal network of its own,
engine, which only the API joins. The API can reach it; it reaches nothing outside the host, neither the database nor the cache, and not the API either: the API listens on its front address alone (ASPNETCORE_URLS), since a Docker network joins its members both ways. Nor can the database and the cache open a connection to the API. - The API and the web container have fixed addresses on the front network,
<FRONT_PREFIX>.10and.11, the host being.1. So the API’s commands run withdocker compose exec:docker compose runasks for the same address again and is refused with “Address already in use”. - The database and the cache sit on a second internal network that only the API joins.
- Every container runs with a read-only file system, no added privileges and all capabilities dropped, apart from the few PostgreSQL needs to own its files. The cache starts as its image’s own user, since its entry script cannot change owners without the capabilities it is not given.
- The worker image fails to build when the engine archive does not match the sha256 in the lock file.
- No secret is in any image. All of them come from
.envat start. - The API’s folder of keys (
Assistant__KeysPath) is a volume of its own,keys, owned by the API’s user with mode 700, and every file the API writes in it is 600. It holds the Data Protection keys and the file that wraps every organization’s data key. Without it no authenticator app, single sign-on secret or organization’s AI key can be stored. It is never part of the database’s volume or its backups. - The help is built into the web image and served at
/help/, matching the release (DECISIONS.md O-44); the API image carries it too, in/app/wwwroot/help, for the routes where the API serves the application itself. - The application’s page and files carry the same security headers, content security policy included, as when the API serves them itself. They are in
forge-headers.conf, included in each location that serves files, because nginx drops a server’sadd_headerlines from any location that has one of its own. Answers of the API pass through with the API’s own headers. - Every service rotates its logs: 10 MB a file, three files. Docker’s default log driver never rotates.
- The web container is published on the loopback address only. Docker’s own rules bypass a host firewall such as ufw, so a port published on every address is open whatever the firewall says.
- Sample data is off (
Seed__Enabled=false). Outside the Development environment the API refuses to start with it on unlessSeed__AllowOutsideDevelopment=trueis set as well, because the sample people share one password. - Who the caller is, is decided once, by nginx. It believes
X-Forwarded-ForandX-Forwarded-Protoonly from the proxies inPROXY_ADDRESSES: by default the host,<FRONT_PREFIX>.1, which is where a web server on the host comes from through the published port. It passes the API one address and the scheme it believed. The API believes forwarded headers from the web container’s address alone (Proxy__KnownProxies__0) and reads that one entry (Proxy__ForwardLimit1). WithPROXY_ADDRESSESempty nobody is believed, and a caller can name no address of its own. A value that is not an address or a range stops the web container at start. - Sign-in is limited per address, by that forwarded address (
docs/architecture/DECISIONS.mdO-63): 10 failed sign-ins a minute (SIGN_IN_FAILURES_PER_MINUTE), and 60 sign-ins and 6,000 session renewals of any outcome (SIGN_IN_PERMITS_PER_MINUTE,SESSION_PERMITS_PER_MINUTE), a guard against a flood. An IPv6 caller is counted by its /64 block. If your people reach the instance from known offices, put those offices’ outgoing addresses inTRUSTED_NETWORKS(203.0.113.0/24, several apart by commas): no per-address limit applies to them, and each account still locks after five failures in a row. The console’s own limit, 10 tries a minute per address, stays.
Checks That Prove These Files
| # | Check | Pass When | 2026-11-23 |
|---|---|---|---|
| 1 | docker compose ... build |
All three images build, and the worker build prints that the engine was verified | Pass: engine: release 0.13.2 verified and unpacked (54 files). With one character of the pin changed the build stopped with the engine archive does not match the pin |
| 2 | docker compose ... up -d then docker compose ... ps |
All five services are running, and db is healthy |
Pass, after fault 1 |
| 3 | curl -s http://localhost:8080/api/health |
It answers with the database reachable and the engine release named in worker/engine.lock.json |
Pass: "status":"ok", "database":"ok", engine 0.13.2 with its sha256. The API applied all 20 releases (31 scripts) at its first start |
| 4 | Sign in, upload a model, open its page | The same flow that works with node tools/dev.mjs up works here |
Pass: set-up made the organization and printed the invitation link; the link was accepted once and refused the second time; the administrator signed in; the engine’s aws-three-tier example was added, valid with no errors, and its page (315 KB of HTML) and its content opened. check-engine then found the stored revision sound. The live channel negotiated and upgraded to a WebSocket through nginx, and the server’s ping came after 15 seconds; nginx logged that request without its query string, where the token travels |
| 5 | docker compose ... exec worker wget -qO- https://example.com |
It fails: the worker has no way out | Pass, by name and by address. The database and the cache could not reach out either, and the database’s name does not resolve from the worker. Only web publishes a port, on 127.0.0.1 |
| 6 | Restart the stack | The data is still there | Pass, with docker compose down and up -d, keeping the volumes: the model was there, and the administrator’s and the operator’s authenticator codes were accepted, so the Data Protection keys on keys outlived the containers |
| 7 | docker run --rm -v netblueprint-registry_keys:/k:ro alpine stat -c '%u %a' /k |
It prints 1654 700: the folder of keys belongs to the API’s user alone. Then add an authenticator app, restart the stack and sign in with it |
Pass: 1654 700. An authenticator app was added; a wrong code was refused (401) and the right one taken, before and after the restart |
| 8 | curl -sI http://localhost:8080/ and curl -sI http://localhost:8080/api/health |
Both carry Content-Security-Policy and X-Frame-Options, and the second carries each header once |
Pass, after faults 5 and 6. Strict-Transport-Security comes only with X-Forwarded-Proto: https, from nginx and from the API alike |
| 9 | The console’s host: curl --resolve ops.localhost:8080:127.0.0.1 http://ops.localhost:8080/api/platform/organizations, and the same on localhost |
401 on the console’s host, 404 on the workspace’s |
Pass. On the console’s host the workspace’s routes and the live channel answer 404, and its page is the console’s own build with X-Robots-Tag. No hosts file was changed: --resolve gives the name |
| 10 | Twelve wrong sign-ins from one address, then one with another forwarded address (deploy/VALIDATE.md, A13 and A14) |
Ten 401, then 429; the other address 401 |
Pass, with Retry-After. On 2026-11-24, with the host believed, as a web server on the host is: the same. With PROXY_ADDRESSES empty, twelve naming a different address each: ten 401, then 429 |
| 11 | The layout check, asked of the worker in its container: docker compose ... exec -T worker with a fetch of POST /v1/layout and X-Worker-Key, as “The layout check” says |
200 with a layout that has tabs |
Pass on 2026-11-24, twice, about 2.5 s each; /tmp was empty afterwards. Inside the worker unshare -n and chroot were still refused |
| 12 | From the worker, the cache and the database: a connection to api:8080 |
Each is refused; from web it answers |
Pass on 2026-11-24 |
| 13 | stat -c '%a %n' /k/* on the keys volume |
Every file 600 |
Pass on 2026-11-24, and a key file set to 644 by hand was 600 after the API started again |
Known Gaps
- The worker binds to the loopback address by default. In a container it listens on all addresses of its internal network because
WORKER_HOST=0.0.0.0is set, and it refuses that setting unlessWORKER_KEYis set too. In the run it listened with"keyRequired":true; the refusal without a key is tested outside a container only. - With the default
PROXY_ADDRESSES, anything that connects through the host is believed, as the host’s web server must be: on a server whereWEB_BINDstays on the loopback address that is the host’s own processes alone. Docker Desktop passes every connection to a published port through the host, so there a port published beyond the loopback address would let any caller name its address; leavePROXY_ADDRESSESempty there, or put a web server in front and name it. - The database address is fixed to the
dbcontainer. Using a managed database service needs a change tocompose.yamlfirst. The guides indeploy/aws,deploy/azureanddeploy/gcpuse the same images against each cloud’s managed services instead. - When sample data is off, the API’s
set-upcommand makes the organization and prints its first administrator’s invitation link:docker compose -f deploy/compose/compose.yaml exec -T api dotnet NetBlueprint.Registry.Api.dll set-up --organization "<name>" --administrator <address> --address https://<host>, with the stack running. It ran as written on 2026-11-24; the form withdocker compose run, which the first run used, is refused now that the API has a fixed address. The link is a secret for seven days and the command prints it on the terminal: send it to the person and clear the screen. - Backups, log shipping and TLS are the host’s job and are not described here.
- The Helm chart for Kubernetes (brief, D47) is
deploy/helm/netblueprint-forge, with the cloud routes that use it. It has been rendered, never installed. - The API connects as the database’s owner, which the
postgresimage makes a superuser. Row-level security still holds, because the API acts asforge_appon every connection (release 0004), but a separate login with fewer rights is an open decision (docs/NOTES.md). On the managed services of the three clouds the administrator login is not a superuser. - No service declares memory or processor limits. After the checks above, with one organization and one model, the API used 124 MB, the worker 68 MB, nginx 24 MB, PostgreSQL 39 MB and the cache 4 MB (
docker stats, 2026-11-23); on 2026-11-24, after two layout checks, the worker held 322 MB and the API 176 MB. Far too little load to size limits by. - The layout check runs Chromium, which uses
/dev/shm. Docker gives 64 MB, and the worker does not pass--disable-dev-shm-usage, so the worker is given 512 MB (shm_size), 128 MB for each of its four checks at once; not measured. If the check fails on large models in a container, that is the first thing to look at. - When the check is on, the worker runs four at once (
WORKER_LAYOUT_CONCURRENCY), each holding about 620 MB of Chrome while it runs: allow the worker about 4 GB (docs/reviews/load-test.md, section 3.6, measured with Chrome on Windows). - The Compose project is still called
netblueprint-registry. Renaming it renames the volumes, so it is left as it is until an installation can be moved deliberately. - The
COPY --chown=$APP_UID --chmod=700of the folder of keys relies on BuildKit, Docker’s default builder, and on Docker giving a new named volume the owner and mode of the folder it is mounted over. Check 7 proved both. - The API logs that its Data Protection key “may be persisted to storage in unencrypted form”. That is the design: the folder of keys is the instance’s secret, kept apart from the database and backed up on its own.