v0.2.0 · MoonBit Native · core/async

Lightweight Native
Process Manager for MoonBit

Compiles to a single zero-dependency native executable. Supervise multi-instance MoonBit services with a built-in TCP reverse proxy, rolling reloads, health probes, memory guards, live CPU%/RSS monitoring, and declarative hot-updates.

$ moon add wsafight/moond
$ moond start --name api -i 2 --max-memory-restart 512M -- ./my-api
[moond] started 'api' (2 instance(s))

$ moond ls
NAME   ID  PID    STATUS  RESTARTS  UPTIME  CPU   MEM    CMD
api    0   41021  online  0         14s     0.2%  2.8MB  ./my-api
api    1   41022  online  0         14s     0.1%  2.8MB  ./my-api

$ moond reload api --wait 500
[moond] reloaded 'api' (2 instance(s) rolling)
$ moond start --name web -i 2 --proxy-port 8080 -- ./my-http-server
[moond] started 'web' (2 instance(s))
# Auto-injects PORT=8081 / 8082 per worker and load-balances 0.0.0.0:8080

$ curl -s http://127.0.0.1:8080 && curl -s http://127.0.0.1:8080
worker=0 port=8081
worker=1 port=8082

$ moond describe web | grep tcp_proxy
  tcp_proxy:      0.0.0.0:8080 -> workers 127.0.0.1:8081..8082
$ moond apply moond.json --env production
[moond] updated & reloaded 'api' (4 instance(s))
[moond] started 'worker' (2 instance(s))

$ moond start --name dev --watch ./_build/app.exe -- ./_build/app.exe
[moond] started 'dev' (1 instance(s))
# Rebuilding app.exe triggers debounced rolling reload automatically

$ moond save && moond startup systemd
[moond] saved 3 app(s) to ~/.moond/state.json
moond monit (v0.2.0) | daemon pid=40988 | Ctrl+C to exit
Summary: apps=2  instances=4/4 online  total_cpu=0.6%  total_mem=11.2MB
------------------------------------------------------------------------
NAME     ID  PID    STATUS  HEALTH   CPU   MEM    RESTARTS  UPTIME
api      0   41021  online  healthy  0.2%  2.8MB  0         2m14s
api      1   41022  online  healthy  0.2%  2.8MB  0         2m14s
worker   0   41080  online  none     0.1%  2.8MB  0         1m02s
worker   1   41081  online  none     0.1%  2.8MB  0         1m02s
~2.8 MB
Per-worker RSS footprint
0 Deps
Single native executable
39 + 31
Unit & E2E automated tests
macOS / Linux
kqueue & epoll native async

Production-Ready Capabilities

Everything needed to run MoonBit Native services reliably—without external runtimes or heavy bloat.

01

Single-Binary CLI + Daemon

Auto-spawns a detached daemon on first moond start with lock-file protection and a 0600 Bearer-token control plane.

02

Built-in TCP Proxy & Reloads

Load-balance multi-instance apps via --proxy-port and perform zero-downtime moond reload with --health-url / --health-tcp.

03

Memory Guard, Backoff & Cron

Auto-restarts on --max-memory-restart, resets crash counters after --min-uptime, and supports 5-field --cron-restart.

04

Declarative Hot-Update & Watch

Run moond apply moond.json --env prod to sync env/args/instances live, or --watch artifacts with FNV-1a hashing.

05

Live Monit TUI & Metrics

Track real-time CPU%, RSS memory, and health via moond monit, ls --json, and describe; control all or name:id.

06

Streaming Logs & Startup

Tail-window logs -f, --time timestamps, --merge-logs, streaming multi-archive rotation, plus systemd/launchd templates.

Documentation

Explore structured guides covering setup, CLI commands, architecture, and design trade-offs.