v1.6.0: Lifecycle Hooks and Reverse Proxy Support
Pitchfork v1.6.0 adds daemon lifecycle hooks for reacting to ready, failure, and retry events, along with new environment variables injected into every daemon process. This release also adds support for serving the web UI behind a reverse proxy path prefix and fixes ready_cmd to respect the daemon's working directory.
Highlights
- Lifecycle hooks: Run custom shell commands when daemons become ready, fail, or retry via a new
[daemons.<name>.hooks]config section - Daemon metadata env vars: Every daemon process now receives
PITCHFORK_DAEMON_IDandPITCHFORK_RETRY_COUNTautomatically - Reverse proxy path prefixes: Serve the web UI under a custom path using
--web-pathorPITCHFORK_WEB_PATH
Added
-
Daemon lifecycle hooks -- Configure
on_ready,on_fail, andon_retryhooks under[daemons.<name>.hooks]to fire shell commands in response to daemon events. Hooks are fire-and-forget and run in the daemon's working directory. (#245) - @jdx[daemons.api] run = "node server.js" retry = 3 [daemons.api.hooks] on_ready = "echo 'api is ready'" on_fail = "./scripts/cleanup.sh" on_retry = "echo 'retrying...'"
-
Daemon process environment variables --
PITCHFORK_DAEMON_IDandPITCHFORK_RETRY_COUNTare now automatically set for every daemon process and its hooks. Theon_failhook additionally receivesPITCHFORK_EXIT_CODE. (#245) - @jdx -
Web UI path prefix support -- Use
--web-path <PATH>orPITCHFORK_WEB_PATH=<PATH>to serve the web UI under a subpath, making it easy to run behind a reverse proxy. All routes, links, HTMX polling, SSE streaming, and static assets work correctly under the prefix. (#244) - @jdxPITCHFORK_WEB_PORT=9001 PITCHFORK_WEB_PATH=ps pitchfork supervisor run # Web UI is then available at /ps/ on port 9001
Fixed
ready_cmdnow respects daemon working directory -- The readiness check command (ready_cmd) previously ran in the supervisor's directory rather than the daemon's configureddir. It now correctly uses the daemon's working directory. (#243) - @gaojunran
New Contributors
- @gaojunran made their first contribution in #243
Full Changelog: v1.5.0...v1.6.0