Using supervisord instead of pm2 to manage nodejs process
Asked Answered
G

1

6

We currently use pm2 to keep our nodejs process alive, we don't use the cluster mode (and the related load balance feature).

Our php team uses supervisord to manage their php process alive, as laravel suggests. Now we are investigating the possibility of using supervisord to manage our nodejs process too. We mainly need 2 things from a process manager, keep a process alive and log the event when it crushes and restarts.

In term of keeping a process alive, I do find pm2 & supervisord share some similarities. But pm2 has more restart policies, e.g. pm2 has a CRON time which supervisord doesn't have (correct me if I am wrong). Without cron time feature, we will have to just resort to cronjob, so it is a nice-to-have feature but not a must.

supervisord has process groups and priority order, which through my experience with node, I don't find many use cases.

So to us, it seems doable, but we don't have enough experience with supervisord and we are afraid we may miss something here, especially the big one like you should not do that in the first place! Has anyone done this before?

BTW, my question is kind of the opposite of Running a python script in virtual environment with node.js pm2

--- update ---

I was asked again recently about this question.

It was not a priority for me so I didn't further investigate this problem. But because I don't use cluster in pm2 I definitely think it is doable, check this article Run NodeJs app forever using supervisor, the supervisor conf file should be just like the following,

[program:start_script]
command=/var/www/nodeapp/start.sh
autostart=true
autorestart=true
stderr_logfile=/var/log/start.err.log
stdout_logfile=/var/log/start.out.log
Gelignite answered 13/7, 2021 at 5:13 Comment(0)
I
-2

When you use pm2 or supervisord, the crash message will be hidden by pm2 or supervisord. So the key point is that when the worker crashese, you should have the ability to know it, such as to hack the pm2 program, when the worker crashes, send a message to the monitor system.

Illuviation answered 10/12, 2021 at 11:35 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Barnaul

© 2022 - 2024 — McMap. All rights reserved.