← back to Dw Pairs Well
add reload-visual-search.sh: resolve :9914 owner by listening port, not name substring
f89ae0bda4110eba597f5329cd14e308c409e627 · 2026-07-13 10:57:35 -0700 · Steve Abrams
block2's resolver matched paint-visualizer-agent (substring 'visual' in visualizer)
instead of the real :9914 service, so the rsynced search_service.py (new /pairwise +
ACTIVE+published load() join) was never loaded. This resolves by the bound port.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Files touched
A deploy/reload-visual-search.sh
Diff
commit f89ae0bda4110eba597f5329cd14e308c409e627
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Mon Jul 13 10:57:35 2026 -0700
add reload-visual-search.sh: resolve :9914 owner by listening port, not name substring
block2's resolver matched paint-visualizer-agent (substring 'visual' in visualizer)
instead of the real :9914 service, so the rsynced search_service.py (new /pairwise +
ACTIVE+published load() join) was never loaded. This resolves by the bound port.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---
deploy/reload-visual-search.sh | 47 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/deploy/reload-visual-search.sh b/deploy/reload-visual-search.sh
new file mode 100644
index 0000000..bbc7719
--- /dev/null
+++ b/deploy/reload-visual-search.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# Restart the pm2 process that ACTUALLY listens on :9914 so it loads the freshly
+# rsynced search_service.py (new POST /pairwise handler + ACTIVE+published load() join).
+# block2-clip-flip.sh resolved the process by name substring "visual", which wrongly
+# matched paint-visualizer-agent (visuali-ZER) and restarted the wrong service. This
+# resolves by the listening port — deterministic, no name guessing.
+# RUN FROM MAC2: bash ~/Projects/dw-pairs-well/deploy/reload-visual-search.sh
+set -euo pipefail
+
+ssh root@45.61.58.125 'set -e
+ # PID bound to :9914 (try ss, fall back to lsof)
+ PORTPID=$(ss -ltnpH "sport = :9914" 2>/dev/null | grep -oE "pid=[0-9]+" | head -1 | cut -d= -f2)
+ [ -z "${PORTPID:-}" ] && PORTPID=$(lsof -tiTCP:9914 -sTCP:LISTEN 2>/dev/null | head -1)
+ [ -n "${PORTPID:-}" ] || { echo "ABORT: nothing is listening on :9914"; exit 1; }
+ echo ":9914 is served by pid $PORTPID"
+
+ # map that pid (or its pm2 wrapper) to a pm2 process name
+ PROC=$(pm2 jlist | PORTPID="$PORTPID" python3 -c "
+import sys, json, os
+want = int(os.environ[\"PORTPID\"])
+for p in json.load(sys.stdin):
+ if p.get(\"pid\") == want:
+ print(p[\"name\"]); break
+")
+ # fall back: match by cwd/script path containing the visual-search dir
+ if [ -z "${PROC:-}" ]; then
+ PROC=$(pm2 jlist | python3 -c "
+import sys, json
+for p in json.load(sys.stdin):
+ env = p.get(\"pm2_env\", {})
+ path = (env.get(\"pm_cwd\",\"\") + \" \" + env.get(\"pm_exec_path\",\"\")).lower()
+ if \"visual-search\" in path and \"paint\" not in p[\"name\"].lower():
+ print(p[\"name\"]); break
+")
+ fi
+ [ -n "${PROC:-}" ] || { echo "ABORT: could not map :9914 pid $PORTPID to a pm2 process — pm2 ls and restart manually"; exit 1; }
+ echo "restarting pm2 process on :9914 -> $PROC"
+ pm2 restart "$PROC"
+ sleep 25
+ echo -n "health after reload: "; curl -sf http://127.0.0.1:9914/health || { echo "ABORT: :9914 unhealthy after restart"; exit 1; }
+ echo
+ # confirm the new endpoint is live now
+ echo -n "/pairwise present: "
+ curl -s -o /dev/null -w "%{http_code}\n" -X POST http://127.0.0.1:9914/pairwise \
+ -H "Content-Type: application/json" -d "{\"dw_sku\":\"BGA-47951\",\"candidates\":[\"BGA-47951\"]}"
+'
+echo "done. 200/4xx (not 404) on /pairwise means the new service is loaded."
← fbc4aba auto-save: 2026-07-13T10:54:28 (1 files) — scripts/pipe-titl
·
back to Dw Pairs Well
·
similar: flag archived/non-live source with 'archived' + rea 5c2a34e →