2015-06-18 21:08:21 +00:00
|
|
|
var pm2 = require('pm2');
|
|
|
|
pm2.connect(function() {
|
|
|
|
pm2.start({
|
2015-08-13 22:40:54 +00:00
|
|
|
name: process.env.SERVER_NAME || 'server',
|
2015-07-25 05:22:40 +00:00
|
|
|
script: 'server/production-start.js',
|
2015-06-29 17:10:22 +00:00
|
|
|
'exec_mode': 'cluster',
|
2015-08-13 22:40:54 +00:00
|
|
|
instances: process.env.INSTANCES || 1,
|
|
|
|
'max_memory_restart':
|
|
|
|
(process.env.MAX_MEMORY / process.env.INSTANCES || 1) || '300M',
|
|
|
|
'NODE_ENV': 'production'
|
2015-06-29 17:10:22 +00:00
|
|
|
}, function() {
|
2015-06-18 21:08:21 +00:00
|
|
|
pm2.disconnect();
|
|
|
|
});
|
|
|
|
});
|