add environmental vars to pm2start instead of hardcoding

pull/1752/head
Berkeley Martinez 2015-08-13 15:40:54 -07:00
parent 146f42ef41
commit 8cfdd4c742
1 changed files with 5 additions and 3 deletions

View File

@ -1,11 +1,13 @@
var pm2 = require('pm2');
pm2.connect(function() {
pm2.start({
name: 'server',
name: process.env.SERVER_NAME || 'server',
script: 'server/production-start.js',
'exec_mode': 'cluster',
instances: '2',
'max_memory_restart': '900M'
instances: process.env.INSTANCES || 1,
'max_memory_restart':
(process.env.MAX_MEMORY / process.env.INSTANCES || 1) || '300M',
'NODE_ENV': 'production'
}, function() {
pm2.disconnect();
});