ci(docker-deploy): pin DATABASE_URL to unique container name to fix split-brain
CI / Architecture Guardrails (push) Successful in 3m13s
CI / Typecheck (push) Successful in 3m39s
CI / Lint (push) Successful in 4m15s
CI / Unit Tests (push) Successful in 7m10s
CI / Build (push) Successful in 7m8s
CI / E2E Tests (push) Successful in 4m50s
CI / Fresh-Linux Docker Deploy (push) Successful in 5m1s
CI / Release Images (push) Successful in 5m10s
Nightly Security / Dependency Audit (push) Successful in 1m38s
CI / Assistant Split Regression (push) Successful in 5m18s

The app container is attached to both `default` and `gitea_gitea` networks.
Both have a container answering to "postgres" (ours on default, Gitea's
core on gitea_gitea). Docker's embedded DNS returns IPs from all attached
networks, so the app startup script's `prisma db push` and the seed
script's `prisma.user.count()` cached different IPs and hit different
postgres instances. The seed then saw "table public.users does not exist"
even though `/api/health` reported db:ok.

Override DATABASE_URL and REDIS_URL in docker-compose.ci.yml to use the
unique compose container names (capakraken-postgres-1, capakraken-redis-1)
so resolution is unambiguous.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-13 09:16:12 +02:00
parent bb117e9179
commit 0ef9add935
+12
View File
@@ -24,6 +24,18 @@ services:
networks:
- default
- gitea_gitea
# Even with postgres NOT attached to gitea_gitea, the app container's DNS
# for "postgres" still returns ambiguous results: Gitea's core stack on
# gitea_gitea has its own container named "postgres", and Docker's
# embedded DNS resolves bare names against ALL attached networks. Result:
# the app's startup script's `prisma db push` and the seed script's
# `prisma.user.count()` may cache different IPs and end up on different
# DBs (one with our schema, one without — Gitea's). Pin DATABASE_URL and
# REDIS_URL to the unique compose container names so resolution is
# unambiguous regardless of attached networks.
environment:
DATABASE_URL: postgresql://capakraken:capakraken_dev@capakraken-postgres-1:5432/capakraken
REDIS_URL: redis://capakraken-redis-1:6379
networks:
gitea_gitea: