17 private links
Node.js as a running service is becoming more and more popular these days. One of the issues many developers face is how to ensure their node.js service starts automatically, and more importantly how to keep it running should it crash. Previously one had to install modules such as forever, and then create some autostart script to start the daemon when the server booted.
Most Linux systems have recently switched to using systemd, which makes this process a lot simpler and more efficient, and means that we do not need forever any more.
When you run Express apps for production, it is helpful to use a process manager to achieve the following tasks:
- Restart the app automatically if it crashes.
- Gain insights into runtime performance and resource consumption.
- Modify settings dynamically to improve performance.
- Control clustering.
A process manager is somewhat like an application server: it’s a “container” for applications that facilitates deployment, provides high availability, and enables you to manage the application at runtime.
The most popular process managers for Express and other Node.js applications are as follows:
- StrongLoop Process Manager
- PM2
- Forever
- SystemD
Using any of these three tools can be very helpful, however StrongLoop Process Manager is the only tool that provides a comprehensive runtime and deployment solution that addresses the entire Node.js application life cycle, with tooling for every step before and after production, in a unified interface.
Here’s a brief look at each of these tools. For a detailed comparison, see http://strong-pm.io/compare/.