Switch Fly proxy to upstream keepalive pools (#337)
All checks were successful
Deploy Fly.io Proxy / deploy (push) Successful in 1m37s
All checks were successful
Deploy Fly.io Proxy / deploy (push) Successful in 1m37s
## Summary - Replace per-request DNS resolution (variable-based `proxy_pass`) with static `upstream` blocks and `keepalive` connection pools - Reuses TLS connections through the Tailscale tunnel instead of handshaking per request - Add `mise run fly-reload` for nginx config reload without full redeploy (re-resolves upstream DNS) ## Trade-off DNS is resolved at config load, not per-request. If Tailscale Ingress pods get new IPs (restart, reschedule), `mise run fly-reload` is needed. A Grafana alert will be added to detect this. ## Still TODO on this branch - [ ] Grafana alert for upstream unreachable (triggers fly-reload reminder) - [ ] Docs pass - [ ] Deploy from branch and verify latency improvement - [ ] Changelog fragment 🤖 Generated with [Claude Code](https://claude.com/claude-code) Reviewed-on: #337
This commit is contained in:
parent
54b1cee950
commit
fe0e913963
12 changed files with 229 additions and 102 deletions
10
fly/start.sh
10
fly/start.sh
|
|
@ -11,10 +11,18 @@ tailscale up --authkey="${TS_AUTHKEY}" --hostname=flyio-proxy
|
|||
until tailscale status > /dev/null 2>&1; do sleep 1; done
|
||||
echo "Tailscale connected"
|
||||
|
||||
# Wait for MagicDNS to be ready — upstream blocks resolve DNS at config
|
||||
# load, so nginx will fail to start if MagicDNS can't resolve yet.
|
||||
echo "Waiting for MagicDNS..."
|
||||
until nslookup forge.tail8d86e.ts.net 100.100.100.100 > /dev/null 2>&1; do
|
||||
sleep 1
|
||||
done
|
||||
echo "MagicDNS ready"
|
||||
|
||||
# Ensure fail2ban deny file exists before nginx starts
|
||||
touch /etc/nginx/forge-deny.conf
|
||||
|
||||
# Start nginx — MagicDNS is available, health check passes immediately.
|
||||
# Start nginx — MagicDNS is available, upstreams resolved.
|
||||
nginx -g "daemon off;" &
|
||||
NGINX_PID=$!
|
||||
echo "Nginx started"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue