Skip to content

Instantly share code, notes, and snippets.

View wheller's full-sized avatar
😁
Hacking on Infrastructure

Bill Heller wheller

😁
Hacking on Infrastructure
View GitHub Profile
@wheller
wheller / boot.js
Last active April 4, 2017 22:53 — forked from jdx/boot.js
zero-downtime node.js app runner
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var fs = require('fs');
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || require('os').cpus().length || 2;
var script = process.argv[2] || 'index.js';