Skip to main content

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/:

FileResponsibility
daemon.goDaemon lifecycle and startup wiring
server.goHTTP server on a Unix socket and action handlers
client.goIPC client used by CLI commands
protocol.goRequest, response, and payload structs
pidfile.goPID 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:

MethodPathDescription
GET/api/pingDaemon liveness check

Authenticated routes:

MethodPath
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:

  • start
  • start_all
  • stop
  • restart
  • reload
  • delete
  • list
  • status
  • logs
  • save
  • resurrect
  • ping
  • cron_list
  • cron_start
  • cron_stop
  • cron_run
  • rolling_reload
  • config_reload
  • web_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:

FilePurpose
~/.runix/runix.sockUnix socket
~/.runix/runix.pidPID file
~/.runix/Data directory

The socket permissions are set to 0o660 and the PID file uses 0o644.