dunstorm/pm2-go
About
Fast, single-binary Go alternative to PM2 — zero Node.js, ~15MB RAM, and a free built-in web dashboard
Systems & InfrastructureMeasured star growth
- in 24h
- Collecting history
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalPM2-GO
A fast, lightweight, single-binary alternative to PM2 written in Go — with a free, built-in web dashboard.
Zero Node.js runtime. ~15 MB daemon RAM. 9x–80x faster CLI lifecycle. One static binary.
Quick Start · Install · Benchmarks · Web Dashboard · Migrating from PM2 · Commands
Why PM2-GO?
PM2 has great developer ergonomics, but running it on a small VPS, container, or Python/Go/Rust server means dragging along Node.js, burning ~65 MB of daemon RAM, and paying for PM2 Plus if you want a web dashboard.
PM2-GO brings PM2-style workflows to any language in a single ~13 MB static Go binary:
- Zero runtime dependencies — supervise Python, Go, Rust, Ruby, Node.js, or raw binaries without installing Node.js.
- 4.4x less daemon RAM & 9x–80x faster CLI — local gRPC daemon uses ~14.7 MB RSS vs. ~64.8 MB for PM2.
- Free, local-first Web Dashboard built in — run
pm2-go webfor live CPU/memory charts, log tailing, event timelines, and lifecycle controls (token-authenticated, CSRF-protected, env values redacted). - Production process supervision — auto-restart, crash-loop limits (
max_restarts,min_uptime, exponential backoff),max_memory_restart, HTTP health checks, file watching, cron restarts, gracefulreload, size-based log rotation, andsystemd/ macOSlaunchdstartup generation. - PM2-familiar configs & CLI — supports
start,ls,describe,logs,restart,reload,stop,delete,dump,restore,--jsonoutput, and PM2-style ecosystem JSON fields (script,interpreter,args,max_memory_restart: "256M",env_<profile>).
Install
One-line installer (Linux & macOS)
Downloads the prebuilt static binary from GitHub Releases and verifies its SHA-256 checksum:
curl -fsSL https://raw.githubusercontent.com/dunstorm/pm2-go/main/scripts/install.sh | sh
Debian / Ubuntu / RPM packages
.deb and .rpm packages are published on the Releases page starting with v0.3.0.
Go install
go install github.com/dunstorm/pm2-go/cmd/pm2-go@latest
Docker
docker build -t pm2-go .
docker run --rm pm2-go --version
Build from source
git clone https://github.com/dunstorm/pm2-go.git
cd pm2-go
make build
./bin/pm2-go --version
Note: The main
pm2-gobinary already includes the web dashboard viapm2-go web. A standalonepm2-go-webbinary is also published if you want to deploy the dashboard separately.
Quick Start
# Start a process with a custom name, auto-restart, and memory cap
pm2-go start --name api --autorestart --max-memory-restart 256M python3 examples/test.py
# Or start a full stack from an ecosystem file
pm2-go start examples/ecosystem.json
# Inspect and manage processes
pm2-go ls
pm2-go describe api
pm2-go logs -l 50 api
pm2-go reload api
pm2-go restart all
# Launch the built-in authenticated web dashboard (http://127.0.0.1:9615)
pm2-go web
Example pm2-go ls output:
┌───┬───────────────────┬─────┬──────┬────────┬────────┬───┬──────┬────────┐
│ # │ name │ pid │ ppid │ status │ uptime │ ↺ │ cpu │ memory │
├───┼───────────────────┼─────┼──────┼────────┼────────┼───┼──────┼────────┤
│ 0 │ api-gateway │ 75 │ 68 │ online │ 7s │ 0 │ 0.2% │ 15.3MB │
│ 1 │ billing-worker │ 76 │ 68 │ online │ 7s │ 0 │ 0.0% │ 35.1MB │
│ 2 │ metrics-collector │ 81 │ 68 │ online │ 7s │ 0 │ 0.0% │ 23.0MB │
│ 3 │ nightly-cleanup │ 82 │ 68 │ online │ 7s │ 0 │ 0.0% │ 6.9MB │
└───┴───────────────────┴─────┴──────┴────────┴────────┴───┴──────┴────────┘
Starting any process spawns the local daemon automatically. The CLI communicates with the daemon over local gRPC.
Benchmarks
Reproducible Docker benchmark (make benchmark/docker) comparing PM2 and PM2-GO on Linux arm64 (golang:1.25-alpine, 5 iterations, managing identical Python processes):
CLI Lifecycle Latency (Median, lower is better)
| Processes | Scenario | PM2 | PM2-GO | Speedup |
|---|---|---|---|---|
| 1 | cold start |
347.9 ms | 19.1 ms | 18.2x faster |
| 1 | ls |
110.9 ms | 6.4 ms | 17.3x faster |
| 1 | restart all |
208.3 ms | 6.4 ms | 32.8x faster |
| 1 | stop all |
201.3 ms | 3.8 ms | 52.9x faster |
| 1 | delete all |
204.3 ms | 3.8 ms | 53.8x faster |
| 10 | cold start |
357.5 ms | 39.2 ms | 9.1x faster |
| 10 | ls |
96.8 ms | 9.0 ms | 10.8x faster |
| 10 | restart all |
704.1 ms | 21.5 ms | 32.8x faster |
| 10 | stop all |
648.9 ms | 8.1 ms | 80.6x faster |
Daemon Memory Footprint (RSS, lower is better)
| Managed Processes | PM2 Daemon RSS | PM2-GO Daemon RSS | Savings |
|---|---|---|---|
| 1 process | 64.8 MB | 14.7 MB | 4.4x less RAM |
| 10 processes | 66.2 MB | 19.9 MB | 3.3x less RAM |
Run the benchmark yourself in Docker without touching your host:
make benchmark/docker
Or locally with custom counts and iterations:
./scripts/benchmark_pm2_vs_pm2_go.py --iterations 10 --process-counts 1,10,50
These numbers measure CLI command latency and settled daemon RSS overhead. They do not measure application throughput.
How PM2-GO Compares
| Feature | PM2-GO | PM2 | Supervisord | systemd |
|---|---|---|---|---|
| Single static binary (no runtime) | Yes (~13 MB) | No (Node.js) | No (Python) | OS-native |
| Daemon idle RSS (1 app) | ~15 MB | ~65 MB | ~20–30 MB | OS-native |
| Built-in free Web Dashboard | Yes (dark/light) | Paid (PM2 Plus) | Basic XML-RPC UI | No |
PM2-style CLI (start, ls, logs, reload) |
Yes | Yes | Different CLI | Verbose unit files |
| JSON ecosystem files & env profiles | Yes | Yes | INI files | Unit files |
HTTP health checks & max_memory_restart |
Yes | Partial | External plugins | Partial |
| Built-in log rotation | Yes | Separate module | Yes | journald |
| Node.js cluster mode | No | Yes | No | No |
| Linux & macOS | Yes | Yes (+Windows) | Yes | Linux only |
Web Dashboard
PM2-GO includes a full-featured, self-hosted web dashboard with dark and light themes, live CPU/memory trend charts, searchable process inventory, live stdout/stderr log tailing, an event timeline, and lifecycle controls (Start, Restart, Reload, Stop, Delete).
Process inventory, lifecycle actions, and last-hour CPU/RAM trend charts |
Live stdout/stderr log console with search, copy, and auto-scroll |
Start the dashboard from the main binary:
pm2-go web
Security defaults
The daemon itself never exposes an HTTP port. pm2-go web runs a separate HTTP server that talks to the local daemon over gRPC:
- Binds to
127.0.0.1:9615by default. - Requires token-backed login (generates an ephemeral token at startup if
PM2_GO_WEB_TOKENor--tokenis not set). - Refuses non-loopback hosts unless
--allow-remoteis explicitly passed. - Redacts environment variable values from all web API responses (only variable names are shown).
- Protects lifecycle actions with a session CSRF token.
- Supports
--read-onlyfor monitoring-only dashboards and--secure-cookiesbehind TLS reverse proxies.
For a stable token or remote access behind HTTPS:
# Local with stable token
PM2_GO_WEB_TOKEN="$(openssl rand -base64 32)" pm2-go web
# Behind a TLS reverse proxy (Caddy, Nginx, Traefik)
PM2_GO_WEB_TOKEN="change-me" pm2-go web --host 0.0.0.0 --allow-remote --secure-cookies
Migrating from PM2
Most PM2 commands and JSON ecosystem configs work with minimal or zero changes. PM2-GO accepts PM2-style "script", "interpreter", string "args", and human-readable "max_memory_restart" values like "256M" or "1G":
{
"apps": [
{
"name": "api-gateway",
"script": "server.py",
"interpreter": "python3",
"args": "--port 8080 --workers 4",
"cwd": "./api",
"autorestart": true,
"max_memory_restart": "256M",
"health_check_url": "http://127.0.0.1:8080/health",
"env": {
"APP_ENV": "development"
},
"env_production": {
"APP_ENV": "production"
}
}
]
}
Start it with an environment profile:
pm2-go start ecosystem.json --env production
Ecosystem Files
PM2-GO accepts either a raw JSON array or an object with an apps array.
pm2-go start examples/ecosystem.json
pm2-go start examples/ecosystem.json --env staging
pm2-go restart examples/ecosystem.json
pm2-go stop examples/ecosystem.json
pm2-go delete examples/ecosystem.json
Supported fields
| Field | Type | Description |
|---|---|---|
name |
string | Stable process name used by CLI commands and log files (defaults to binary/script basename). |
executable_path |
string | Command or executable path to run. |
script |
string | PM2-compatible alias for executable_path (combined with interpreter when set). |
interpreter |
string | Optional interpreter for script (e.g. python3, node, or none). |
args |
[]string or string |
Arguments passed to the executable. |
cwd |
string | Working directory for the process. |
env |
map | Environment variables added to the spawned process. |
env_<name> |
map | Environment profile selected with --env <name>; overrides env. |
autorestart |
bool | Restart the process when it exits unexpectedly. |
cron_restart |
string | Five-field cron expression for scheduled restarts. |
max_restarts |
int | Maximum unstable restarts before the process is marked errored. |
min_uptime |
int (ms) | Minimum stable runtime before crash counters reset. |
restart_delay |
int (ms) | Fixed autorestart delay. |
exp_backoff_restart_delay |
int (ms) | Initial autorestart delay, doubled after each unstable crash. |
max_memory_restart |
int or string | RSS limit in bytes or size string (256M, 1G) before auto-restarting. |
health_check_url |
string | Optional HTTP endpoint checked while running. |
health_check_interval |
int (ms) | Health check interval. |
health_check_timeout |
int (ms) | Health check timeout. |
watch |
bool | Restart the process when watched paths change. |
watch_paths |
[]string |
Files or directories to poll when watch is enabled. |
watch_interval |
int (ms) | Watch polling interval. |
Environment updates
PM2-GO snapshots the process environment for restart, dump, and daemon restore flows. Keep $HOME/.pm2-go private if you store secrets there. To refresh a running process with the current shell environment:
APP_ENV=production pm2-go restart api --update-env
Commands
| Command | Purpose |
|---|---|
pm2-go start [flags] <cmd> [args...] |
Start a direct command (--name, --cwd, --autorestart, --max-memory-restart, --cron-restart, --watch). |
pm2-go start [--env name] <file.json> |
Start or restart processes from an ecosystem file. |
pm2-go start all |
Start all known processes. |
pm2-go ls [--json] |
List managed processes. |
pm2-go describe [--json] <name|id> |
Show process details, policy config, and log paths. |
pm2-go logs [-l lines] <name|id> |
Tail stdout and stderr logs. |
pm2-go stop <name|id|file.json|all> |
Stop processes without removing them from the process list. |
pm2-go restart [--env name] [--update-env] <target> |
Restart processes. |
pm2-go reload [--signal SIGTERM] [--kill-timeout 1600] <target> |
Gracefully reload processes with force-kill fallback. |
pm2-go delete <name|id|file.json|all> |
Stop and remove processes from the process list. |
pm2-go flush [name|id|file.json|all] |
Truncate process log files. |
pm2-go dump [name] |
Save the current process list to $PM2_GO_HOME/<name>.json. |
pm2-go restore [name] |
Restore a dumped process list. |
pm2-go config |
Print or update local PM2-GO config (logrotate, etc.). |
pm2-go status [--json] |
Show daemon status. |
pm2-go startup [--platform systemd|launchd|auto] [--user] [--output path] |
Generate a Linux systemd unit or macOS launchd plist. |
pm2-go web [start] [--host 127.0.0.1] [--port 9615] |
Start the built-in authenticated web dashboard. |
pm2-go kill |
Stop the daemon and all managed processes. |
Startup Services (Linux & macOS)
Generate a systemd unit on Linux:
pm2-go startup --user --output ~/.config/systemd/user/pm2-go.service
systemctl --user enable --now pm2-go
Generate a launchd plist on macOS:
pm2-go startup --platform launchd --output ~/Library/LaunchAgents/com.pm2-go.pm2-go.plist
launchctl load ~/Library/LaunchAgents/com.pm2-go.pm2-go.plist
Or use --platform auto to detect the current OS automatically.
Logs & Rotation
Each managed process writes to:
$PM2_GO_HOME/logs/<name>-out.log$PM2_GO_HOME/logs/<name>-err.log
Enable built-in log rotation (no external module needed):
pm2-go config set logrotate true
pm2-go config set logrotate_size 10M
pm2-go config set logrotate_max_files 10
Defaults: logrotate=false, logrotate_size=10M, logrotate_max_files=10.
Daemon & Runtime Files
Runtime data is stored in $HOME/.pm2-go by default. Set PM2_GO_HOME to isolate environments or run side-by-side migrations.
| Path | Purpose |
|---|---|
daemon.pid |
Current daemon PID. |
daemon.log |
Daemon stdout/stderr logs. |
pids/ |
Managed process PID files. |
logs/ |
Process stdout, stderr, and combined logs. |
config.json |
Local PM2-GO configuration. |
state.json |
Automatically persisted online processes restored on daemon start. |
*.json |
Dump files created by pm2-go dump. |
Start the daemon explicitly with pm2-go -d.
Current Limitations & Roadmap
PM2-GO is focused on being a fast, rock-solid process manager rather than reimplementing Node.js-specific internals:
- Supported OSes: Linux and macOS (Windows is not currently supported).
- No Node.js cluster load balancer: Run multiple instances behind Caddy/Nginx or use your runtime's worker pool.
- JSON ecosystem files: JavaScript
ecosystem.config.jsfiles are not evaluated (convert to JSON).
Planned next:
- Interactive terminal monitor (
pm2-go monitTUI) - Homebrew core / tap formula
- Zero-downtime rolling multi-instance support
Development
make build # Build bin/pm2-go and bin/pm2-go-web
make test # Run unit tests
make test/e2e # Run local end-to-end CLI & web tests
make test/e2e/docker # Run end-to-end tests in Docker
make benchmark/docker # Benchmark PM2 vs PM2-GO in Docker
Develop the web dashboard with live browser auto-reload:
PM2_GO_WEB_TOKEN=dev-token make web/dev
Run the Go vulnerability scanner:
go run golang.org/x/vuln/cmd/govulncheck@latest ./...
See CONTRIBUTING.md for guidelines.
License
MIT — see LICENSE.
Explore related projects
Loading…