Daemon
The daemon runs the supervisor in the background and exposes a Unix-socket IPC layer for the CLI.
Implementation
Located at runix/internal/daemon/:
| File | Responsibility |
|---|---|
daemon.go | Daemon lifecycle and startup wiring |
server.go | HTTP server on a Unix socket and action handlers |
client.go | IPC client used by CLI commands |
protocol.go | Request, response, and payload structs |
pidfile.go | PID file lifecycle |
Socket Model
The daemon listens on a Unix domain socket and serves HTTP routes such as /api/start and /api/list.
Public route:
| Method | Path | Description |
|---|---|---|
GET | /api/ping | Daemon liveness check |
Authenticated routes:
| Method | Path |
|---|---|
POST | /api/start |
POST | /api/start_all |
POST | /api/stop |
POST | /api/restart |
POST | /api/reload |
POST | /api/delete |
POST | /api/list |
POST | /api/status |
POST | /api/logs |
POST | /api/save |
POST | /api/resurrect |
POST | /api/config_reload |
POST | /api/web_start |
Envelope Schema
Each IPC request uses a JSON envelope:
{
"action": "start",
"payload": {
"name": "api",
"runtime": "go",
"entrypoint": "./cmd/api"
}
}
Each response uses:
{
"success": true,
"data": {},
"error": ""
}
The action field mirrors the route chosen by the CLI client.
Action Constants
Current action names in protocol.go:
startstart_allstoprestartreloaddeleteliststatuslogssaveresurrectpingcron_listcron_startcron_stopcron_runrolling_reloadconfig_reloadweb_start
Reload Behavior
The daemon listens for SIGHUP and reloads config from the stored config path. Config reload also updates:
- in-memory daemon config
- authenticator state
- web server listen/auth settings
Runtime Paths
Typical paths:
| File | Purpose |
|---|---|
~/.runix/runix.sock | Unix socket |
~/.runix/runix.pid | PID file |
~/.runix/ | Data directory |
The socket permissions are set to 0o660 and the PID file uses 0o644.