feat: UNIX socket control plane for porter daemon - #11
Conversation
Bun.serve({fd}) was proposed in oven-sh/bun#2852 but never merged.
Connections open but Bun never dispatches to the handler when using fd.
Switch to direct UNIX socket binding with Bun.serve({unix}).
Systemd manages directory lifecycle via RuntimeDirectory=porter-%i,
giving each template instance its own isolated socket directory.
Also: use unified fetch handler instead of routes (avoids TS fd+routes
type incompatibility), clamp runs limit to 500, and prefer PORTER_SOCKET
env var for socket path resolution in the daemon.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (16)
📝 WalkthroughWalkthroughThis PR introduces a control plane REST API for Porter's daemon, accessible over UNIX domain sockets. A new ✨ Finishing Touches⚔️ Resolve merge conflicts
Comment |
Summary
Adds a REST API over a UNIX domain socket for runtime management of the porter daemon: scheduled task CRUD, daemon health, and worker pool observability.
API endpoints
CLI
Socket lifecycle
Systemd manages the socket directory via
RuntimeDirectory=porter-%i. Each templateinstance gets its own isolated directory:
The daemon binds the socket directly with
Bun.serve({ unix }).Why not systemd socket activation?
Bun.serve({ fd })was proposed in oven-sh/bun#2852but the PR was closed without merging. Connections open successfully on the
passed fd but Bun never dispatches to the HTTP handler.
Design decisions
nextRunambiguityPOSTcreates session rows so FK constraints passPORTER_SOCKETenv var: set by the systemd service unit, consumed by both daemon and CLI?limiton runs endpoint capped at 500, rejects negatives