add pm2 process manager guide

main
Yik Teng Hie 4 years ago
parent 50e4ccd1cc
commit 6fb163a712

@ -0,0 +1,73 @@
# PM2 Quick Start
* Process Manager for Deployment of node js app
* [Reference](https://pm2.keymetrics.io/docs/usage/quick-start/)
* ![](./pm2-deploy.PNG)
```sh
# install pm2
$ npm i pm2@latest -g
# serve static site created by react
# pm2 serve <build folder> <port> --spa
$ pm2 serve build 8082 --spa
# to serve web app using "ecosystem.config.js"
# serve at port 3001 (configured in index.js)
$ pm2 start ecosystem.config.js
# start app as daemon
$ pm2 start server.js --name "wallet-api"
$ pm2 list
# stop process and start again
$ pm2 restart
# start new process, after started, stop old process
$ pm2 reload
$ pm2 logs
$ pm2 stop
$ pm2 delete all
# terminal based monitoring dashboard
$ pm2 monit
```
* [Ecosystem](https://pm2.keymetrics.io/docs/usage/application-declaration/)
* [vuejs deployment](https://medium.com/@kamerk22/deploy-vue-js-ssr-vuetify-on-production-with-pm2-and-nginx-ec7b5c0748a3)
* To generate `ecosystem.config.js`
```sh
$ pm2 ecosystem
```
* `ecosystem.config.js` generated using above command
```json
module.exports = {
apps: [
{
name: 'web-apps',
script: './app-server/index.js',
watch: true,
env: {
NODE_ENV: 'production',
},
},
],
};
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Loading…
Cancel
Save