Skip to content

Instantly share code, notes, and snippets.

@seanhess
Created January 26, 2011 21:21
Show Gist options
  • Save seanhess/797489 to your computer and use it in GitHub Desktop.
Save seanhess/797489 to your computer and use it in GitHub Desktop.
// NOTE: Fugue *almost* works great. But it doesn't seem to responsd to the USR2 signal correctly
// Try it one more time.
var fugue = require('fugue')
var path = require("path")
var sys = require('sys')
// https://github.com/pgte/fugue
// Send kill -USR2 <PID> to hot reload! 0 downtime.
// This catches it, but doesn't prevent it
// process.on('SIGHUP', function() {
// console.log("Caught SIGHUP")
// })
// Run in production if you're using this
// process.env["NODE_ENV"] = "production"
var Port = 6001
var Host = "0.0.0.0"
var Workers = 1
var options = {}
options.started = function() {}
// options.verbose = true
options.working_path = path.join(__dirname, "..")
// options.tmp_path = ""
options.log_file = "/var/log/apiweb.log"
// options.master_log_file = "" // defaults to normal log file
// options.uid = 501
// options.gid = 20
options.master_pid_path = "/var/run/apiweb.pid"
// options.worker_to_master_ping_interval = 30000 - ms - Default 30s
options.worker_kill_timeout = 10000 // - ms until you kill workers when master dies. Default 30s
fugue.start(require("./apiweb"), Port, Host, Workers, options)
sys.puts("STARTED in production on " + Port + " with " + Workers + " workers")
// fugue.stop()
// fugue.isWorker()
// fugue.isMaster()
// fugue.workerPids()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment