Consider Caddy as the campus-gateway implementation (post-#995 simplification)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- docker
- Domain
- devops, infrastructure
Research direction
Start with deploy/gateway/README.md and the gateway setup under deploy/gateway/, then compare the proposed Caddyfile behavior with the current nginx configuration. Verify upstream resolution across a backend redeploy and confirm X-Forwarded-* headers reach the backends. Done means the gateway replacement passes the full smoke checklist from #995.
Written by the indexing model from the issue text.
Description
Description
The unified-hostname gateway (issue #995) is live on dev as an nginx container (deploy/gateway/, PRs #997–#1017, #1022, #1023). It works and is smoke-green, but nginx on Railway dragged us through a long tail of platform-specific sharp edges. This issue proposes Caddy as a simpler long-term implementation, to be considered as a follow-up — not as an urgent swap.
Use case
Sharp edges the current nginx setup needs that Caddy removes:
- envsubst templating + snapshot workarounds — Railway's incremental snapshot builder once patch-merged a renamed template into a garbled hybrid; the Dockerfile now
rms stock templates and uses a unique filename to force wholesale copies. Caddy is configured by a single static Caddyfile. - Resolver bracketing — Railway's mesh DNS is a bare IPv6 literal (
fd12::10), which nginx misparses; we lean on the stock15-local-resolvers.envshmechanism to get bracketed addresses for theresolverdirective. Caddy uses the system resolver directly and handles IPv6 nameservers natively. - Entrypoint semantics — nginx image exec-bit-first
*.sh/*.envshrules (child process vs sourced) cost us two deploy crashes. Caddy has no entrypoint scripting layer.
Proposed sketch
FROM public.ecr.aws/docker/library/caddy:2-alpine
COPY Caddyfile /etc/caddy/Caddyfile
:8080 {
auto_https off # Railway edge already terminates TLS
handle /auth/* { reverse_proxy campus-auth.railway.internal:8080 }
handle /integrations/* { reverse_proxy campus-auth.railway.internal:8080 }
handle /api/* { reverse_proxy campus-api.railway.internal:8080 }
handle /audit/* { reverse_proxy campusaudit.railway.internal:8080 }
handle /health { respond "ok" 200 }
handle { redir /audit/ 302 }
}
(Docker Hub base images rate-limited our builds on 2026-10-30 — use the ECR public mirror or a digest pin.)
Caveats
- Upstream re-resolution: static upstream hostnames resolve once at startup; Caddy 2.7+
dynamic a { name ... port ... refresh 10s }restores per-request-style resolution. In practice the per-service mesh endpoint IPs have been stable across redeploys (the fabric routes the stable service address to the live instance), so startup resolution likely suffices — verify againstcampus-auth/campus-api/campusaudit.railway.internalbehavior on a backend redeploy. - X-Forwarded-*: the Caddyfile above must forward
X-Forwarded-For/Proto/Host(nginx does this today; backends'ProxyFixdepends on it). Defaults need checking. - What this does NOT fix: the one production failure we hit — a gateway instance with a broken mesh attachment (silent upstream hangs) — is Railway-side and would affect any proxy identically. The runbook stays: redeploy the gateway first, then investigate (see the
railway-opsskill). - Swap cost: one worktree PR + the full smoke checklist from #995 re-run.
Alternatives considered
- Keep nginx (default until this issue is picked up) — battle-tested through the chase, config is final and documented.
- HAProxy — best runtime-DNS story (
resolvers+hold valid), most arcane config. - Traefik — no advantage over Caddy here.
- No gateway at all — cookie-scoped subdomains (
auth./api./audit.campus.nyjc.app, already the prodBASE_URLSshape) with cookies on the shared parent domain would remove the gateway permanently, at the cost of redesigning the #995 cutover.
References
- #995 (single-hostname cutover, anchor issue) ·
deploy/gateway/README.md·docs/railway-architecture.md·.zcode/skills/railway-ops
- Dominant language
- Python
- Stars
- 0
- Forks
- 2
- Avg merge
- 39m
- Merged PRs (30d)
- 235
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nyjc-computing/campus
-
enhancement for-collaborators for-contributors
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nyjc-computing/campus#451 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
nyjc-computing/campus#1320 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 25/100
nyjc-computing/campus#1309 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 18/100
nyjc-computing/campus#1300 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 5/100
nyjc-computing/campus#1295 · 4 comments ·
Maintainers usually reply within 1 day
All issues in nyjc-computing/campus
Similar issues
-
claude-subscription-directsdk: tool calls with raw control characters in string values are droppedOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NousResearch/hermes-official-plugins#538 ·
Maintainers usually reply within 3 days
-
bug(qdiffusion): EnergyModel.score_visible_logits computes biased visible/hidden on-ratios when solver returns variable solution counts per candidatePossibly taken @houzhongyu claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
qboson/kaiwu-pytorch-plugin#2133 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
MakazhanAlpamys/Soup#3415 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days