Publish the standalone console on :8041, the family's port for this app
The family numbers its ports app / db / static, twenty apart per app (Galena 8012/8014/8021, Sygna 8032/8034/8041, Compass 8052/8054/8061, Counsel 8072/8074/8081), so the stacks run side by side on one machine; :80 collides with a sibling stack on the first `up`. On the platform the modules publish nothing and Atrium's front door alone keeps :80. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -8,7 +8,7 @@
|
||||
# Core. Defaults fail closed: production hides error detail and enables Secure cookies.
|
||||
# Set development explicitly for local plain-HTTP work.
|
||||
APP_ENV=production
|
||||
APP_BASE_URL=http://localhost
|
||||
APP_BASE_URL=http://localhost:8041
|
||||
|
||||
# Where this module is mounted on the platform: /sygna. Empty = standalone, at the root of its
|
||||
# own host. Whatever is set here reaches uvicorn as --root-path too, and the front door must
|
||||
@@ -186,7 +186,7 @@ GALENA_EMBED=false
|
||||
|
||||
# ── The edge (no reverse proxy) ──────────────────────────────────────────────
|
||||
# The backend serves the console and sets its own security headers; docker-compose.yml publishes it
|
||||
# on :80, plain HTTP. For TLS put your own terminator in front, or run Sygna on the platform.
|
||||
# on :8041, plain HTTP. For TLS put your own terminator in front, or run Sygna on the platform.
|
||||
#
|
||||
# Which upstream IPs uvicorn trusts for X-Forwarded-For / X-Forwarded-Proto, so the real client IP
|
||||
# lands in the audit log. Empty = loopback only (the image's default), right for this stack, where
|
||||
|
||||
+12
-12
@@ -339,12 +339,12 @@ jobs:
|
||||
run: docker compose up -d --build
|
||||
|
||||
- name: Wait for readiness on the published port
|
||||
# The backend starts only once the migration has completed, and it is published on :80
|
||||
# The backend starts only once the migration has completed, and it is published on :8041
|
||||
# itself (no proxy) — so one successful deep response here proves the whole ordering:
|
||||
# postgres healthy → migrate + seed → backend ready.
|
||||
run: |
|
||||
for i in $(seq 1 60); do
|
||||
if curl -fsS "http://localhost/healthz?deep=1" >/dev/null 2>&1; then
|
||||
if curl -fsS "http://localhost:8041/healthz?deep=1" >/dev/null 2>&1; then
|
||||
echo "ready after ~$((i * 5))s"; exit 0
|
||||
fi
|
||||
sleep 5
|
||||
@@ -357,11 +357,11 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
echo "--- liveness and readiness"
|
||||
curl -fsS http://localhost/healthz
|
||||
curl -fsS "http://localhost/healthz?deep=1"
|
||||
curl -fsS http://localhost:8041/healthz
|
||||
curl -fsS "http://localhost:8041/healthz?deep=1"
|
||||
|
||||
echo "--- the console is served, with its security headers"
|
||||
headers=$(curl -fsSI http://localhost/)
|
||||
headers=$(curl -fsSI http://localhost:8041/)
|
||||
echo "$headers" | grep -qi "content-security-policy" || { echo "::error::no CSP on the console"; exit 1; }
|
||||
echo "$headers" | grep -qi "x-frame-options: DENY" || { echo "::error::console is frameable"; exit 1; }
|
||||
echo "$headers" | grep -qi "referrer-policy: same-origin" || { echo "::error::no Referrer-Policy"; exit 1; }
|
||||
@@ -370,25 +370,25 @@ jobs:
|
||||
if echo "$headers" | grep -qi "^server:"; then echo "::error::Server header leaked"; exit 1; fi
|
||||
|
||||
echo "--- a deep link survives a reload (SPA fallback), the API never falls to the console"
|
||||
curl -fsS http://localhost/matters/1 | grep -q "<title>Sygna" || { echo "::error::no SPA fallback"; exit 1; }
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' http://localhost/api/v1/nope)
|
||||
curl -fsS http://localhost:8041/matters/1 | grep -q "<title>Sygna" || { echo "::error::no SPA fallback"; exit 1; }
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8041/api/v1/nope)
|
||||
[ "$code" = "404" ] || { echo "::error::unknown API path answered $code"; exit 1; }
|
||||
curl -s http://localhost/api/v1/nope | jq -e '.status == 404' >/dev/null || { echo "::error::unknown API path is not a problem response"; exit 1; }
|
||||
curl -fsS http://localhost/ | grep -q "<title>Sygna" || { echo "::error::console did not render"; exit 1; }
|
||||
curl -s http://localhost:8041/api/v1/nope | jq -e '.status == 404' >/dev/null || { echo "::error::unknown API path is not a problem response"; exit 1; }
|
||||
curl -fsS http://localhost:8041/ | grep -q "<title>Sygna" || { echo "::error::console did not render"; exit 1; }
|
||||
|
||||
echo "--- log in as the seeded administrator"
|
||||
token=$(curl -fsS -X POST http://localhost/api/v1/auth/login \
|
||||
token=$(curl -fsS -X POST http://localhost:8041/api/v1/auth/login \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"email":"admin@example.com","password":"ci-admin-password-1"}' | jq -r .token)
|
||||
[ -n "$token" ] && [ "$token" != "null" ] || { echo "::error::login returned no token"; exit 1; }
|
||||
|
||||
echo "--- the seeded demo firm is really there"
|
||||
matters=$(curl -fsS -H "Authorization: Bearer $token" http://localhost/api/v1/matters | jq length)
|
||||
matters=$(curl -fsS -H "Authorization: Bearer $token" http://localhost:8041/api/v1/matters | jq length)
|
||||
echo "matters: $matters"
|
||||
[ "$matters" -ge 1 ] || { echo "::error::seed did not run"; exit 1; }
|
||||
|
||||
echo "--- an unauthenticated request is refused"
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' http://localhost/api/v1/matters)
|
||||
code=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8041/api/v1/matters)
|
||||
[ "$code" = "401" ] || { echo "::error::expected 401, got $code"; exit 1; }
|
||||
|
||||
- name: The least-privilege roles hold inside the container
|
||||
|
||||
@@ -572,7 +572,7 @@ BOOTSTRAP_ADMIN_PASSWORD=… python scripts/walkthrough.py # drive the whole p
|
||||
Galena's origin only when `GALENA_EMBED` is on.
|
||||
- **No Caddy, anywhere.** On the platform Atrium's backend is the front door and forwards
|
||||
`/sygna/*` here with the prefix stripped (uvicorn's `--root-path "$ROOT_PATH"` puts it back);
|
||||
standalone, `docker-compose.yml` publishes the backend on :80 with nothing in front. The backend
|
||||
standalone, `docker-compose.yml` publishes the backend on :8041 with nothing in front. The backend
|
||||
is its own edge (`app/edge.py`, wired in `main.py`): it serves the console (`frontend/`,
|
||||
`/frontend` in the image via the `frontend` build context) at `/` LAST, behind
|
||||
`ConsoleUnlessApi`, so `/api/*` and `/healthz` never fall to it (unknown → 404 problem, wrong
|
||||
@@ -687,7 +687,7 @@ has to be **provisioned** with `--identity-schema` before the hub grants any tie
|
||||
schema, and `USAGE` comes from provisioning. db/managed/README.md §4a has the sequence.
|
||||
|
||||
**The container stack runs in CI** (`compose-smoke`, 2026-09-12): the image builds, compose brings
|
||||
postgres → migrate+seed → backend (published on :80) up in order, and the job logs in through
|
||||
postgres → migrate+seed → backend (published on :8041) up in order, and the job logs in through
|
||||
that port, reads the seeded matters, checks the console's security headers, the SPA fallback and
|
||||
that an unknown API path is a 404 problem rather than the console, and confirms from inside
|
||||
the database container that the `app` role is refused on `audit_log` and `conflict_check`. It is
|
||||
|
||||
@@ -55,7 +55,7 @@ cp .env.example .env # then edit the passwords
|
||||
docker compose up -d --build
|
||||
```
|
||||
|
||||
Postgres → migrate (+seed) → backend on `:80`. There is no reverse proxy: the backend serves the
|
||||
Postgres → migrate (+seed) → backend on `:8041` (the family numbers ports app / db / static per app — Sygna 8032 / 8034 / 8041 — so sibling stacks run side by side). There is no reverse proxy: the backend serves the
|
||||
API, the console and its own security headers, and is the only published service; the database is
|
||||
expose-only. For HTTPS put your own TLS terminator in front (and set `FORWARDED_ALLOW_IPS` to its
|
||||
address), or run Sygna as a module of the platform, where Atrium is the front door. `FRAME_ANCESTORS`
|
||||
|
||||
@@ -27,7 +27,7 @@ class Settings(BaseSettings):
|
||||
# Core — defaults fail-closed (production hides error detail + enables Secure cookies).
|
||||
# Set APP_ENV=development explicitly for local plain-HTTP work.
|
||||
app_env: str = "production"
|
||||
app_base_url: str = "http://localhost"
|
||||
app_base_url: str = "http://localhost:8041"
|
||||
|
||||
# Where this module is mounted on the platform — `/sygna` — or empty when Sygna runs
|
||||
# standalone at the root of its own host. The SAME value is handed to uvicorn as
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
"""What Caddy used to do in front of this backend: security headers, the body cap, the console.
|
||||
|
||||
The platform no longer runs Caddy. Atrium's backend is the front door and forwards `/sygna/*` here
|
||||
with the prefix stripped (exactly as `handle_path /sygna/*` did), and a standalone install runs
|
||||
uvicorn on :80 with nothing in front. Either way this process now answers for everything a browser
|
||||
with the prefix stripped (exactly as `handle_path /sygna/*` did), and a standalone install publishes
|
||||
uvicorn on host port 8041 with nothing in front. Either way this process now answers for everything a browser
|
||||
gets, so the rules Sygna's Caddyfile applied live here, unchanged in substance. Same shape as
|
||||
Counsel Scorecard's `app/edge.py`.
|
||||
|
||||
|
||||
@@ -85,9 +85,13 @@ check("condition: service_completed_successfully" in compose,
|
||||
check("condition: service_healthy" in compose,
|
||||
"nothing waits on the postgres healthcheck",
|
||||
"migrate waits for a healthy postgres")
|
||||
check('ports: ["80:8000"]' in compose and compose.count("ports:") == 1,
|
||||
"expected only the backend published (80:8000) and postgres expose-only",
|
||||
"only the backend is published; postgres is expose-only")
|
||||
# ── host ports: the family's app / db / static trio ───────────────────────────
|
||||
# Galena 8012/8014/8021, Sygna 8032/8034/8041, Compass 8052/8054/8061, Counsel 8072/8074/8081 —
|
||||
# so the stacks run side by side. Taking :80 back would collide with a sibling on the first `up`.
|
||||
check('ports: ["8041:8000"]' in compose and compose.count("ports:") == 1,
|
||||
"expected only the backend published on 8041 (8041:8000, the family's console port for Sygna; "
|
||||
":80 collides with a sibling stack) and postgres expose-only",
|
||||
"only the backend is published, on 8041; postgres is expose-only")
|
||||
check("caddy" not in compose.lower() and not (ROOT / "Caddyfile").exists(),
|
||||
"a Caddy service or Caddyfile is back — the backend is its own edge (app/edge.py)",
|
||||
"no reverse proxy in the stack; the backend is its own edge")
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
The backend now serves its own console, sets its own security headers and answers /healthz, both as
|
||||
a platform module (Atrium forwards /sygna/* with the prefix stripped, uvicorn re-adds it via
|
||||
--root-path) and standalone (uvicorn on :80, nothing in front).
|
||||
--root-path) and standalone (uvicorn published on :8041, nothing in front).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
+9
-2
@@ -1,4 +1,4 @@
|
||||
# Sygna stack: postgres → migrate (+seed) → backend on :80.
|
||||
# Sygna stack: postgres → migrate (+seed) → backend on :8041.
|
||||
# No reverse proxy: the backend serves the API, the console and its own security headers, and is
|
||||
# the only service published to the host; postgres is expose-only. For TLS put your own terminator
|
||||
# in front (and list its address in FORWARDED_ALLOW_IPS below), or run Sygna as a module of the
|
||||
@@ -10,6 +10,13 @@
|
||||
# What they share is the package (dredd-core) and, from the identity stage, exactly two tables —
|
||||
# never each other's domain data (PLAN.md §3.4).
|
||||
#
|
||||
# ── Host ports ────────────────────────────────────────────────────────────────
|
||||
# The family numbers its development ports app / db / static, twenty apart per app:
|
||||
# Galena 8012 / 8014 / 8021, Sygna 8032 / 8034 / 8041, Compass 8052 / 8054 / 8061,
|
||||
# Counsel 8072 / 8074 / 8081. The stacks therefore run side by side; taking :80 would collide
|
||||
# with a sibling stack on the first `up`. Sygna's console + API are published once, on 8041.
|
||||
# On the platform the modules publish nothing and Atrium's front door keeps :80.
|
||||
#
|
||||
# BUILDING NEEDS A CREDENTIAL. dredd-core is a private repository, so the image build clones it
|
||||
# with DREDD_CORE_TOKEN (a fine-grained, read-only GitHub PAT) supplied as a BuildKit secret —
|
||||
# never a build arg, which would be readable in `docker history` of any pushed image:
|
||||
@@ -59,7 +66,7 @@ services:
|
||||
secrets: [dredd_core_token]
|
||||
image: sygna-backend:local
|
||||
env_file: .env
|
||||
ports: ["80:8000"]
|
||||
ports: ["8041:8000"]
|
||||
environment:
|
||||
# Nothing sits in front of the backend here, so no hop may set X-Forwarded-For: empty = the
|
||||
# image's default (loopback only), and the audit log records the real peer address. Behind
|
||||
|
||||
Reference in New Issue
Block a user