#process-manager #pocket #status #command #poor #imitation #supervisord

nightly app rust-pm

A poor and simple imitation of supervisord

2 releases

Uses old Rust 2015

0.0.2 May 19, 2015
0.0.1 May 17, 2015

#11 in #pocket

MIT license

13KB
298 lines

rust-pm - Intro

This is a pocket process manager. At some point it will be a better imitation of systemd Take a look at this asciicast.

Using it is very simple, just drop a rust-pm.toml in the same folder your rust-pm starts with a config like:

server-port = "localhost:4000"
[bad_sleeper] # Process name
command = "./bad_sleeper.py" # right now support 0 args commands
max_retries = 3 # 0 means forever

And with luck you open your browser at localhost:4000 and will see something like:

[{
  "command" : "./bad_sleeper.py",
  "max_retries" : 0,
  "name" : "bad_sleeper",
  "status" : {
    "meta" : 1,
    "state" : "running"
  }
}]

rust-pm start and watch the process. If it fails it starts another instance for maximum max_retries times.

Ideas

By now the stdin, stdout and stder are piped. We may change it to inherited, so the rust-pm output is in fact the process output. It depends on what we will do for logging.

WARN

This is a early stage project, Not used in production yet.

TODO

  • Augment the API to support scalling processes down and up.
  • Implement 0 max_retries to mean infinite. DONE
  • Allow configuration of workdir for processes.
  • Invest in logging? DONE. So far with simple writeln! since specific threads handle stdout.
  • Implement fern to replace bizarre writeln!
  • Add command line parser to specify config file. So rust-pm can be put on $PATH and run with any config file.

Licensing

MIT

Dependencies

~6MB
~148K SLoC