← back to Wallco Ai

ecosystem.wallco-ai-9878.config.js

34 lines

// Companion pm2 config for the live editor instance running on port 9878.
// Adds restart-loop guards (min_uptime + max_restarts + restart_delay) so an
// external SIGINT storm — e.g. parallel claude sessions running `pm2 restart`
// concurrently — can't churn the process indefinitely.
//
// SIGINTs spaced >60s apart still succeed (cron reload pattern); a tight
// loop of SIGINTs <60s apart will be capped at 5 and pm2 will stop respawning,
// surfacing the trigger instead of hiding it as background churn.

module.exports = {
  apps: [{
    name: 'wallco-ai-9878',
    script: 'server.js',
    cwd: __dirname,
    exec_mode: 'fork',

    // restart-loop guards
    min_uptime: '60s',
    max_restarts: 5,
    restart_delay: 5000,
    autorestart: true,

    // env (server.js also reads .env via dotenv — these override)
    env: {
      NODE_ENV: 'production',
      PORT: '9878',
      HOST: '0.0.0.0',
      BIND: '0.0.0.0',
    },

    max_memory_restart: '800M',
  }],
};