跳到主要内容

Deployment Topology

Status

Active

Date

2026-04-28

Owners

  • Platform Backend

Last Verified Commit

56362a7a

Local Stack Source

The canonical local deployment topology is the Compose stack in:

  • servers_v2/docker-compose.yml

The stack is contract-tested by:

  • servers_v2/tests/test_compose_contract.py

Infrastructure Services

ServicePurposeLocal Port
postgresshared PostgreSQL runtime5433
redisshared Redis runtime and stream transport6381
migrateone-shot migration bootstrapnone

Application Services

ServiceLocal PortHealth Mode
gateway8080/health
player_service8010/health
wallet_service8011/health
game_service8012/health
rolling_service8013/health
promotion_service8014/health
agent_service8015/health
admin_service8016/health
recon_service8017/health

Worker Services

WorkerPurposeHealth Mode
wallet_workerwallet outbox publishing + hourly ledger-vs-balance reconciliationheartbeat file + readiness
rolling_workerwallet-event consumer, outbox, expiry, completion retryheartbeat file + loop freshness
promotion_workerwallet-event consumer, settlement scheduler, saga recoveryheartbeat file + scheduler readiness
agent_workeragent outbox publishingheartbeat file
admin_workerscheduled admin jobsheartbeat file + scheduler job health
recon_workerPushbullet/Telegram/recon loopsheartbeat file + loop freshness
player_workerplayer outbox publishing (ENABLE_OUTBOX_POLLER=true); player_service API has it disabled and depends_on: player_worker to guarantee the worker is healthy before trafficheartbeat file

Current Split-Worker Rule

Services with dedicated background work run that work in a standalone worker so APIs can scale independently.

There are currently no exceptions: player_service runs its outbox loop in a dedicated player_worker (compose: player_service API has ENABLE_OUTBOX_POLLER: "false"; player_worker has it "true").

Environment Files

Local stack usage is designed around:

  • servers_v2/.env.compose.example
  • servers_v2/.env.compose.local

Sensitive values are intentionally env-driven and must not be committed into the Compose file.

Multi-Brand Mode

Per ADR-009, every brand runs on the same Compose stack:

  • one postgres, one redis, one set of application services and workers
  • brand identity is resolved per request from the request domain (or, for game callbacks, from the namespaced outbound account); no per-brand process duplication
  • a MULTI_BRAND_ENFORCEMENT env var (off / observe / enforce) controls Gateway's JWT-vs-domain brand mismatch behavior; the repository compose default is now enforce, with observe reserved for explicit soak/rehearsal overrides

Use the local-stack runbook:

  • docs/runbooks/local-docker/local-docker-full-stack.md