← back to Nationalrealestate
usre: pm2 ecosystem runs 'node --import tsx' directly (orphan-proof)
be069fc2755b92e836491ea506f3ba4e55cf6662 · 2026-08-12 12:24:06 -0700 · Steve Abrams
Replaces the 'bash -c npx tsx' start command whose detached node grandchild
held :9913 across restarts -> EADDRINUSE crash-loop (186519 restarts, TK-10496).
pm2 now supervises the actual node PID. max_restarts:10 + min_uptime:15s so a
future crash fails loud instead of churning.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Files touched
Diff
commit be069fc2755b92e836491ea506f3ba4e55cf6662
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Wed Aug 12 12:24:06 2026 -0700
usre: pm2 ecosystem runs 'node --import tsx' directly (orphan-proof)
Replaces the 'bash -c npx tsx' start command whose detached node grandchild
held :9913 across restarts -> EADDRINUSE crash-loop (186519 restarts, TK-10496).
pm2 now supervises the actual node PID. max_restarts:10 + min_uptime:15s so a
future crash fails loud instead of churning.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
ecosystem.config.cjs | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/ecosystem.config.cjs b/ecosystem.config.cjs
new file mode 100644
index 0000000..d82eb2e
--- /dev/null
+++ b/ecosystem.config.cjs
@@ -0,0 +1,16 @@
+// 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',
+ }],
+};
← 095c0c2 scripts: safe usre contractor code deploy (backup+smoke+roll
·
back to Nationalrealestate
·
usre /api/brokers: default to affiliated-only (agent must ha 5ddf920 →