v1.14.0
Added
-
hkm service— run a project's queue worker as a supervised service.
hkm worker --queue=mailsis a foreground process: it dies with the terminal,
it does not come back after a crash or a reboot, and nothing collects its
output. Every deployment therefore hand-wrote the same unit file. The command
generates it for whichever supervisor the host runs — systemd or launchd, with
--platformto override so a Mac can produce the Linux unit it will deploy —
in four verbs: preview (the default, which writes nothing),write,
install [--start]andremove. Scope is--systemor--user, defaulting
to system on Linux and to a user agent on macOS, where a LaunchDaemon running
as root is the wrong answer on a developer machine.--dry-run(-n) reports
every write and every command for the three mutating verbs and performs none
of them.Three things the generated unit gets right that a hand-written one usually
does not:ExecStartruns the LAUNCHER —hkm worker -p <root>, notphpplus an
absolutevendor/autoload.php. The launcher self-locates the kernel, so a
kernel upgrade that moves a version-stamped install directory cannot
silently break the queue.--exec=phpemits the direct form for a server
with no launcher installed, and states the pinned autoload's cost in the
unit itself.TimeoutStopSec/ExitTimeOutis 90s. The worker traps SIGTERM and
finishes the job in flight before exiting — that is what makes a redeploy
safe — and launchd's 20s default SIGKILLs it mid-transaction instead.PATHandHKM_PHP_BINare pinned. A service inherits none of a login
shell's PATH, and/opt/homebrew/binis on neither manager's default. The
entire diagnostic without the pin iserror: FileNotFound, with nothing
anywhere naming php. Found by running the generated unit, not by reading it.
Values reaching the unit are validated rather than interpolated: a queue name
may hold only[A-Za-z0-9._:-], so nothing can append an argument or a
directive;ExecStarttokens containing whitespace are quoted; plist strings
are XML-escaped.
Fixed
- The worker entry point ignored every command-line flag.
hkm workerand
hkm run --workerforward their arguments verbatim toapp/worker/run.php,
which read onlyWORKER_QUEUEfrom the environment — so
hkm worker --queue=mailswas accepted in silence and draineddefault
instead. That is the failure mode with no signal at all: no error, no warning,
a running worker, and the wrong queue. The entry point (and the scaffolding
template new projects get) now parses-q/--queue,-n/--max-iterations,
--memoryand-h/--help, each overriding the matching environment variable,
and rejects an argument it does not recognise rather than ignoring it. The
environment fallbacks moved fromgetenv()toenv()at the same time: the
loader injects.envinto$_ENVand deliberately skipsputenv(), so
getenv('WORKER_QUEUE')could not see a value set in the project's.env.
What's Changed
🔄 Other Changes
- chore(homebrew): point the formula at v1.13.1 by @hakeemRash in #165
- release: v1.14.0 — the worker takes its flags, and can be run as a service by @hakeemRash in #166
Full Changelog: v1.13.1...v1.14.0