Skip to content

devlanes is in beta and not ready for production use.Report an issue

Wait until a service is ready

A start waits for each service’s ready check, so a check that tests the real app turns a broken service into a failed start instead of a URL that answers with an error.

::example{slug="basics-ready-checks"}

Choose the kind by what the service offers:

  • A health route: http, which passes when the route answers with a 2xx status.
  • A port and no route: tcp, which passes once the port accepts a connection.
  • No port, such as a worker: log, which passes when a line of the service’s output matches.
  • Something only a tool can tell: cmd, a command that passes once it exits 0.
  • Nothing to probe: started.
devlanes.yaml
services:
api:
ready:
http:
path: /healthz

Without a ready check, a service with hostnames waits for its port, and one without counts as ready once it has started. The fields of each kind are under services.<name>.ready.

A service that compiles before it listens needs a longer timeout on its check, and the start needs a longer wait of its own:

devlanes.yaml
services:
api:
ready:
http:
path: /healthz
timeout: 5m
~/dev/myapp
$ devlanes start --timeout 5m --no-ui

When a check fails, the start says what the check asked and what came back. The service keeps running, and devlanes does not restart it; restart it after the fix. When a service fails follows such a failure to its cause.

If the app answers only on its own hostname

Section titled “If the app answers only on its own hostname”

The check sends the Host header 127.0.0.1:<port>. An app that refuses any other host needs the check to send its hostname:

devlanes.yaml
services:
api:
hosts: "api.${{ lane.domain }}"
ready:
http:
path: /healthz
host: ${{ self.hosts[0] }}