web: make the nginx resolver configurable so /api works off Docker
The /api location re-resolves BACKEND on every request, which needs a resolver address, and that address was hardcoded to 127.0.0.11 — Docker's embedded DNS. Nothing listens there on another runtime, and an unreachable resolver does not fail fast: every /api request hangs until it times out, with nothing in the error log to say why. On Kubernetes that means the app shell loads and the whole API is dead. RESOLVER now carries it, defaulting to 127.0.0.11 so Docker and every existing compose file are unchanged. Kubernetes sets it to the kube-dns service address; Podman to whatever its network provides. Documented next to the four other render-time settings in SELF_HOSTING.md, since it belongs to the same "fitting it into an existing stack" problem.
This commit is contained in:
1 parent
5c2005e81f
commit
2df725de84
4 files changed
+26
-5
No files matched your search
@@ -169,9 +169,17 @@ WEB_PORT=8080 # host port — what you browse to
|
||||
NGINX_PORT=80 # port the web container listens on, inside the container
|
||||
BACKEND=api # name of the API service that /api is proxied to
|
||||
PORT=3000 # port the API listens on; web proxies to the same value
|
||||
RESOLVER=127.0.0.11 # DNS nginx resolves BACKEND with — Docker's, unless you are not on Docker
|
||||
SESSION_DAYS=90 # how long a sign-in lasts
|
||||
```
|
||||
|
||||
`RESOLVER` only matters off Docker. nginx re-resolves `BACKEND` on every `/api` request so a
|
||||
recreated API container does not leave it proxying to a dead IP, and `127.0.0.11` is where
|
||||
Docker answers those lookups. Nothing listens there on another runtime, and an unreachable
|
||||
resolver does not fail fast — every `/api` request hangs until it times out. On Kubernetes set
|
||||
it to the cluster DNS service address (`kubectl -n kube-system get svc kube-dns`, commonly
|
||||
`10.96.0.10`); under Podman, to whatever its network provides.
|
||||
|
||||
The web image renders its nginx config from these when the container starts, so they take effect
|
||||
on a **prebuilt image** — no rebuild. `BACKEND` and `PORT` together are what `/api` is proxied to,
|
||||
so they have to name a service the web container can actually reach on your compose network.
|
||||
|
||||
Reference in new issue
Block a user