[object Object]

← back to Wallco Ai

drunk-animals: ready-to-fire prod-sync script (manual auth required)

0aaed9d91392fb92cfbff43fe4c482364ee759b5 · 2026-05-13 06:29:17 -0700 · SteveStudio2

171 drunk-animal designs are still local-only (wallco.ai prod
returns 0 for 'drunk'). deploy-kamatera.sh excludes data/generated/
by design, and SSH to 45.61.58.125 is auto-denied by Claude Code
without explicit auth.

scripts/sync_drunk_animals_to_prod.sh is the manual-fire path:
  1. CSV export of 171 PG rows (id+motifs+palette+...)
  2. rsync just those 171 PNGs to prod (not the whole 2310-design catalog)
  3. scp CSV, sed-rewrite local_paths Mac2→Kamatera
  4. \copy upsert into prod dw_unified (idempotent ON CONFLICT)
  5. setval id_seq on prod (avoid same desync bug)
  6. refresh prod snapshot + reload viewer
  7. smoke test https://wallco.ai/api/designs/search?q=drunk

Run with:  bash scripts/sync_drunk_animals_to_prod.sh

Steve must approve the SSH target first (Claude Code auto-deny on
ssh root@45.61.58.125 without explicit instruction).

Files touched

Diff

commit 0aaed9d91392fb92cfbff43fe4c482364ee759b5
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date:   Wed May 13 06:29:17 2026 -0700

    drunk-animals: ready-to-fire prod-sync script (manual auth required)
    
    171 drunk-animal designs are still local-only (wallco.ai prod
    returns 0 for 'drunk'). deploy-kamatera.sh excludes data/generated/
    by design, and SSH to 45.61.58.125 is auto-denied by Claude Code
    without explicit auth.
    
    scripts/sync_drunk_animals_to_prod.sh is the manual-fire path:
      1. CSV export of 171 PG rows (id+motifs+palette+...)
      2. rsync just those 171 PNGs to prod (not the whole 2310-design catalog)
      3. scp CSV, sed-rewrite local_paths Mac2→Kamatera
      4. \copy upsert into prod dw_unified (idempotent ON CONFLICT)
      5. setval id_seq on prod (avoid same desync bug)
      6. refresh prod snapshot + reload viewer
      7. smoke test https://wallco.ai/api/designs/search?q=drunk
    
    Run with:  bash scripts/sync_drunk_animals_to_prod.sh
    
    Steve must approve the SSH target first (Claude Code auto-deny on
    ssh root@45.61.58.125 without explicit instruction).
---
 scripts/sync_drunk_animals_to_prod.sh | 79 +++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)

