Generate PM2 ecosystem configuration files with cluster mode, environment variables, and advanced process management settings.Perfect for production Node.js deployments.
module.exports = {
"apps": [
{
"name": "my-app",
"script": "./server.js",
"instances": 1,
"exec_mode": "fork",
"watch": false,
"max_memory_restart": "1G",
"env": {
"NODE_ENV": "development",
"PORT": "3000"
},
"env_production": {
"NODE_ENV": "production",
"PORT": "3000"
},
"autorestart": true,
"max_restarts": 10,
"min_uptime": "10s"
}
]
};Usage:
pm2 start ecosystem.config.jspm2 start ecosystem.config.js --env productionEverything you need for production Node.js deployments
Run multiple instances of your app across all CPU cores for maximum performance and reliability.
Automatic restart on crashes, file changes, and memory limits to keep your app running 24/7.
Separate development and production environment variables with easy switching between modes.
Use Server Compass to deploy your Node.js applications with PM2 process management included.