Skip to content

Commit

Permalink
use pm2 on heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
madhums committed Mar 13, 2019
1 parent 8222428 commit af6384b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: pm2 start server.js
web: npm run prod
16 changes: 16 additions & 0 deletions ecosystem.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require('dotenv').config();

module.exports = {
apps: [
{
name: 'Server',
script: 'server.js',

// Options reference: https://pm2.io/doc/en/runtime/reference/ecosystem-file/
instances: 2,
autorestart: true,
watch: false,
max_memory_restart: '1G'
}
]
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"start": "cross-env NODE_ENV=development nodemon server.js",
"debug": "cross-env NODE_ENV=development nodemon --debug server.js",
"test": "cross-env NODE_ENV=test babel-tape-runner test/test-*.js",
"pretest": "eslint ."
"pretest": "eslint .",
"prod": "pm2-runtime start ecosystem.config.js --env production"
},
"dependencies": {
"body-parser": "~1.18.3",
Expand Down

0 comments on commit af6384b

Please sign in to comment.