Skip to content

Commit ab05161

Browse files
ralyodioclaude
andauthored
dev2 edge: per-site retry holds requests across an app restart; on for group.call (#212)
A site with "retry" gets its own reverse_proxy with lb_try_duration, so Caddy keeps dialing the app while a deploy restarts it instead of answering 502. group.call needs it: Telnyx webhooks drive live calls. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 6b1aa57 commit ab05161

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

‎dev2/dev2-edge‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,12 @@ def caddy_site(site, s):
156156
lines.append("\tencode gzip")
157157
if site.get("access_log"):
158158
lines += ["\tlog {", f"\t\toutput file /var/log/caddy/{site['hosts'][0]}.access.log", "\t}"]
159-
if "proxy" in site:
159+
if "proxy" in site and site.get("retry"):
160+
# While the app restarts (a deploy), hold the request and keep dialing instead of
161+
# answering 502: webhooks that drive live calls (Telnyx) must not fail mid-call.
162+
lines += [f"\treverse_proxy 127.0.0.1:{int(site['proxy'])} {{", "\t\theader_up X-Real-IP {remote_host}",
163+
"\t\tstream_close_delay 1h", f"\t\tlb_try_duration {site['retry']}", "\t\tlb_try_interval 250ms", "\t}"]
164+
elif "proxy" in site:
160165
lines.append(f"\timport edge_proxy {int(site['proxy'])}")
161166
elif "root" in site:
162167
lines += [f"\troot * {site['root']}", "\tfile_server"]

‎dev2/edge/edge.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
{ "hosts": ["pit.world"], "proxy": 8787, "max_body": "1MiB" },
1919
{ "hosts": ["www.pit.world"], "redirect": "https://pit.world{uri}" },
2020
{ "hosts": ["ad.network.pit.world"], "proxy": 8800, "max_body": "1MiB", "gzip": true },
21-
{ "hosts": ["group.call.pit.world"], "proxy": 8810, "max_body": "1MiB",
22-
"//": "group.call (moshcoder/group.call): no gzip, so the room page's server-sent events are not held back" },
21+
{ "hosts": ["group.call.pit.world"], "proxy": 8810, "max_body": "1MiB", "retry": "20s",
22+
"//": "group.call (moshcoder/group.call): no gzip, so the room page's server-sent events are not held back; retry holds Telnyx webhooks across a deploy instead of 502" },
2323
{ "hosts": ["*.*.pit.world", "*.*.*.pit.world"], "proxy": 8787, "max_body": "30MiB", "gzip": true,
2424
"//": "pit-proxy: every <name>.pit.world (+ bbs./social.) relayed by the pit.world app; one Let's Encrypt certificate per name from pit-proxy-cert" },
2525
{ "hosts": ["built.indie"], "proxy": 8798, "max_body": "1MiB", "moshpit": true },

0 commit comments

Comments
 (0)