Skip to content

Commit

Permalink
use forever to keep node process running
Browse files Browse the repository at this point in the history
  • Loading branch information
treygriffith committed Feb 27, 2014
1 parent c6cdf26 commit 6b25bfb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ logs
results
tmp

.env

npm-debug.log
node_modules
.idea
Expand All @@ -24,4 +26,4 @@ public/vendor
public/css/styles.css

.vagrant/
vagrant_ansible_inventory_default
vagrant_ansible_inventory_default
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: node app.js
web: node forever.js
2 changes: 1 addition & 1 deletion Procfile.local
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
web: node app.js
web: node forever.js
mongo: mongod
11 changes: 11 additions & 0 deletions forever.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var forever = require('forever-monitor');

var child = new (forever.Monitor)('app.js', {
max: 3
});

child.on('exit', function () {
console.warn('app.js has exited after 3 restarts');
});

child.start();
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"express-flash": "~0.0.2",
"express-validator": "~1.0.1",
"fbgraph": "~0.2.8",
"forever-monitor": "~1.2",
"github-api": "~0.7.0",
"github": "~0.1",
"jade": "~1.1.5",
Expand Down

0 comments on commit 6b25bfb

Please sign in to comment.