← back to Dw Pairs Well
deploy/KAMATERA-GOLIVE.md
59 lines
# Kamatera go-live — CLIP coordinates + link guarantee (one paste per block)
Discovery: Kamatera already hosts a visual-search stack at
`/root/public-projects/dwphoto/visual-search` (embed-daemon.sh targets it; service on
localhost :9914 with its OWN image_embeddings in Kamatera dw_unified). pairs-well's
default `VISUAL_SEARCH_URL` is `http://127.0.0.1:9914`, so NO tailnet exposure is needed.
## Block 1 — ship pairs-well (kills the bad links immediately)
```sh
cd ~/Projects/dw-pairs-well && bash ~/Projects/_shared/scripts/deploy.sh
```
Ships: ACTIVE+online_store_published gate on every suggestion path, no-store link
responses, color+texture-locked CLIP engine, PUB_SQL schema-drift guard, engine flags.
Boot log line to check: `[link-guarantee] online_store_published present — full ... gate on`
(if it says MISSING, Kamatera's mirror lacks the column — tell Claude, the app still runs
status-only). Zero UI changes.
## Block 2 — update Kamatera's visual-search + turn CLIP on (run on Mac2)
```sh
# push the updated service (adds /pairwise + the ACTIVE+published handle join) + gap embedder
rsync -az ~/Projects/dw-photo-capture/visual-search/search_service.py \
~/Projects/dw-photo-capture/visual-search/embed_shopify_gap.py \
root@45.61.58.125:/root/public-projects/dwphoto/visual-search/
ssh root@45.61.58.125 '
set -e
cd /root/public-projects/dwphoto/visual-search
# is the service running? restart whatever pm2 name owns :9914
pm2 restart $(pm2 jlist | python3 -c "import sys,json;[print(p[\"name\"]) for p in json.load(sys.stdin) if \"visual\" in p[\"name\"] or \"9914\" in str(p.pm2_env if False else p)]" 2>/dev/null || echo visual-search) || true
sleep 20 && curl -s http://127.0.0.1:9914/health
# embed the shopify-only gap on Kamatera (resumable; ~30-60 min first run)
export DW_UNIFIED_DB="$(grep ^DW_UNIFIED_DB= ../.env | cut -d= -f2-)"
nohup nice -n 15 python3 embed_shopify_gap.py --workers 16 > gap-embed.log 2>&1 &
# flip CLIP on for pairs + similar
cd /root/Projects/dw-pairs-well
grep -q PAIRS_CLIP_DEFAULT .env || printf "PAIRS_CLIP_DEFAULT=1\nSIMILAR_CLIP_DEFAULT=1\n" >> .env
pm2 restart dw-pairs-well
'
```
Caveats Claude could NOT pre-verify (prod SSH is Steve-gated):
- the pm2 process name owning :9914 on Kamatera (the restart line guesses; `pm2 ls | grep -i visual` to find it)
- whether Kamatera's dwphoto has the fine-tuned dw_clip_ft.pt (its index is internally
consistent either way — /similar works regardless)
- whether Kamatera dw_unified has online_store_published (Block 1's boot log answers it)
## Block 3 — prove it (run on Mac2, after Block 1)
```sh
cd ~/Projects/dw-pairs-well
BASE=https://pairs.designerwallcoverings.com N=8 bash tools/live-link-check.sh
```
Expect: `LINK GUARANTEE: PASS`. Or just tell Claude "verify live" and it runs this.
## Mac2 nightly coverage top-up (optional paste)
```sh
chmod +x ~/Projects/dw-photo-capture/visual-search/embed-nightly-mac2.sh
cp ~/Projects/dw-photo-capture/visual-search/com.steve.visual-search-embed-nightly.plist ~/Library/LaunchAgents/
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.steve.visual-search-embed-nightly.plist
```
Runs 4:20am daily: embeds new products (both embedders, resumable) + hot-reloads the index.