← back to Glassbeadedwallpaper

ecosystem.config.js

41 lines

module.exports = {
  apps: [{
    name: 'glassbeadedwallpaper',
    script: './server.js',
    instances: 1,
    autorestart: true,
    watch: false,
    max_memory_restart: '1G',
    env: {
      PORT: 9888,
      NODE_ENV: 'production'
    },
    error_file: './logs/err.log',
    out_file: './logs/out.log',
    log_file: './logs/combined.log',
    time: true,

    // Aggressive restart policy - NEVER let this go down
    exp_backoff_restart_delay: 100,
    restart_delay: 1000,  // Restart immediately after 1 second
    max_restarts: Infinity,  // No limit on restarts
    min_uptime: '5s',  // Consider successful if runs for 5 seconds

    // Kill and restart if app becomes unresponsive
    kill_timeout: 5000,  // Kill after 5 seconds if not responding
    listen_timeout: 10000,  // Wait 10 seconds for app to listen

    // Automatic restart on cron schedule to prevent memory leaks
    cron_restart: '0 4 * * *',  // Restart daily at 4 AM

    // Merge logs for easier debugging
    merge_logs: true,

    // Force restart on error
    force: true,

    // Handle process signals
    shutdown_with_message: true
  }]
};