How to reload a Node.js server without downtime using PM2?

View other answers to this thread
Start a personal dev blog on your domain for free and grow your readership.

3.4K+ developers have started their personal blogs on Hashnode in the last one month.

Write in Markdown · Publish articles on custom domain · Gain readership on day zero · Automatic GitHub backup and more

Denny Trebbin's photo

We had this question here already a month ago :-)

hashnode.com/post/how-do-you-deploy-a-nodej..

James Howard's photo

Cool. How is your experience with NDM? Is it experimental? Can we achieve a similar setup using PM2?

Denny Trebbin's photo

NDM is stable and it works really good. We have a bunch of CentOS servers and some RedHat machines - no incompatibility issues so far. I'd argue about PM2 adding his own Node.js version dependency to the deployment workflow. This is the same with NDM too. PM2 has some more stats like uptime etc, PM2 runs virtually anywhere where Node.js runs. But we had 0 troubles with NDM on our CentOS machines and it's launched pretty fast after restarting our machines. PM2 took ~2 seconds longer, which isn't a big deal but if every second counts to not violate SLA's then 2 seconds can be very important ;-)