본문 바로가기

Language/Node.js

pm2 npm start

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

'Language > Node.js' 카테고리의 다른 글

linux watcher limit on pm2  (0) 2019.11.21
pm2 npm start  (0) 2019.11.14
NPM Permission Error  (0) 2019.11.13
jwtwebtoken  (0) 2019.04.12
Origin Policy Error on Sailsjs  (0) 2019.03.20
not support route and folder fot sails.js  (0) 2019.03.04