A practical tour of the Ferrox architecture and the mechanisms behind its guarantees—kept high‑level so you can ship, not spelunk.
ferrox-daemon hosts per‑app state machines and runners.ferrox-cli connects over OS‑native IPC for commands and queries.UNIX domain sockets on POSIX; Named Pipes on Windows. The transport is local, authenticated by OS permissions.
# POSIX (Linux/macOS) # CLI connects to a user-scoped UNIX domain socket, e.g. ~/.local/share/ferrox/run/daemon.sock # Windows # CLI connects to a named pipe, e.g. \\.\pipe\ferrox-daemon
Spawn
Daemon resolves env, cwd, ulimits, and user/group; then spawns the process in a platform‑native job/cgroup where supported.
Run
Health checks (HTTP/TCP/exec) gate readiness. Watchers coalesce FS changes to avoid thrash during builds.
Reload/Stop
Graceful signals first; enforced timeout; hard kill fallback. Strategy is configurable per app.
# Reload strategy per app
[apps.web]
cmd = "node server.js"
reload = "hup" # hup | bluegreen | socket (posix)
stop_timeout_ms = 10000
healthcheck = { http = "http://127.0.0.1:3000/health", interval_ms = 2000, timeout_ms = 800 }
# Restart policy with crash-loop protection
[defaults]
restart = "on-failure"
backoff = { min_ms = 500, max_ms = 60000, factor = 2.0, jitter = true, window = 120000, threshold = 5 }
Linux
ferrox daemon installsd_listen_fdsmacOS
Windows
Logging
The daemon aggregates stdout/stderr; lines are tagged with app and instance ids. Rotations are time/size‑based. Optional JSON output makes it ingest‑ready.
Metrics
A local Prometheus endpoint exposes per‑app counters, gauges, and health. Tracing via OpenTelemetry is opt‑in and per‑app.
| Metric | Description | Labels |
|---|---|---|
| ferrox_app_uptime_seconds | Time since last successful start | app, instance |
| ferrox_app_restarts_total | Number of restarts | app, instance, reason |
| ferrox_app_cpu_percent | Smoothed CPU usage (per process) | app, instance |
| ferrox_app_rss_bytes | Resident memory | app, instance |
| ferrox_app_health | 1 healthy / 0 unhealthy | app |
Effective config is computed as: defaults → profiles → app overrides → CLI flags (highest precedence). Env templating is applied at load time.
version = 1 [defaults] user = "appuser" # drop privileges where supported log_format = "json" [profiles.dev] [profiles.dev.env] RUST_LOG = "debug" [profiles.prod] [profiles.prod.env] RUST_LOG = "info" [apps.api] cmd = "node api/index.js" instances = "cpu" profile = "prod"
no_new_privs and capability drops where supported.ferrox export systemd emits unit files for long‑term operations.ferrox init --from pm2 bootstraps a config from an existing PM2 ecosystem.Apache‑2.0 / MIT • Ferrox