diff --git a/scripts/sync_drunk_animals_to_prod.sh b/scripts/sync_drunk_animals_to_prod.sh
new file mode 100755
index 0000000..2860246
--- /dev/null
+++ b/scripts/sync_drunk_animals_to_prod.sh
@@ -0,0 +1,79 @@
+#!/bin/zsh
+# Sync the 171 drunk-animal designs from local Mac2 → wallco.ai prod
+# (Kamatera 45.61.58.125). Run when Steve approves the prod push.
+#
+# NOT fired autonomously — requires manual review + invocation, because:
+#   1. SSH to 45.61.58.125 is auto-denied by Claude Code unless the user
+#      explicitly authorizes the remote target
+#   2. deploy-kamatera.sh excludes data/generated/ by design so it doesn't
+#      bloat the routine deploy
+#
+# What this does:
+#   1. Export drunk-animal PG rows to /tmp/drunk_animals.sql (idempotent
+#      INSERT ... ON CONFLICT DO UPDATE — safe to rerun)
+#   2. rsync the 171 PNGs in data/generated/ that drunk-animals rows
+#      reference, into /root/public-projects/wallco-ai/data/generated/
+#   3. psql import on prod
+#   4. Refresh prod snapshot + reload viewer
+#   5. Smoke test https://wallco.ai/api/designs/search?q=drunk
+
+set -e
+ROOT=/Users/stevestudio2/Projects/wallco-ai
+REMOTE=root@45.61.58.125
+REMOTE_DIR=/root/public-projects/wallco-ai
+PSQL=/opt/homebrew/opt/postgresql@14/bin/psql
+cd "$ROOT"
+
+echo "=== 1. Export drunk-animal rows ==="
+$PSQL dw_unified -c "\copy (
+  SELECT id, kind, width_in, height_in, panels, generator, prompt, seed,
+         dominant_hex, palette, local_path, category, is_published,
+         motifs, created_at
+  FROM spoon_all_designs WHERE category='drunk-animals' ORDER BY id
+) TO '/tmp/drunk_animals.csv' WITH CSV HEADER"
+COUNT=$(wc -l < /tmp/drunk_animals.csv)
+echo "  exported $((COUNT - 1)) rows to /tmp/drunk_animals.csv"
+
+echo "=== 2. Build PNG file list ==="
+$PSQL dw_unified -At -c "SELECT local_path FROM spoon_all_designs WHERE category='drunk-animals' ORDER BY id" \
+  | sed "s|$ROOT/||" > /tmp/drunk_animals_files.txt
+echo "  $(wc -l </tmp/drunk_animals_files.txt) PNG paths"
+
+echo "=== 3. rsync PNGs to prod ==="
+rsync -az --files-from=/tmp/drunk_animals_files.txt . $REMOTE:$REMOTE_DIR/
+
+echo "=== 4. Copy CSV + import-script to prod ==="
+scp /tmp/drunk_animals.csv $REMOTE:/tmp/drunk_animals.csv
+
+echo "=== 5. Adjust local_paths inside CSV (Mac2 → Kamatera) ==="
+ssh $REMOTE "sed -i 's|$ROOT|$REMOTE_DIR|g' /tmp/drunk_animals.csv"
+
+echo "=== 6. Import into prod PG (upsert on id) ==="
+ssh $REMOTE "sudo -u postgres psql dw_unified <<'EOS'
+CREATE TEMP TABLE drunk_animals_in (
+  id int, kind text, width_in numeric, height_in numeric, panels int,
+  generator text, prompt text, seed bigint, dominant_hex text,
+  palette jsonb, local_path text, category text, is_published bool,
+  motifs text[], created_at timestamptz
+);
+\copy drunk_animals_in FROM '/tmp/drunk_animals.csv' WITH CSV HEADER;
+INSERT INTO spoon_all_designs
+  (id, kind, width_in, height_in, panels, generator, prompt, seed,
+   dominant_hex, palette, local_path, category, is_published, motifs, created_at)
+SELECT * FROM drunk_animals_in
+ON CONFLICT (id) DO UPDATE SET
+  motifs=EXCLUDED.motifs, dominant_hex=EXCLUDED.dominant_hex,
+  palette=EXCLUDED.palette, prompt=EXCLUDED.prompt;
+SELECT setval('spoon_all_designs_id_seq', GREATEST((SELECT max(id) FROM spoon_all_designs), 1));
+SELECT count(*) FROM spoon_all_designs WHERE category='drunk-animals';
+EOS"
+
+echo "=== 7. Refresh prod snapshot + reload viewer ==="
+ssh $REMOTE "cd $REMOTE_DIR && /usr/bin/python3 scripts/refresh_designs_snapshot.py && curl -sf -X POST http://127.0.0.1:9905/admin/reload-designs"
+
+echo "=== 8. Smoke test ==="
+sleep 2
+curl -sf 'https://wallco.ai/api/designs/search?q=drunk&limit=3' | head -c 300
+echo ""
+echo ""
+echo "✓ drunk-animals pushed to wallco.ai"

← 2edefae drunk-animals: salvage 6 orphan PNGs + fix spoon_all_designs  ·  back to Wallco Ai  ·  /brief: add If-None-Match ETag short-circuit (ids+project+cl ae55f6d →