← back to Ventura Corridor
auto-save: 2026-07-13T10:54:28 (1 files) — scripts/push-news-snapshot.sh
28b0f74f7c05dddbf64fe0248832b40739400cea · 2026-07-13 10:54:32 -0700 · Steve Abrams
Files touched
A scripts/push-news-snapshot.sh
Diff
commit 28b0f74f7c05dddbf64fe0248832b40739400cea
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Mon Jul 13 10:54:32 2026 -0700
auto-save: 2026-07-13T10:54:28 (1 files) — scripts/push-news-snapshot.sh
---
scripts/push-news-snapshot.sh | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/scripts/push-news-snapshot.sh b/scripts/push-news-snapshot.sh
new file mode 100644
index 0000000..0f80a9c
--- /dev/null
+++ b/scripts/push-news-snapshot.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+# Nightly news_items sync: mac3 local DB (where the 2am crawl + summarizer write)
+# → prod ventura_corridor on Kamatera (which has no crawl and no local Ollama).
+# Full-table replace in one transaction; 229-row scale, sub-second.
+# Scheduled 06:00 via com.steve.ventura-news-push (after the summarize cycles).
+set -euo pipefail
+export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
+export PGHOST=/tmp
+LOG="$HOME/.claude/run-notes/ventura-news-push.log"
+ts() { date '+%Y-%m-%d %H:%M:%S'; }
+
+LOCAL_N=$(psql -d ventura_corridor -Atc "SELECT count(*) FROM news_items")
+if [ -z "$LOCAL_N" ] || [ "$LOCAL_N" -eq 0 ]; then
+ echo "[$(ts)] ABORT — local news_items empty/unreadable (refusing to wipe prod)" >> "$LOG"; exit 1
+fi
+
+pg_dump -d ventura_corridor --no-owner --no-privileges --clean --if-exists -t news_items \
+ | ssh -o ConnectTimeout=15 my-server 'sudo -u postgres psql -d ventura_corridor -v ON_ERROR_STOP=1 -q
+ sudo -u postgres psql -d ventura_corridor -q -c "GRANT SELECT ON news_items TO PUBLIC"'
+
+PROD_N=$(ssh -o ConnectTimeout=15 my-server 'sudo -u postgres psql -d ventura_corridor -Atc "SELECT count(*) FROM news_items"')
+if [ "$PROD_N" = "$LOCAL_N" ]; then
+ echo "[$(ts)] OK — pushed $LOCAL_N news_items to prod" >> "$LOG"
+else
+ echo "[$(ts)] MISMATCH — local=$LOCAL_N prod=$PROD_N" >> "$LOG"; exit 1
+fi
← e4101a6 move tsx to runtime dependencies — prod launches via tsx, --
·
back to Ventura Corridor
·
(newest)