Skip to content

Commit

Permalink
pm2 init changes + chores fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Unitech committed Apr 12, 2020
1 parent ff77c6b commit dd3cf08
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 25 deletions.
2 changes: 1 addition & 1 deletion examples/cluster-http/http.js
Expand Up @@ -4,6 +4,6 @@ var http = require('http');
var server = http.createServer(function(req, res) {
res.writeHead(200);
res.end('hey');
}).listen(process.env.PORT || 8000, function() {
}).listen(process.env.PORT || 8089, '0.0.0.0', function() {
console.log('App listening on port %d', server.address().port);
});
2 changes: 1 addition & 1 deletion lib/binaries/DevCLI.js
Expand Up @@ -66,7 +66,7 @@ function run(cmd, opts) {

opts.watch = true;
opts.autorestart = true;

opts.restart_delay = 1000
if (opts.autoExit)
autoExit();

Expand Down
4 changes: 0 additions & 4 deletions lib/binaries/Runtime4Docker.js
Expand Up @@ -71,10 +71,6 @@ var Runtime = {
});

this.pm2.connect(function(err, pm2_meta) {
if (pm2_meta.new_pm2_instance == false) {
console.warn('[WARN] PM2 Daemon is already running')
}

process.on('SIGINT', function() {
Runtime.exit();
});
Expand Down
28 changes: 9 additions & 19 deletions lib/templates/ecosystem.tpl
@@ -1,28 +1,18 @@
module.exports = {
apps : [{
name: 'API',
script: 'app.js',
// Options reference: https://pm2.keymetrics.io/docs/usage/application-declaration/
args: 'one two',
instances: 1,
autorestart: true,
watch: false,
max_memory_restart: '1G',
env: {
NODE_ENV: 'development'
},
env_production: {
NODE_ENV: 'production'
}
script: 'index.js',
watch: '.'
}, {
script: './service-worker/',
watch: ['./service-worker']
}],

deploy : {
production : {
user : 'node',
host : '212.83.163.1',
ref : 'origin/master',
repo : 'git@github.com:repo.git',
user : 'SSH_USERNAME',
host : 'SSH_HOSTMACHINE',
ref : 'GIT_BRANCH',
repo : 'GIT_REPOSITORY',
path : '/var/www/production',
'post-deploy' : 'npm install && pm2 reload ecosystem.config.js --env production'
}
Expand Down

0 comments on commit dd3cf08

Please sign in to comment.