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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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:
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user