Files
petfeed/docker/npm-upstream.conf
admin 1e060e9179 feat(docker): scale to 3 load-balanced replicas (Gitea #26)
Next.js standalone is single-process, so one container only used one
CPU core. A load test hit a hard ceiling at ~60-65 req/sec with one
core pegged at 133% while 3 cores sat idle. Now runs as pawfeed-1/2/3
behind an NPM least_conn upstream, verified via load test showing CPU
spread evenly across all three replicas.

Also caps the Prisma pg pool per-replica via DB_POOL_MAX so 3 replicas
stay well under the Supabase pooler's connection limit.
2026-08-16 11:38:05 +02:00

31 lines
1.2 KiB
Plaintext

# Nginx Proxy Manager upstream config for the pawfeed-1/2/3 replicas.
# See docker/SCALING-ROADMAP.md (Schritt 3).
#
# Paste into either:
# - the pawfeed.org Proxy Host's "Advanced" tab (custom Nginx config,
# applies only to that host), or
# - a global snippet under /data/nginx/custom/*.conf on the NPM
# container (applies to all proxy hosts — use only if the upstream
# block needs to be shared).
#
# If using the Advanced tab, the upstream block itself typically needs to
# go in a global snippet (http-context), while the proxy_pass line below
# goes in that Proxy Host's Advanced tab. Verify against the NPM version in
# use — the split differs slightly between NPM releases.
upstream pawfeed_upstream {
least_conn;
server pawfeed-1:3000 max_fails=3 fail_timeout=30s;
server pawfeed-2:3000 max_fails=3 fail_timeout=30s;
server pawfeed-3:3000 max_fails=3 fail_timeout=30s;
}
# In the pawfeed.org Proxy Host, Advanced tab:
# location / {
# proxy_pass http://pawfeed_upstream;
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto $scheme;
# }