module.exports = {
  apps: [{
    name: 'workroot-website',
    script: './server.mjs',
    instances: 'max',
    exec_mode: 'cluster',
    env: {
      NODE_ENV: 'production',
      HOST: '0.0.0.0',
      PORT: 10000
    },
    env_development: {
      NODE_ENV: 'development',
      HOST: '0.0.0.0',
      PORT: 10000
    },
    // Logging
    error_file: './logs/error.log',
    out_file: './logs/out.log',
    log_file: './logs/combined.log',
    time: true,

    // Auto-restart configuration
    max_memory_restart: '1G',
    autorestart: true,
    watch: false,

    // Graceful shutdown
    kill_timeout: 5000,
    wait_ready: true,

    // Additional settings
    merge_logs: true,
    log_date_format: 'YYYY-MM-DD HH:mm:ss Z'
  }]
};
