← back to Nationalrealestate

ecosystem.config.cjs

17 lines

// pm2 config for usrealestate.
// Runs tsx via `node --import` so pm2 supervises the ACTUAL node PID (the port
// holder) — NOT a `bash -c npx tsx` wrapper whose node grandchild detaches on
// restart, holds :9913, and forces an EADDRINUSE crash-loop (the 186k-restart bug).
// cwd defaults to this file's dir. Env comes from .env via `import 'dotenv/config'`.
module.exports = {
  apps: [{
    name: 'usrealestate',
    script: 'src/server/index.ts',
    interpreter: 'node',
    interpreter_args: '--import tsx',
    autorestart: true,
    max_restarts: 10,      // fail loud instead of churning 186k times
    min_uptime: '15s',
  }],
};