foreverize
v0.1.0
Published
A tool for allowing a process to automatically foreverizing itself
Downloads
4
Readme
Foreverize: in Soviet Russia, your server keeps itself up
Foreverize is a handy tool that makes it really easy to your server code to incorporate forever-monitor automatically.
This version is going up on github/npm by popular demand, but is in no way ready for the general public yet...
TODO list:
- remove
config/forever.json
dependency (possibly put config into package.json) - remove hard-coded log paths
- allow full config options that
forever.Monitor
supports - remove all the logging to stdout
- cleanup code
Wish list:
- zero-downtime restarts
Install
$ npm install foreverize
Quick Start
Install required dependencies (or through package.json)
$ npm install forever
$ npm install foreverize
In your server.js
var start_server = function(){
require("http").createServer().listen(1337);
}
var foreverize = require("foreverize");
foreverize();
if(!foreverize.isMaster){
start_server();
}
Now if your HTTP server crashes, it'll respawn itself. You can also use the normal forever commands to manage the process.
$ node_modules/.bin/forever list
info: Forever processes running
data: uid command script forever pid logfile uptime
data: [0] foreverize_example /usr/local/nvm/v0.8.8/bin/node /home/ilya/work/cm/foreverize_example/server.js 26326 26329 /home/ilya/work/cm/foreverize_example/log/forever.log 0:0:0:5.61
Contributing
I welcome pull requests!
License
This software is distributed under the MIT License.