prox
Rusty development process manager like foreman, but better!
WIP: This project is a work-in-progress but it's basically working. The API is subject to change. I plan to add improvements as I use it/as needed, including a possible TUI interface.
Motivation
I wanted something to run multiple processes in my project like Ruby's foreman (back in the day) but
without the drawbacks of:
- the complexity/sluggishness of wrapping every binary in a Docker container and maintaining a
docker-compose.yaml cargo baconhas tedious config and is meant for one-offcargo check/cargo test, not running multiple procs in parallel likedockerorforemancargo watchis abandonware (why not transfer the name to someone else?)justis great, but requires manualwatchexec, etc.- something like
foremanbut a bit smarter for restarts/crash handling, almost likedocker - shell scripts to combine logs and manage the procs +
awk+ control-C are a pain!
Installation
cargo install prox
(Or use as a library in your dev-dependencies and create your own wrapper -- see examples/basic_usage.rs)
Usage
Binary Usage:
Create a prox.toml (or .yaml or .json) file in your workspace/crate root:
[]
= 15
[[]]
= "api"
= "cargo"
= ["run", "--bin", "api"]
= "api"
= "Server listening"
# In a workspace, you can watch from the workspace root:
= ["Cargo.toml"]
# ... and/or relative to `working_dir`:
= ["src"]
= true
= { = "3000", = "debug" }
[[]]
= "worker"
= "cargo"
= ["run", "--bin", "worker"]
= "tests/fixtures"
= true
Then just run prox!
Library Usage:
Add prox to your [dev-dependencies] and create your own bin wrapper, e.g. dev.
See examples/basic_usage.rs for an example.
Features:
- Run several commands in parallel
- Colored prefixes per process
- File watching with automatic restart (global + per-proc watch paths)
- Readiness pattern or fallback timeout
- Debounced output idle detection
- Clean shutdown & optional cleanup commands
- Config via Rust builders or TOML / YAML / JSON files
Events you can receive (via setup_event_rx()):
AllStartedwhen every proc is readyStarted,Restartedper processExited,StartFailedon failureIdleafter no output for the debounce periodSigIntReceivedon Ctrl-C (if enabled)
Runtime control (optional): send ProxSignal::Start, Restart, Shutdown through the signal_rx channel you provide.
Environment:
- Per process vars:
env(clears first ifenv_clear = true).
Colors:
- Auto-assigned from
config.colorsunless a proc setscolor.
Readiness:
- If
readiness_patternset, logs are scanned case-insensitively. - Otherwise, after
readiness_fallback_timeoutthe proc is assumed running.
IMPORTANT! Not a production supervisor! For local development only.
Example:
examples/basic_usage.rs
License: MIT
use AnsiColors;
use ;
use Duration;
use ;