supervisor and monitor for node.js applications
Want to see pretty graphs? Log in now!
npm install strong-supervisor
|46||downloads in the last day|
|263||downloads in the last week|
|982||downloads in the last month|
|Last Published By|
|Version||0.2.2 last updated 8 days ago|
|Keywords||runner, forever, supervisor, cluster, master, strong-cluster-control, strong-agent, strongops, strongloop, strong-cli|
Runs an application under a supervisory master. This allows
to be used to manage a cluster of workers, or even a single worker,
restarting them on failure, and allowing run-time control using the
utility, or the
NOTE: When using strong-supervisor, it is not necessary to directly require
either strong-cluster-control or strong-agent in your application. The
supervisor will do that for you. See the example applications in
Profiling does not occur if the application is not registered, and it can be
explicitly disabled using the
Supervisor will run the application clustered, by default, maintaining a worker
per CPU. It does this using
this behaviour is configurable (see
loadOptions() in the
Clustering can be disabled using the
--size=off option, or the size can be
explicitly set to any value.
Supervisor can detach the master from the controlling terminal, allowing to run
as a daemon. This behaviour is optional, see the
Supervisor can optionally direct the output of a detached daemon to a file, but it is not recommended to use node's stdio for logging, for several reasons:
- Node process stdout and stderr are synchronous, robust node servers should not use synchronous APIs.
- The file is never reopened, so it cannot be rotated.
- The output lacks the conventional log format (time stamps, facilities, etc.).
Use a log system such as Winston or Bunyan.
Supervisor can optionally write a PID file with the master's PID. This could be
useful to send signals to a detached process from within system startup scripts
as used by
The supervisor will attempt a clean shutdown of the cluster before exiting if it is signalled with SIGINT or SIGTERM, see control.stop().
If the supervisor is detached, it will attempt a restart of the cluster if it is signalled with SIGHUP, see control.restart().
npm install -g strong-supervisor
usage: slc run [options] [app [app-options...]] usage: slr [options] [app [app-options...]] Run an app, allowing it to be profiled (using StrongOps) and supervised. `app` can be a node file to run or a package directory. The default value is ".", the current working directory. Packages will be run by requiring the first that is found of: 1. server.js 2. app.js 3. `main` property of package.json 4. index.js Runner options: -h,--help Print this message and exit. -v,--version Print runner version and exit. -d,--detach Detach master from terminal to run as a daemon (default is to not detach). -l,--log FILE When detaching, redirect terminal output to FILE, in the app's working directory if FILE path is not absolute (default is supervisor.log) -p,--pid FILE Write supervisor's pid to FILE, failing if FILE already has a valid pid in it (default is not to) --cluster N Set the cluster size (default is off, but see below). --no-profile Do not profile with StrongOps (default is to profile if registration data is found). Cluster size N is one of: - A number of workers to run - A string containing "cpu" to run a worker per CPU - The string "off" to run unclustered, in which case the app will *NOT* be supervisable or controllable, but will be monitored. Clustering defaults to off unless NODE_ENV is production, in which case it defaults to CPUs.