From 56853bbdeb6fe74d1d71f6e6e8caa1a1d6e8aa33 Mon Sep 17 00:00:00 2001 From: Jose Selesan Date: Mon, 19 Oct 2026 13:08:19 -0300 Subject: [PATCH] fix(deploy): let the API reach Dokploy's database again Since 815dcc3 the api service only joined the stack-private `internal` network, so it could no longer resolve the database host on `dokploy-network` and `prisma migrate deploy` failed with P1001. api joins `dokploy-network` again, only to reach the database. nginx still proxies to the `superlist-api` alias, which is declared only on `internal`, so the shared network never routes our traffic elsewhere. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 5 +++-- docker-compose.yml | 13 ++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 7c5f79a..bc70ea3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -90,8 +90,9 @@ Run from the repo root. Verification order is `build`, then `lint` → `typechec rename never changes the TypeScript API. Default constraint/index names follow the mapped names, so do not set `map:` unless you have a reason to. - **Deployment: Docker Compose on Dokploy** (`docker-compose.yml` at the repo root). Two services, `api` and - `web`; the database is external (Dokploy's). Only `web` joins the external `dokploy-network` for Traefik; - `web` and `api` share the stack-private `internal` network, where the API has the alias `superlist-api` + `web`; the database is external (Dokploy's). Both join the external `dokploy-network` — `web` for Traefik, + `api` to reach the database (without it `prisma migrate deploy` fails with P1001). nginx reaches the API + over the stack-private `internal` network, where it has the alias `superlist-api`, declared only there (never rely on a generic service name on the shared network: other projects can answer to it). The `api` image (`apps/api/Dockerfile`) builds the Bun bundle and runs `prisma migrate deploy` before `bun run start`; the `web` image (`apps/web/Dockerfile`) builds with Vite and serves `dist/` with diff --git a/docker-compose.yml b/docker-compose.yml index e882c0f..7bc2684 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,10 @@ # Dokploy deployment: the API and the static frontend behind nginx. -# The database is external (Dokploy's). Only `web` joins the shared -# `dokploy-network` so Dokploy's Traefik can reach it via the Domains UI; the -# API talks to nginx over the stack-private `internal` network, under the -# unique alias `superlist-api`, so no other project on `dokploy-network` -# answering to `api` can ever receive our traffic. +# The database is external (Dokploy's) and lives on the shared +# `dokploy-network`, so both services join it: `web` so Dokploy's Traefik can +# reach it via the Domains UI, `api` so it can reach the database. nginx talks +# to the API over the stack-private `internal` network, under the unique alias +# `superlist-api` (declared only there), so no other project on +# `dokploy-network` answering to `api` can ever receive our traffic. services: api: build: @@ -29,6 +30,8 @@ services: internal: aliases: - superlist-api + # Only to reach Dokploy's database; nginx never resolves the API here. + dokploy-network: healthcheck: test: [