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>
69 lines
4.1 KiB
YAML
69 lines
4.1 KiB
YAML
# Sygna on a managed PostgreSQL database (the family's shared one, or any Postgres 16/17 reached
|
|
# over a network): an override for docker-compose.yml.
|
|
#
|
|
# DREDD_CORE_TOKEN=<read-only Gitea token> \
|
|
# docker compose -f docker-compose.yml -f docker-compose.managed-db.yml up -d --build
|
|
#
|
|
# The database lives elsewhere, so the local postgres service is switched off and nothing waits
|
|
# for it; migrate (+seed) and backend otherwise run as in docker-compose.yml. Before the
|
|
# first start, Sygna must be provisioned in the database (schema sygna, roles sygna_migrator /
|
|
# sygna_app) and .env must carry its URLs: the provider's host and port (through a pooler, its
|
|
# session mode, never transaction mode), <role>.<tenant> user names where the pooler wants them,
|
|
# URL-encoded passwords and ?sslmode=verify-full&sslrootcert=/run/certs/db-ca.crt. Runbook:
|
|
# db/managed/README.md.
|
|
#
|
|
# Pass -f with BOTH files on every command (ps, logs, run, down), or Compose falls back to the
|
|
# local-postgres stack. The !reset tag needs a Docker Compose release that implements the merge
|
|
# rules documented at docs.docker.com/reference/compose-file/merge/ (2.24.4 or later).
|
|
services:
|
|
postgres:
|
|
# Off: a profile nobody activates keeps the service defined but never starts it.
|
|
profiles: ["local-postgres"]
|
|
|
|
migrate:
|
|
# docker-compose.yml makes migrate wait for the local postgres healthcheck; there is none here.
|
|
# (backend depends only on migrate, so it keeps its ordering.)
|
|
# It does not retry either: some providers ban the host's IP after a few failed logins in a
|
|
# row, so a wrong password must fail once and loudly.
|
|
depends_on: !reset null
|
|
# Nothing here switches TLS on: Sygna's settings refuse, before connecting, a DATABASE_URL or
|
|
# MIGRATION_DATABASE_URL for a host that is not local without sslmode=verify-full (config.py,
|
|
# the family's one TLS rule; DB_LOCAL_HOSTS in .env is the only exception). That covers
|
|
# Alembic, the seed and the one-shot restore, which all run in migrate, and the backend.
|
|
#
|
|
# DB_APP_ROLE is deliberately NOT set here: a `${DB_APP_ROLE:-...}` entry would take a value
|
|
# exported in the operator's shell over the .env that deploy_check.py validates, and 0002
|
|
# would grant Sygna's tables to whatever role that names. It comes from env_file (.env) only.
|
|
volumes:
|
|
- &managed_db_ca
|
|
# The provider's root CA (downloaded from its dashboard), read-only, at the path the
|
|
# URLs' sslrootcert names. create_host_path: false makes a missing file an error at
|
|
# start-up instead of an empty directory in its place.
|
|
type: bind
|
|
source: ${MANAGED_DB_CA_FILE:-./certs/db-ca.crt}
|
|
target: /run/certs/db-ca.crt
|
|
read_only: true
|
|
bind:
|
|
create_host_path: false
|
|
|
|
backend:
|
|
environment:
|
|
# The runtime pool per backend process. Every app in the shared database draws on one
|
|
# connection limit: size these with the budget in db/managed/README.md.
|
|
DB_POOL_SIZE: ${DB_POOL_SIZE:-5}
|
|
DB_MAX_OVERFLOW: ${DB_MAX_OVERFLOW:-10}
|
|
# The long-running backend holds no migrator credentials: this empty value overrides the
|
|
# MIGRATION_DATABASE_URL that env_file loads from .env (migrate keeps it). The console's
|
|
# restore (Ustawienia Sygny -> Poczta, integracje i kopie) is then refused with a clear message; restore
|
|
# with the one-shot instead:
|
|
# docker compose -f docker-compose.yml -f docker-compose.managed-db.yml stop backend
|
|
# docker compose -f docker-compose.yml -f docker-compose.managed-db.yml run --rm migrate \
|
|
# python -m app.restore <backup name> --yes
|
|
# docker compose -f docker-compose.yml -f docker-compose.managed-db.yml start backend
|
|
# Opt in to the console's restore instead: set BACKEND_MIGRATION_DATABASE_URL in .env to the
|
|
# migrator URL. The running backend then holds credentials that can rewrite the audit log
|
|
# and delete conflict checks — the very thing the runtime role is built not to have.
|
|
MIGRATION_DATABASE_URL: ${BACKEND_MIGRATION_DATABASE_URL:-}
|
|
volumes:
|
|
- *managed_db_ca
|