Deploy and manage ProStack in production using PM2
ecosystem.config.js
file in the root directory:
Option | Value | Description |
---|---|---|
name | ”app” | Name of the application in PM2 |
script | ”npx” | The command to run |
args | ”next start —port 3020” | Arguments passed to the script |
PORT | 3020 | The port on which the application runs |
NODE_ENV | ”production” | Environment setting |
watch | false | Disable file watching (more stable in production) |
max_memory_restart | ”1G” | Restart if memory exceeds 1GB |
autorestart | true | Automatically restart if the app crashes |
restart_delay | 1000 | Wait 1 second before restarting |
log_date_format | ”YYYY-MM-DD HH:mm:ss Z” | Format of log timestamps |
error_file | ”logs/error.log” | Where error logs are stored |
out_file | ”logs/output.log” | Where output logs are stored |
merge_logs | true | Merge logs from all instances |
kill_timeout | 5000 | Wait 5 seconds before force killing |
no_daemon | false | Run PM2 as a daemon |