Questions tagged [pm2]

PM2 is a CLI process manager for Node.js applications with a built-in load balancer

pm2 is a process manager for Node apps with a built-in load-balancer.

pm2 is perfect when you need to spread your stateless NodeJS code across all CPUs available on a server, to keep all processes alive forever and to 0s reload them. pm2 reloads scripts when they crash, can manage multiple processes at once, and all without downtime.

It is an NPM CLI application that runs in io.js and node.js on Windows, Mac OSX, and Linux.

Main features

  • Builtin load-balancer (using the native cluster module)
  • Script daemonization
  • 0s downtime reload for Node
  • Startup scripts for Ubuntu and CentOS
  • Stop unstable process (avoid infinite loop)
  • Monitoring in console
  • HTTP API
  • Remote control and real time interface API

Questions can be tagged with "pm2" for problems with running applications using pm2.

For more information:

2258 questions
17
votes
5 answers

Running Node app via PM2 on port 80

I have an express that I want to run on port 80. --> app.listen(80); I'm using PM2 to manage the app (restarting, stopping, monitoring, etc.) . I have a deployment shell script whose last command is PM2 restart index. From the console output, I see…
Alex Bollbach
  • 4,370
  • 9
  • 32
  • 80
16
votes
1 answer

What does Heap Usage mean in PM2

What does Heap Usage mean in the "Custom Metrics" window when running pm2 monit? The value for my server gets dangerously close to 100%.
scottc11
  • 716
  • 2
  • 7
  • 20
16
votes
2 answers

PM2 deleted process runs on startup

I have a pm2 process named app that was used to test the configuration. I noticed app was starting when the system rebooted, and it was causing errors with the real application. I ran: pm2 delete app then I ran: pm2 list and it didn't show…
David Kamer
  • 2,677
  • 2
  • 19
  • 29
15
votes
2 answers

How to disable/stop a pm2 module?

Is it possible to stop or disable a pm2 module ? I did install the pm2-logrotate module but recently the community found an issue which is affecting our services and we need to stop or disable the module in top priority. The module is continuously…
15
votes
4 answers

pm2 --update-env option seems not working

I launched my node app by using ecosystem.config.js like this. pm2 start ecosystem.config.js And my ecosystem.config.js is here. module.exports = { /** * Application configuration section *…
hshan
  • 655
  • 2
  • 6
  • 19
15
votes
3 answers

Running a python script in virtual environment with node.js pm2

I would like to reference this question because I am certain that someone will flag this as a duplicate. I am not looking for another reference to supervisord. I'm sure that it is great and all, but the node PM2 has the functionality that I require…
slightlynybbled
  • 2,408
  • 2
  • 20
  • 38
15
votes
6 answers

pm2 Startup not starting up on Ubuntu

I am having difficulty getting pm2 to restart (itself and two node/express files, app.js & app2.js) on a server re-boot. Below is the processes I have tried: pm2 startup pm2 start app.js pm2 start app2.js pm2 startup ubuntu (also tried systemd and…
Rastalamm
  • 1,712
  • 3
  • 23
  • 32
15
votes
6 answers

Passing environment variables to node.js using pm2

I am trying to pass some arguments to my Express application which is run by pm2. There wasn't any hint in their documentation to do so, but apparently it's possible to pass some EV to your node application like SOME_STUFF=xxx pm2 start app.js.
Yar
  • 7,020
  • 11
  • 49
  • 69
14
votes
1 answer

PM2-like process management solution for Golang applications?

Does Go have a process manager similar to PM2 for NodeJS? Basic features of PM2: Run application in background indefinitely, such as a server waiting for a request. Restart application upon reboot. Editor's note: PM2 offers an easy way to run a…
quzhen
  • 303
  • 1
  • 2
  • 7
14
votes
5 answers

pm2 commad always stuck at [PM2] Spawning PM2 daemon with pm2_home=/home/$USER/.pm2

I've been following this issue and till now my problem not solved, anyone can help? Any command of pm2 always returned [PM2] Spawning PM2 daemon with pm2_home=/home/$USER/.pm2 Thanks
Muhammad Iqbal
  • 391
  • 1
  • 2
  • 9
14
votes
5 answers

React build run on server using pm2

I have compiled my react app using react-scripts build And it generated a build\ folder in the root directory of App. I am running the build\ folder using sudo serve -T -p 443 build/ This runs my React app successfully on HTTPS since I am passing…
RDoonds
  • 485
  • 2
  • 6
  • 19
14
votes
4 answers

express server port configuration issue with pm2 cluster mode

Problem: We start pm2 in cluster mode, and pm2 starts as many processes as there are cpu cores, pm2 also tries to start as many node servers as there are cpu cores but the problem here is that it fails to start as many servers because they all try…
Gaurav Sobti
  • 569
  • 1
  • 4
  • 14
14
votes
7 answers

How to use babel-node with pm2

I want to manage my node process with pm2 package. If I don't have any es6 syntax in my code so I don't need to add babel-node, and without any es6 syntax code is am able to run my code with pm2 with this line of code pm2 start server.js But as…
jsDevia
  • 1,282
  • 4
  • 14
  • 37
14
votes
4 answers

Run a custom npm script with PM2

I am currently developing several Telegram bots but I want to keep all of them in the same git repository. The issue is that on the other hand, I want to run them as separate processes. Since I'm using the Telegraf framework, to run a bot it goes…
Javier García Manzano
  • 1,024
  • 2
  • 12
  • 25
14
votes
1 answer

Can we use both NGINX and PM2 for node.js production deployment?

I am new to Node.js. I have built my first Node.js server. I am doing some research to improve performance of node js server in production. So I learned about NGINX and Process Manager(PM2). NGINX: It can load balance the incoming requests. It can…
Ravi Teja Kumar Isetty
  • 1,559
  • 4
  • 21
  • 39