What is PM2?
PM2 is a production process manager for Node.js applications. It allows you to:- Keep applications alive forever
- Reload applications with zero downtime
- Facilitate common system admin tasks
- Manage application logging, monitoring, and clustering
PM2 Configuration
ProStack comes with a pre-configuredecosystem.config.js file in the root directory:
Configuration Options Explained
The ecosystem file configures the following options:Installing PM2
Before using PM2, you need to install it globally on your server:Deploying with PM2
To deploy your application with PM2:- Build your Next.js application:
- Start the application with PM2:
Managing Your Application
View Application Status
View Application Logs
Restart the Application
Stop the Application
Delete from PM2
PM2 Monitoring
PM2 provides a simple monitoring interface:Setting Up PM2 to Start on System Boot
To ensure your application starts automatically when the server reboots:PM2 Ecosystem File Extensions
You can extend the ecosystem file to support multiple environments or applications:Next Steps
Docker Deployment
Alternative deployment option using Docker
Environment Variables
Configure your application for production
