글

라벨이 pm2인 게시물 표시

Install pm2 via yarn globally

$ sudo yarn global add pm2 $ pm2 --version PM2 is a Production Process Manager for Node.js applications                      with a built-in Load Balancer.                 Start and Daemonize any application:                 $ pm2 start app.js                 Load Balance 4 instances of api.js:                 $ pm2 start api.js -i 4                 Monitor in production:                 $ pm2 monitor                 Make pm2 auto-boot at server restart:                 $ pm2 startup                 To go further checkout:   ...

Node.js Express-generator 로 생성한 Web App PM2로 실행하기

Express로 간단하게 작성한 Web application를 PM2로 시작하는 방법은 아래와 같다. > pm2 start  app.js  // Not working 하지만 Express-generator를 이용해 작성한 Web app의 경우 위와 같이 하면 process는 생성되지만 제대로 port를 listen 하지 못했다. 에러 메시지도 없어 헤매다가 구글링 끝에 찾았다. 아래와 같이 하면 된다. > pm2 start ./bin/www  Web application written using express-generator can be started by PM2 as above. 이미 package.json 파일에 실행 방법이 있었는데 서두르다 놓쳤다. {   ...   "scripts": {     "start": "node ./bin/www"   ... },