Ready checks
One Hono server run as eight services, each with another kind of ready check, including an app that answers only on its own hostname and one that answers only on 127.0.0.1:<port>. The MODE variable picks each service’s behaviour, so devlanes.yaml is the file to read.
Requirements
Section titled “Requirements”- devlanes, with
devlanes setuprun once - Node 22 or later
- curl on
PATH, for theready.cmdcheck ofown-host-cmd
Run it
Section titled “Run it”cd basics-ready-checksdevlanes startdevlanes start --no-ui prints the start as text:
example-ready-checks@0 · main✓ services 8 of 8 ready ✓ index https://example-ready-checks.localhost ✓ http-check https://http-check.example-ready-checks.localhost ✓ tcp-check https://tcp-check.example-ready-checks.localhost ✓ log-check https://log-check.example-ready-checks.localhost ✓ own-host https://own-host.example-ready-checks.localhost ✓ own-host-cmd https://own-host-cmd.example-ready-checks.localhost ✓ legacy-host https://legacy-host.example-ready-checks.localhost ✓ slow-start https://slow-start.example-ready-checks.localhostOpen https://example-ready-checks.localhost. The page shows lane 0 of example-ready-checks and links to every service with the check it uses. Each service’s page shows the Host header the app received: own-host.example-ready-checks.localhost on own-host, 127.0.0.1:<port> on legacy-host.
During a start
Section titled “During a start”The first start of a lane runs the install task (npm install), because a new worktree has no node_modules. Then devlanes starts every service with npm run dev from package.json (the node template), sets MODE from the service’s env, and waits for each one’s check:
indexatexample-ready-checks.localhost:ready.httpon/healthz. Its links come fromservices.<name>.public_url.http-check:GET /healthzon its port must answer 2xx within 15 s.tcp-check: ready as soon as its port accepts a connection, whatever the app would answer.log-check: waits 3 s, then listens and printslog-check listening on http://127.0.0.1:<port>, whichready.logmatches.own-host: answers 400 to anyHostbutown-host.example-ready-checks.localhost(ALLOWED_HOST), the way Django’sALLOWED_HOSTSdoes. The check sendsHost: 127.0.0.1:<port>by default, soready.http.hostsends${{ self.hosts[0] }}instead.own-host-cmd: the same app, checked byready.cmdwithcurl -fsS -H "Host: ..." http://127.0.0.1:<port>/healthz.legacy-host: answers 400 to anyHostbut127.0.0.1:<port>.host_header: upstreammakes the proxy send that address instead of the hostname, and the check sends it by default.slow-start: sleeps 8 s before it listens, so it showsstartingindevlanes statusuntil then.
Try next
Section titled “Try next”On Windows, add --ssl-revoke-best-effort to the curl commands.
Start a second lane:
git worktree add ../examples-checkout -b feat/checkout, thencd ../examples-checkout/basics-ready-checks && devlanes start. The new worktree is lane 1 at https://example-ready-checks1.localhost, withhttp-check.example-ready-checks1.localhostand the rest, andcurl https://example-ready-checks1.localhost/laneanswers"lane":1.devlanes lane new --name example-ready-checks-review --startin this folder gives the same lane 1 without a worktree.Catch a service while it starts:
devlanes restart slow-start --no-ui --timeout 2sstops waiting after 2 seconds and exits 124:example-ready-checks@0 · main✗ services 0 of 1 readystarting slow-start! timed out before every unit was readyRight after that,
devlanes debug why slow-startprintsstarting; waiting for its readiness check (devlanes wait example-ready-checks@0:slow-start).devlanes wait slow-startreturnsready example-ready-checks@0:slow-startonce the server listens.Break a check: change http-check’s
path: /healthztopath: /missingindevlanes.yamland rundevlanes reload --no-ui. After the 15 s timeout it exits 1:example-ready-checks@0 · main✗ services 0 of 1 ready✗ http-check wasn't ready in time; GET /missing (Host: 127.0.0.1:20520) answered 404 http-check listening on http://127.0.0.1:20520hint: use a `ready.http.path` that answers 2xx, set `ready.http.host` if the app routes by hostname, or set `ready.http.status: 404`The process keeps running, but https://http-check.example-ready-checks.localhost now gets the proxy’s
DL203 Service failedpage (503), anddevlanes debug why http-checkprints the same reason. Put/healthzback anddevlanes reload --no-uibrings it back to ready.Drop the Host rewrite: delete
host_header: upstreamfrom legacy-host and save. The proxy applies the route change by itself (devlanes reloadreportsnothing to reload), andcurl https://legacy-host.example-ready-checks.localhost/answers 400 withinvalid host legacy-host.example-ready-checks.localhost: this app answers only on 127.0.0.1:<port>. Put the line back.devlanes lane clean 0 --yesstops lane 0 and deletes its data and logs. Run it with1for the second lane.
devlanes.yaml: theinstalltask and the eight services with theirMODEand ready check, with a comment wherever a key is the point.src/modes/: one file per behaviour.log.tsandslow-start.tsdelay the listen,own-host.tsandlegacy-host.tsrefuse otherHostheaders.src/index.ts: picks the mode fromMODEand starts the server.src/host-guard.ts: the middleware that answers 400 to anotherHost.
- Service patterns: frontend and API, on the
httpcheck, itshostandUser-Agent: devlanes-ready - Config reference: services, every
readyandhostskey - Lane lifecycle: editing the project file, on
devlanes reload