From 0ef9add9355ab9a402dbe6d83faa1117156ce086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hartmut=20N=C3=B6renberg?= Date: Mon, 13 Apr 2026 09:16:12 +0200 Subject: [PATCH] ci(docker-deploy): pin DATABASE_URL to unique container name to fix split-brain 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 --- docker-compose.ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index 5062498..b5e6165 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -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: