Infrastructure

Development and production

Two tiers of the same four services, on product slot 03 — and prod’s fifth, the traffic store behind the back office’s Traffic page. This is what differs between them, what must not, and how to bring either one up and prove it works.

The same shape, twice

Each tier is four services behind its own Traefik: the landing page, Mission Control, these docs, and the proxy itself. Both are served from a single origin, routed by path. Prod runs a fifth service that serves no route: Redis, the traffic store, which keeps the Traffic page’s records for at most 48 hours and is reached by the dashboard alone (D-107). Dev is retired and has none.

PathServicePrefix stripped?
/the landing page, static, via nginx — owns the origin's 404n/a
/app/Mission Control, Go + HTMXyes
/docs/these docs, pustakayes
/api/the dashboard's JSON surface — /api/healthzyes

One origin is not cosmetic: there is no CORS to configure between anything served here, and it is what lets Mission Control reference every asset, fragment and form action relatively.

Both stripped services depend on a header, and fail silently without it

Neither the dashboard nor pustaka has a base-path option. /app and /docs work solely because Traefik's stripPrefix also sets X-Forwarded-Prefix, and both read it back — the dashboard into a single <base href>, pustaka onto its root-absolute login redirects.

Replace stripPrefix with a rewrite that drops that header and you get 200 on every document and 404 on every asset. No error is logged and no status-code check sees it.

The trailing-slash redirects run before the strip, for the same reason. At /app with no slash the document base resolves one level up, so static/app.css becomes /static/app.css — which the landing page answers with its own 404, while the document itself still returns 200.

What differs, exactly

DevelopmentProduction
Hostnamedev.gaos.mfardiansyah.idgaos.mfardiansyah.id
Published port10.10.0.2:19301:8010.10.0.2:18301:80
Compose projectgaos-devgaos-prod
Internal networkgaos-dev-int · 172.30.13.0/24gaos-prod-int · 172.30.12.0/24
Shared infra networkmaster-compose-ai-dev-netmaster-compose-ai-net
ArcadeDBhttp://arcadedb-master-dev:2480http://arcadedb-master:2480
Certificate lineagegaos-devgaos
Env filesdev.dashboard.env · dev.docs.envprod.dashboard.env · prod.docs.env

A difference outside this table is a bug rather than a decision. The two compose files are deliberately the same shape, and deploy/check-stacks.sh asserts the entries that are dangerous to get wrong.

The expensive mistake is invisible

A development stack pointed at the production database starts cleanly, passes every smoke test and behaves normally. Nothing about it looks wrong until it writes something. That is why the network name and the database host are asserted mechanically rather than reviewed.

What must not differ

SettingBoth tiersWhy
GAOS_COOKIE_SECURE 1 The browser reaches both tiers over real TLS at the edge. The flag is env-driven, never derived from the scheme — these containers only ever see plain HTTP inside the tunnel, so deriving it would drop the flag in production.
GAOS_ARCADE_DB gaos Same database name in two different instances. Renaming one tier's database is how you end up with a migration that only ever ran once.
Traefik trustedIPs 10.10.0.0/24 Shared file, one list. See the real client IP — a wrong list looks perfectly healthy.

A cookie-aware client will refuse to store the session over the tunnel

That is correct. Check the Secure flag is present in Set-Cookie, defer the login round-trip to HTTPS, and do not “fix” it by turning the flag off.

Bringing a tier up

Development first, always. There is no bootstrap step in this release — no schema is applied yet — so the sequence is short:

bash
cd /home/ardi/devel/projects/gaos
./deploy/check-stacks.sh                     # the invariants a running stack hides

S=deploy/stacks/compose.dev.yaml             # then repeat with compose.prod.yaml
docker compose -f $S build
docker compose -f $S up -d
docker compose -f $S ps --format '{{.Service}}\t{{.Status}}\t{{.Ports}}'

If compose says the external network cannot be found

The infrastructure stack is down. Start it there. Never docker network create it here — that produces an empty network with the right name, and a stack that comes up and then cannot resolve anything.

Where to reach it, and where the credentials are

SurfaceDevelopmentProduction
Landing pagehttps://dev.gaos.mfardiansyah.id/https://gaos.mfardiansyah.id/
Mission Control/app/same
These docs/docs/same
Health/api/healthzsame

Gitignored files hold everything secret, split per service and per tier so the docs container never holds the database password:

FileHoldsMode
deploy/stacks/{dev,prod}.dashboard.envArcadeDB user and password600
deploy/stacks/{dev,prod}.docs.envThe docs login (off since D-093) and its cookie secret600
deploy/stacks/prod.pr-*The pull-request flow’s files: the GitHub tokens, the staging and WhatsApp logins, the pinned group, the auto-fix admin list, and the task-tracker profiles folder prod.pr-trackers/ (mode 700, one sub-folder per tracker credential, D-118). Each is mounted read-only; an empty one keeps its part off600

The compose files reference them with env_file:, not ${…} interpolation — there is no flag to forget, and a missing file is a hard error rather than a silently empty password. The committed *.env.example files document every name.

Fill them by name, one line at a time

Never cat an infrastructure .env into one of these. env_file injects every line it finds, which hands GAOS's containers every other project's credentials on that host.

If the docs login is switched back on, generate its cookie secret on the host

openssl rand -hex 32 into PUSTAKA_AUTH_SECRET. Left blank, the server invents a random one per process — so every deploy and every restart signs everyone out. Do not copy a value out of another project's compose file: a secret in version control is not a secret.

A production instance that serves a GitLab product (D-114) sets GAOS_GITLAB_HOST in its instance environment and writes the review token to deploy/stacks/prod.pr-gitlab-token (mode 600). The deploy creates that file and prod.pr-gitlab-ca.pem empty when they are absent, so an instance without GitLab is unchanged. See GitLab.

The model gateway, per tier

Once M14.2 lands, a tier that runs real work sets GAOS_MODEL_MODE=aimanager and points at ai-manager. The two secrets are files mounted into the dashboard container, never environment values and never committed; check-stacks.sh's committed-secret check (TC-013) applies to them as to every other credential.

SettingDevProd
GAOS_MODEL_MODEaimanager since 2026-11-02not yet
GAOS_AIM_URLhttp://10.10.0.4:8099 — ai-manager on rnd-v2-vpn, over WireGuard
GAOS_AIM_CHAT_AUTH_FILE, GAOS_AIM_ADMIN_KEY_FILEdeploy/stacks/<tier>.aim-chat.json and <tier>.aim-admin-key, mode 600, mounted read-only at /run/secrets/; the dashboard runs as the deploy uid so it can read them
Workspace idsgaos-<dev tenant>-*gaos-<prod tenant>-*
GAOS_RUNNERon only while acceptance runsThe owner's decision — it is the permission to spend. Unset (off) by default; passed from the deploy shell, so GAOS_RUNNER=manual on the redeploy line runs one board-chosen card at a time (D-080), and must be repeated on every redeploy
GAOS_API_ADMIN_TOKEN_FILE, GAOS_API_QA_TOKEN_FILEThe QA sync API's two bearer tokens, deploy/stacks/prod.api-admin and prod.api-qa: gaos_ and 64 hex characters, mode 600, read once at boot. An empty file disables that token; with neither the API answers 503.
GAOS_API_QA_PRODUCTSComma list of product ids (for example p-6) the QA token may reach. Unset reaches nothing. The id is known only after the product seed has run, so: deploy, seed, set it, restart.
GAOS_QA_URL, GAOS_QA_TOKEN_FILEWhere GAOS calls the QA tools from the two sync buttons, and the token it sends (prod.api-qa-out, empty until the QA tools implement their side). https, or http to a tunnel IP literal. Unset leaves the buttons disabled.
GAOS_QA_ORIGINThe QA tool's public host name (qa.example.org), recorded as the origin of every answer it sends (D-083). Unset falls back to the host of GAOS_QA_URL when that is a name; the tunnel URL is an IP, so set it on the redeploy line.
BRAIN_TOWN_ENABLED, BRAIN_TOWN_URL, BRAIN_TOWN_PUBLIC_PRODUCTS, BRAIN_TOWN_TOKEN_FILEThe optional Brain Town feed (D-086). Off unless BRAIN_TOWN_ENABLED=true is on the redeploy line (repeat it on every redeploy, like GAOS_RUNNER); the token is the file deploy/stacks/prod.bt-token (mode 600, must exist, empty = off), never an environment variable.
GAOS_API_CLIENTS_FILEOptional: a file naming further machine clients, one per line — name, kind, origin, token file, products, and since v0.61.0 an optional capability list inbox,tasks (Adding a client). Prod mounts the directory deploy/stacks/prod.api-clients/ (mode 700) read-only and points this at its clients file; deploy/README.md has the steps.
GAOS_API_MAX_OPEN, GAOS_API_DAILYThe external tasks API's limits per client: unfinished cards (default 5) and cards created per UTC day (default 20, cancelled ones included). Passed from the deploy shell.
GAOS_API_AUTORUN_PRODUCTS, GAOS_API_AUTORUN_DAILYUnder GAOS_RUNNER=manual, the comma list of products whose API and bundle cards GAOS starts without an operator, and the most such starts per product per UTC day (default 20). Empty (off) by default; an amendment of BR-56 (D-099).

The tenant is part of the workspace id, so two tiers or instances share no product's workspace even though they share one ai-manager — provided their tenants differ. Product ids restart at p-1 in every database, so every instance that shares ai-manager sets its own GAOS_AIM_TENANT (Several GAOS instances, D-122). The full list of variables is in The gateway §configuration.

Verifying over the tunnel

Nothing is bound publicly. One row per tier, and it must read 10.10.0.2 — never 0.0.0.0:

bash
ss -ltnp | grep -E ':(18301|19301)'
curl -sS --connect-timeout 3 "http://$LAN_IP:19301/"    # LAN_IP = the VM's LAN address; must be REFUSED

Through the tunnel, from the edge — the real test:

bash
ssh clino "curl -sS -H 'Host: dev.gaos.mfardiansyah.id' http://10.10.0.2:19301/api/healthz"
ssh clino "curl -sS -H 'Host: gaos.mfardiansyah.id'     http://10.10.0.2:18301/api/healthz"
# {"ok":true,"database":"gaos","store":"memory",...}
What you getWhat it means
502The dashboard container is not running at all.
503 · "database":"unreachable"The ArcadeDB leg is wrong — network name, container alias or credentials.
"database":"unconfigured", ok:trueNo GAOS_ARCADE_URL is set. Correct for the local stack, wrong for a deployed tier.

Then the routing. / answers 200 from the landing page; /app and /docs both answer 301 to their trailing-slash form.

Check the base href actually survived the strip

This is the failure that returns 200 on the document and 404 on every asset:

bash
ssh clino "curl -sS -H 'Host: gaos.mfardiansyah.id' \
  http://10.10.0.2:18301/app/" | grep -o '<base href="[^"]*">'
# must read <base href="/app/"> — NOT <base href="/">

Finally, the real client IP. Traefik believes X-Forwarded-For only from a peer in its trust list; from anyone else it discards the header and substitutes the peer's own address — so a wrong list collapses every caller on earth into one identity while everything looks healthy. The procedure is on the overview page, and it is not optional.