make app crash when uncaughtException

This commit is contained in:
David Baldwynn 2016-05-20 13:28:27 -07:00
parent 7e356cd5d4
commit e41e4fb443
2 changed files with 13 additions and 3 deletions

View File

@ -2,7 +2,11 @@
"apps" : [{
"name" : "tellform",
"script" : "/usr/local/bin/grunt",
}],
"instances" : "0",
"exec_mode" : "cluster",
"watch": ["app", "public"],
"max_memory_restart : "1G"
}],
"deploy" : {
"stage" : {
"user" : "polydaic",
@ -10,7 +14,7 @@
"ref" : "origin/stage",
"repo" : "git@github.com:whitef0x0/tellform.git",
"path" : "/opt/deploy",
"post-deploy" : "npm install && pm2 startOrRestart ecosystem.json --env production",
"post-deploy" : "npm install && pm2 startOrGracefulReload ecosystem.json --env production",
"env" : {
"NODE_ENV": "production",
"BASE_URL": "stage.tellform.com"
@ -22,7 +26,7 @@
"ref" : "origin/master",
"repo" : "git@github.com:whitef0x0/tellform.git",
"path" : "/opt/deploy",
"post-deploy" : "npm install && bower install && pm2 startOrRestart ecosystem.json --env production",
"post-deploy" : "npm install && pm2 startOrRestart ecosystem.json --env production",
"env" : {
"NODE_ENV": "production",
"BASE_URL": "admin.tellform.com"

View File

@ -46,3 +46,9 @@ if (process.env.NODE_ENV === 'secure') {
console.log(chalk.green('HTTPs:\t\t\t\ton'));
}
console.log('--');
process.on('uncaughtException', function (err) {
console.error((new Date).toUTCString() + ' uncaughtException:', err.message)
console.error(err.stack);
process.exit(1)
});