Skip to content

Instantly share code, notes, and snippets.

@normancarcamo
Created June 11, 2019 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save normancarcamo/7874c4724bd7c2a47acea2f59254d084 to your computer and use it in GitHub Desktop.
Save normancarcamo/7874c4724bd7c2a47acea2f59254d084 to your computer and use it in GitHub Desktop.
Ejemplo de PM2 config file en js.
const pkg = require('package.json');
module.exports = {
apps : [{
name : pkg.name,
script : 'dist/index.js',
output : 'logs/out/logs.log',
error : 'logs/err/logs.log',
log : 'logs/all/logs.log',
instances : 0,
exec_mode : 'cluster',
restart_delay : 1500,
wait_ready : true,
listen_timeout : 3000,
merge_logs : true,
env_staging : {
NODE_ENV : 'production',
LOG_LEVEL : 'info',
APP_NAME : pkg.name,
SERVER_PORT : 3000,
SERVER_IP : '192.168.0.11'
},
env_production : {
NODE_ENV : 'production',
LOG_LEVEL : 'info',
APP_NAME : pkg.name,
SERVER_PORT : 3000,
SERVER_IP : '192.168.0.10'
}
}],
deploy : {
staging : {
host : [ 'virtual.staging' ],
user : 'deploy',
ref : 'origin/master',
repo : `git@virtual.services:/srv/git/${pkg.name}.git`,
path : `/srv/www/${pkg.name}`,
"post-setup" : 'bash deploy.sh staging setup',
"post-deploy" : 'bash deploy.sh staging update'
},
production : {
host : [ 'virtual.production' ],
user : 'deploy',
ref : 'origin/master',
repo : `git@virtual.services:/srv/git/${pkg.name}.git`,
path : `/srv/www/${pkg.name}`,
"post-setup" : 'bash deploy.sh production setup',
"post-deploy" : 'bash deploy.sh production update'
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment