← back to Homesonspec
TK-10001: deploy-kamatera.sh frees :9975/:9976 from orphaned next-servers before pm2 start (fixes EADDRINUSE crash-loop that hung homesonspec.com web tier)
be9e4af2687e74a1a167e8c4606e05588bf2f911 · 2026-08-12 07:03:11 -0700 · Steve
Files touched
Diff
commit be9e4af2687e74a1a167e8c4606e05588bf2f911
Author: Steve <steve@designerwallcoverings.com>
Date: Wed Aug 12 07:03:11 2026 -0700
TK-10001: deploy-kamatera.sh frees :9975/:9976 from orphaned next-servers before pm2 start (fixes EADDRINUSE crash-loop that hung homesonspec.com web tier)
---
deploy-kamatera.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/deploy-kamatera.sh b/deploy-kamatera.sh
index fb221eed..03b03e3a 100755
--- a/deploy-kamatera.sh
+++ b/deploy-kamatera.sh
@@ -79,6 +79,9 @@ pnpm --filter @homesonspec/admin build 2>&1 | tail -3"
echo "──────── 5/6 pm2 (explicit PORT — the bug that 502'd) ────────"
ssh $KH "cd $REMOTE; export PATH=\$PATH:/root/.npm-global/bin:/usr/local/bin; set -a; . $REMOTE/.env; set +a
pm2 delete homesonspec-web homesonspec-admin homesonspec-workers 2>/dev/null || true
+# Free the ports from any ORPHANED next-server not managed by pm2 (a stale process squatting
+# on :$WEB_PORT/:$ADMIN_PORT makes 'next start' EADDRINUSE-crash-loop forever — TK-10001 incident).
+for P in $WEB_PORT $ADMIN_PORT; do fuser -k \$P/tcp 2>/dev/null || true; done; sleep 2
PORT=$WEB_PORT pm2 start 'pnpm --filter @homesonspec/web start' --name homesonspec-web --time
PORT=$ADMIN_PORT pm2 start 'pnpm --filter @homesonspec/admin start' --name homesonspec-admin --time
cd $REMOTE/apps/workers; pm2 start src/index.ts --name homesonspec-workers --interpreter node --interpreter-args='--env-file=$REMOTE/.env --import tsx' --time
← 303b860f TK-10001 go-live: activate+ingest mi-homes(25)+smith-douglas
·
back to Homesonspec
·
HomesOnSpec: property detail parcel/public-records block + h 4d9cd041 →