Run pm2 npm
pm2 start npm -- start
ecosystem.config.js
module.exports = {
apps: [{
name: "utilservice",
script: "./bin/www",
instanses: "max",
exec_mode: "cluster",
env: {
NODE_ENV: "production"
},
log_date_format: "YYYY-MM-DD HH:mm:ss.SSS",
error_file: "./logs/pm2-err.log",
out_file: "./logs/pm2-out.log",
combine_logs: true,
merge_logs: true
}]
}
package.json
{
"name: "app_name",
"script": {
"start": "NODE_ENV=production node ./bin/www --app_name &",
"pm2": "NODE_ENV=production pm2 start --name app_name ./bin/www --log-date-format 'DD-MM HH:mm:ss.SSS' -i max",
"eco": "NODE_ENV=production pm2 start ecosystem.josn.js",
"stop": "ps aux | grep app_name | grep -v grep | awk '{print $2}' | xargs kill -9",
"dev": "DEBUG=* NODE_ENV=development node ./bin/www --app_name --inspect --watch &",
"ps": "ps aux | grep app_name | grep -v grep"
}
}
Run Command
npm start pm2
npm start echo
반응형
'lang > node' 카테고리의 다른 글
javascript: 교집합(Union), 합집합(Intersection), 여집합(difference, minus) (0) | 2021.01.21 |
---|---|
linux watcher limit on pm2 (0) | 2019.11.21 |
NPM Permission Error (0) | 2019.11.13 |
jwtwebtoken (0) | 2019.04.12 |
Origin Policy Error on Sailsjs (0) | 2019.03.20 |