fix(deploy): isolate web→api traffic on a private network
nginx proxied to `api:4100` over the shared `dokploy-network`, where the generic name `api` resolved to more than one container (a stale one from a previous deploy, or another project's service). nginx pinned those IPs at startup and round-robined across them, so requests hit a refused upstream and could reach a foreign container. - api now lives only on a stack-private `internal` network, aliased as `superlist-api`; only web joins `dokploy-network` for Traefik. - nginx proxies via a variable with Docker's resolver (127.0.0.11, valid=10s), so API redeploys never leave it on a stale IP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
# Dokploy deployment: the API and the static frontend behind nginx.
|
||||
# The database is external (Dokploy's), and the containers join the shared
|
||||
# `dokploy-network` so Dokploy's Traefik can reach them via the Domains UI.
|
||||
# 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.
|
||||
services:
|
||||
api:
|
||||
build:
|
||||
@@ -23,7 +26,9 @@ services:
|
||||
expose:
|
||||
- "4100"
|
||||
networks:
|
||||
- dokploy-network
|
||||
internal:
|
||||
aliases:
|
||||
- superlist-api
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
@@ -52,6 +57,7 @@ services:
|
||||
expose:
|
||||
- "80"
|
||||
networks:
|
||||
- internal
|
||||
- dokploy-network
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO", "/dev/null", "http://127.0.0.1/"]
|
||||
@@ -61,5 +67,6 @@ services:
|
||||
start_period: 10s
|
||||
|
||||
networks:
|
||||
internal:
|
||||
dokploy-network:
|
||||
external: true
|
||||
|
||||
Reference in New Issue
Block a user