mirror of
https://github.com/sredevopsorg/deepseek-kubernetes-sandbox.git
synced 2026-11-03 01:13:24 +00:00
Make DSH agents-as-a-service browser-usable; fix probe crash-loop (#3)
* Rewrite DSH gateway for browser sessions, HTTP and WebSocket - Replace the Flask proxy with a Starlette ASGI app (uvicorn factory), keeping the control plane (claims, wake/suspend, idle sweeper). - Add HttpOnly gateway sessions and a server-side DSH launch-token handshake: read the token from pod logs, exchange it for a dsh-auth cookie, cache per (user, pod UID, Host), refresh once on 401. - Proxy HTTP/SSE and WebSocket (/api/remote.mux) under /u/<user>/, with header stripping/injection, Location rewriting and wake-on-connect. - Add a landing/signup/login page, health endpoint, pinned dependencies, a read-only-rootfs gateway image, 87 cluster-free tests and docs. * Fix DSH probe crash-loop and harden gateway manifests - Probe /favicon.svg instead of /: DSH gates / behind its launch-token cookie and returns 401, which made warm-pool pods crash-loop. - Pass DSH_TRUSTED_HOSTS through the entrypoint as --trusted-host args for public/ingress hosts; keep localhost trusted. - Deploy the published :gateway image, add pods/pods-log RBAC, /healthz probes, read-only rootfs with a /tmp emptyDir and non-root security. - Add optional Traefik Ingress and document the prerequisites. * Update CI, smoke tests, build tooling and docs - Run gateway pytest/ruff and build/smoke-test the image in CI. - Parameterize the DSH build version and pnpm version inputs. - Exercise cookie signup, HTML proxy, WebSocket auth, suspend/wake and delete in run-test-kind.sh. - Add Makefile/build.sh targets and document the architecture, handshake, probes, trusted hosts, troubleshooting and limitations. --------- Co-authored-by: SREDevOpsAgents <agents@sredevops.org>
This commit is contained in:
committed by
GitHub
parent
c9be929212
commit
6301c21bea
13
Dockerfile
13
Dockerfile
@@ -76,6 +76,7 @@ set -eu
|
||||
|
||||
: "${DSH_PORT:=3080}"
|
||||
: "${DSH_HOST:=}"
|
||||
: "${DSH_TRUSTED_HOSTS:=}"
|
||||
DSH_PUBLIC_URL="${DSH_PUBLIC_URL-http://localhost:${DSH_PORT}}"
|
||||
|
||||
# DSH rejects wildcard hosts. Pick the container/pod's first non-loopback IPv4.
|
||||
@@ -87,6 +88,18 @@ if [ -n "$DSH_PUBLIC_URL" ]; then
|
||||
set -- --public-url "$DSH_PUBLIC_URL" "$@"
|
||||
fi
|
||||
|
||||
# Additional trusted hosts (e.g. the public gateway host behind an Ingress).
|
||||
# DSH Host/Origin-fences /api: without this, requests forwarded with the
|
||||
# browser's Host header are rejected. Accepts comma- or space-separated names;
|
||||
# localhost/127.0.0.1 are always trusted below.
|
||||
old_ifs="$IFS"
|
||||
IFS=', '
|
||||
for trusted_host in $DSH_TRUSTED_HOSTS; do
|
||||
[ -n "$trusted_host" ] || continue
|
||||
set -- "$@" --trusted-host "$trusted_host"
|
||||
done
|
||||
IFS="$old_ifs"
|
||||
|
||||
exec node /app/lib/bin.js web \
|
||||
--no-open \
|
||||
--host "$DSH_HOST" \
|
||||
|
||||
Reference in New Issue
Block a user