Managing Node.js Process Lifecycles with PM2 // NodeFlux Docs

Use PM2 process manager configuration files to handle auto-restarts, environment injection, and log management. ## Steps 1. Create ecosystem.config.cjs file in your Node.js project root. 2. Define app configuration: modu NodeFlux documentation for free Minecraft, Node.js and application hosting.

Use PM2 process manager configuration files to handle auto-restarts, environment injection, and log management. ## Steps 1. Create ecosystem.config.cjs file in your Node.js project root. 2. Define app configuration: modu

Use PM2 process manager configuration files to handle auto-restarts, environment injection, and log management. ## Steps 1. Create ecosystem.config.cjs file in your Node.js project root. 2. Define app configuration: module.exports = { apps: [{ name: "my-app", script: "./index.js", max_memory_restart: "450M" }] }; 3. Configure max_memory_restart to trigger soft reload if memory leaks push usage near plan RAM caps. 4. Set autorestart: true and exp_backoff_restart_delay: 100 to prevent tight crash loops. 5. Set startup script to pm2-runtime start ecosystem.config.cjs in your service controls. 6. Inspect application logs using the service panel output tab. ## Notes - pm2-runtime is designed specifically for container environments to keep PID 1 active. - Setting memory limits slightly below container RAM quota prevents hard OOM container kills.