You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.2 KiB
1.2 KiB
PM2 Quick Start
- Process Manager for Deployment of node js app
- Reference
# 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
-
To generate
ecosystem.config.js$ pm2 ecosystem -
ecosystem.config.jsgenerated using above command
module.exports = {
apps: [
{
name: 'web-apps',
script: './app-server/index.js',
watch: true,
env: {
NODE_ENV: 'production',
},
},
],
};