module.exports = { apps: [{ name: 'port-nimara-client-portal', script: '.output/server/index.mjs', instances: 2, exec_mode: 'cluster', // Memory management max_memory_restart: '7G', // Restart policy max_restarts: 10, min_uptime: '10s', // Graceful shutdown kill_timeout: 10000, listen_timeout: 10000, // Environment variables env: { NODE_ENV: 'production', NODE_OPTIONS: '--max-old-space-size=8192', PORT: process.env.PORT || 3000 }, // Logging error_file: './logs/error.log', out_file: './logs/out.log', log_file: './logs/combined.log', time: true, // Advanced options autorestart: true, watch: false, ignore_watch: ['node_modules', 'logs', '.output'], // Health check health_check: { interval: 30, url: 'http://localhost:3000/api/health', max_consecutive_failures: 3 }, // Graceful reload wait_ready: true, // Crash handling exp_backoff_restart_delay: 100 }] };