Background daemons
Some services run in the background: they fork into a daemon, re-exec into detached workers, or are controlled through start and stop commands rather than staying in the foreground. devhost cannot supervise those through a command. Give it the commands instead with daemon mode.
Configure a daemon
Section titled “Configure a daemon”[services.mailpit]port = 8025host = "mail.hello.localhost"health = { http = "http://127.0.0.1:8025/api/v1/info" }
[services.mailpit.lifecycle]mode = "daemon"start = ["./scripts/mailpit-devctl", "start"]status = ["./scripts/mailpit-devctl", "status"]stop = ["./scripts/mailpit-devctl", "stop"]When the stack starts, devhost runs status first. If it exits 0, the daemon is already running and devhost skips start; otherwise it runs start. Either way, devhost then waits for the health check and adds the routes. On shutdown and on every restart it runs stop.
startandstopare required;statusis optional.- A daemon service has no top-level
command, and stays managed (nomanaged = false). - It needs a fixed
portor an explicit health check:port = "auto"andhealth.processare not allowed, because devhost owns no long-lived process for it. - Its recovery page reports the health check, not a process exit.