Skip to content

Commit 1e198b2

Browse files
h4x3rotabclaude
andcommitted
dstack-ingress 2.0: switch from nginx to haproxy for L4 TCP proxying
Replace nginx L7 reverse proxy with HAProxy in TCP mode. This eliminates HTTP-level inspection so all protocols (HTTP, WebSocket, gRPC, arbitrary TCP) work transparently after TLS termination. Key changes: - Dockerfile: nginx base -> haproxy:3.1-bookworm, master-worker mode - entrypoint.sh: generate haproxy.cfg instead of nginx conf, support ROUTING_MAP env var for multi-domain SNI-based routing - renewal-daemon.sh: graceful reload via SIGUSR2 instead of nginx -s reload - New build-combined-pems.sh: concat fullchain+privkey for HAProxy PEM format - functions.sh: sanitize_target_endpoint accepts bare host:port - Evidence serving: payload inspection on port 443 (default, opt-out via EVIDENCE_SERVER=false) + shared /evidences volume for backend serving - Configurable L4 tuning: MAXCONN, TIMEOUT_CONNECT/CLIENT/SERVER - Drop L7-only env vars (CLIENT_MAX_BODY_SIZE, PROXY_*_TIMEOUT) with warnings Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 027f80e commit 1e198b2

9 files changed

Lines changed: 325 additions & 341 deletions

File tree

custom-domain/dstack-ingress/Dockerfile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM nginx@sha256:b6653fca400812e81569f9be762ae315db685bc30b12ddcdc8616c63a227d3ca
1+
FROM haproxy:3.1-bookworm
2+
3+
USER root
24

35
RUN --mount=type=bind,source=pinned-packages.txt,target=/tmp/pinned-packages.txt,ro \
46
set -e; \
@@ -32,9 +34,10 @@ RUN --mount=type=bind,source=pinned-packages.txt,target=/tmp/pinned-packages.txt
3234
RUN mkdir -p \
3335
/etc/letsencrypt \
3436
/var/www/certbot \
35-
/usr/share/nginx/html \
36-
/etc/nginx/conf.d \
37-
/var/log/nginx
37+
/etc/haproxy/certs \
38+
/var/run/haproxy \
39+
/var/lib/haproxy \
40+
/evidences
3841

3942
# Install scripts with deterministic permissions via bind mount
4043
RUN --mount=type=bind,source=scripts,target=/tmp/scripts,ro \
@@ -61,4 +64,4 @@ ENV PYTHONPATH="/scripts"
6164
COPY --chmod=666 .GIT_REV /etc/
6265

6366
ENTRYPOINT ["/scripts/entrypoint.sh"]
64-
CMD ["nginx", "-g", "daemon off;"]
67+
CMD ["haproxy", "-W", "-f", "/etc/haproxy/haproxy.cfg"]

0 commit comments

Comments
 (0)