Skip to content

Commit bdaf6f4

Browse files
hyperpolymathclaude
andcommitted
fix(fly): cold-start hardening — 90s grace, HTTP health check, curl
- fly.toml: switch [[services.tcp_checks]] → [[services.http_checks]] on /api/health so Fly tests the server, not just the open port; bump grace_period 30s → 90s (Isabelle Main heap + Julia JIT need the headroom) - .containerization/Containerfile.full: add curl to runtime apt-get so the HEALTHCHECK can use it; change HEALTHCHECK from --version (binary exists check) to curl -fs http://localhost:8090/api/health; start-period 5s → 90s - Comments: .internal → .flycast correction (auto-wake requires flycast) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 06a1c65 commit bdaf6f4

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

.containerization/Containerfile.full

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,15 @@ LABEL org.opencontainers.image.vendor="hyperpolymath"
188188

189189
# Runtime dependencies only.
190190
# `perl` + `fontconfig` are Isabelle's launcher-script requirements.
191+
# `curl` is needed for the HEALTHCHECK below.
191192
RUN apt-get update && apt-get install -y --no-install-recommends \
192193
ca-certificates \
193194
libssl3 \
194195
libgmp10 \
195196
perl \
196197
fontconfig \
197198
z3 \
199+
curl \
198200
&& rm -rf /var/lib/apt/lists/*
199201

200202
WORKDIR /app
@@ -240,8 +242,9 @@ EXPOSE 50051
240242
# Julia ML
241243
EXPOSE 8090
242244

243-
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
244-
CMD ["/app/bin/echidna", "--version"]
245+
# start-period=90s: Isabelle Main heap (~1-2 GB) + Julia JIT take time on cold start.
246+
HEALTHCHECK --interval=30s --timeout=10s --start-period=90s --retries=3 \
247+
CMD curl -fs http://localhost:8090/api/health || exit 1
245248

246249
ENTRYPOINT ["/app/bin/echidna"]
247250
CMD ["--help"]

fly.toml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
# flyctl launch --no-deploy --copy-config --name echidna-nesy
66
# flyctl deploy -c fly.toml -f .containerization/Containerfile.full
77
#
8-
# Internal-only: echidna is reached via echidna-nesy.internal:8090 from
8+
# Internal-only: echidna is reached via echidna-nesy.flycast:8090 from
99
# proven-nesy-solver-api; no public http_service.
10+
# Use .flycast (not .internal) so Fly auto-wakes the machine on first connection.
1011
#
1112
# NB: Container is LARGE (~6-8 GB) — Julia + Idris2 + Agda + Lean + Isabelle.
1213
# Memory must be >=4GB (Isabelle Main heap ~1GB); shared-cpu-2x is the
@@ -43,10 +44,15 @@ kill_timeout = "10s"
4344
port = 8090
4445
handlers = []
4546

46-
[[services.tcp_checks]]
47+
# HTTP check on /api/health — tests the server is serving, not just the port.
48+
# grace_period must be generous: Isabelle Main heap maps ~1-2 GB on first load
49+
# and Julia has JIT overhead on first prover call. 90s is the minimum safe value.
50+
[[services.http_checks]]
4751
interval = "30s"
48-
timeout = "5s"
49-
grace_period = "30s"
52+
timeout = "10s"
53+
grace_period = "90s"
54+
method = "GET"
55+
path = "/api/health"
5056

5157
[[vm]]
5258
size = "shared-cpu-2x"

0 commit comments

Comments
 (0)