The Dockerfiles still rewrote credentials for github.com only, so the build token never reached Gitea and installs worked only while dredd-core was public. Rewrite http://77.216.148.202:3000/ instead, give every workflow that pip-installs the same rewrite (org secret DREDD_CORE_TOKEN, the read-only haski-reader token), and drop the GitHub PAT leftovers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
102 lines
4.5 KiB
YAML
102 lines
4.5 KiB
YAML
# 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
|
|
# platform, where Atrium is the front door.
|
|
#
|
|
# Runs alongside Galena's stack — different volumes, different database. This file is the
|
|
# STANDALONE stack; on the platform the modules sit behind Atrium's backend at one origin (the hub's
|
|
# deploy tree), each still its own process with its own schema and its own least-privilege roles.
|
|
# 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 read-only Gitea access token) supplied as a BuildKit secret —
|
|
# never a build arg, which would be readable in `docker history` of any pushed image:
|
|
#
|
|
# DREDD_CORE_TOKEN=<read-only Gitea token> docker compose up -d --build
|
|
services:
|
|
postgres:
|
|
image: postgres:16
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB:-sygna}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-change_me_super}
|
|
DB_APP_PASSWORD: ${DB_APP_PASSWORD:-change_me_app}
|
|
DB_MIGRATOR_PASSWORD: ${DB_MIGRATOR_PASSWORD:-change_me_migrator}
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
- ./db/init:/docker-entrypoint-initdb.d:ro
|
|
expose: ["5432"]
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres -d ${POSTGRES_DB:-sygna}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 20
|
|
|
|
migrate:
|
|
build:
|
|
context: ./backend
|
|
additional_contexts:
|
|
frontend: ./frontend
|
|
secrets: [dredd_core_token]
|
|
image: sygna-backend:local
|
|
env_file: .env
|
|
command: sh -c "alembic upgrade head && python -m app.seed"
|
|
restart: "no"
|
|
volumes:
|
|
- sygna-data:/data
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
# The console (../frontend) is copied into the image from this named context
|
|
# (backend/Dockerfile: COPY --from=frontend).
|
|
additional_contexts:
|
|
frontend: ./frontend
|
|
secrets: [dredd_core_token]
|
|
image: sygna-backend:local
|
|
env_file: .env
|
|
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
|
|
# your own TLS terminator, set its address or subnet instead (never `*`).
|
|
FORWARDED_ALLOW_IPS: ""
|
|
# No `command:` — backend/Dockerfile's CMD is the one place uvicorn's flags live.
|
|
# Readiness, not liveness: `?deep=1` runs SELECT 1, so a container that is up but cannot
|
|
# reach the database reports unhealthy instead of quietly accepting traffic it cannot serve.
|
|
# Python rather than curl or wget — the slim image has neither, and a healthcheck that always
|
|
# fails is worse than none.
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c",
|
|
"import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8000/healthz?deep=1', timeout=4).status == 200 else 1)"]
|
|
interval: 15s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 20s
|
|
volumes:
|
|
- sygna-data:/data
|
|
depends_on:
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
|
|
volumes:
|
|
pgdata:
|
|
sygna-data:
|
|
|
|
secrets:
|
|
# Read from the environment of whoever runs `docker compose build`, and used only by the
|
|
# build stage's one `pip install`. Nothing at runtime needs it, so no running container gets it.
|
|
dredd_core_token:
|
|
environment: DREDD_CORE_TOKEN
|