← back to Japan Enrich

deploy/UPDATE.md

38 lines

# Update the LIVE japan.designerwallcoverings.com viewer (code-only, zero data risk)

CONFIRMED LIVE FACTS (2026-07-06): pm2 `japan-viewer` runs from
`/root/Projects/japan-staging-viewer/viewer` on Kamatera and listens on **port 9934**
(NOT 9931 — that port is a different app on the box). nginx proxies japan. + china. to it.
Server-side staging is larger than local (sangetsu 18,272 / lilycolor 2,543 = 20,815 japan).

japan. is already live on Kamatera (pm2 `japan-viewer`, behind Basic Auth admin:DW2024!).
The distributor + import features live entirely in TWO code files — the distributor value
is derived at runtime, so we push ONLY the code and restart. **No staging file is touched,
no --delete, no DB write, no Shopify.** The live catalog data is preserved as-is.

Run from Mac2 (or prefix each with `! ` in the Claude prompt so output lands in-session):

```sh
# 1) discover the live working dir from pm2 (no guessing the path)
DIR=$(ssh root@45.61.58.125 "pm2 describe japan-viewer | awk -F'cwd' '/exec cwd/{print \$2}' | tr -d ': '")
echo "live dir → $DIR"

# 2) push ONLY the two code files
rsync -avz ~/Projects/japan-enrich/viewer-local/server.js       root@45.61.58.125:"$DIR/server.js"
rsync -avz ~/Projects/japan-enrich/viewer-local/public/index.html root@45.61.58.125:"$DIR/public/index.html"

# 3) restart + verify the distributor field is now live
ssh root@45.61.58.125 "pm2 restart japan-viewer >/dev/null && sleep 2 && \
  curl -s -u admin:DW2024! 'http://127.0.0.1:9934/api/products' | \
  python3 -c 'import sys,json;d=json.load(sys.stdin);print(\"total\",d[\"total\"],\"| distributor?\",\"distributor\" in (d[\"products\"] or [{}])[0])'"
# NOTE port 9934. Or verify publicly: curl -su admin:DW2024! https://japan.designerwallcoverings.com/api/products
```

Expect step 3 to print `distributor? True`. Then hard-reload
https://japan.designerwallcoverings.com (admin:DW2024!) to see the Goodrich chips,
Distributor facet/sort, and the ⤓ Import button + queue drawer.

## Rollback
`ssh root@45.61.58.125 "cd $DIR && git checkout server.js public/index.html && pm2 restart japan-viewer"`
(if the live dir is a git checkout; otherwise re-push the previous files).