[object Object]

← back to Govarbitrage

deploy: non-destructive db push + install prod cron (refresh @noon + liveness /15m)

0eefdaf96ec01ff9eec1c6e86c277a0c13bac51a · 2026-07-10 12:10:10 -0700 · Steve

Drop --force-reset (schema changes are additive; imports upsert) so deploys no
longer wipe live data. Install /etc/cron.d/govarbitrage so the live site self-
refreshes daily and sweeps dead listings every 15 min. Hot-deal alerts stay on
mac3 (George creds never touch prod).

Files touched

Diff

commit 0eefdaf96ec01ff9eec1c6e86c277a0c13bac51a
Author: Steve <steve@designerwallcoverings.com>
Date:   Fri Jul 10 12:10:10 2026 -0700

    deploy: non-destructive db push + install prod cron (refresh @noon + liveness /15m)
    
    Drop --force-reset (schema changes are additive; imports upsert) so deploys no
    longer wipe live data. Install /etc/cron.d/govarbitrage so the live site self-
    refreshes daily and sweeps dead listings every 15 min. Hot-deal alerts stay on
    mac3 (George creds never touch prod).
---
 scripts/deploy-auctions.sh | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/scripts/deploy-auctions.sh b/scripts/deploy-auctions.sh
index ed4dad2..53a893d 100755
--- a/scripts/deploy-auctions.sh
+++ b/scripts/deploy-auctions.sh
@@ -35,10 +35,12 @@ echo "  npm install"
 npm install --no-audit --no-fund
 echo "  prisma generate + db push"
 npx prisma generate
-# The pre-existing DB holds only 26 rows of disposable OLD-STUB seed on an
-# incompatible schema (enum type changes can't migrate in place). --force-reset
-# rebuilds the schema clean; the seed + free-feed imports below repopulate it.
-npx prisma db push --skip-generate --force-reset
+# NON-destructive push: our schema changes are additive (new enum values, new
+# ListingStatus enum, new nullable/defaulted columns), so they apply in place
+# WITHOUT wiping the live listings. (The old --force-reset was only needed for
+# the very first deploy over the incompatible stub schema.) The free-feed
+# imports below UPSERT by (source, sourceAuctionId), so re-running just refreshes.
+npx prisma db push --skip-generate
 echo "  build"
 npm run build
 echo "  seed users (+ demo) then import FREE feeds (\$0)"
@@ -52,6 +54,21 @@ npx tsx scripts/import-govplanet-free.ts 120 || true
 echo "  restart pm2"
 pm2 restart govarbitrage --update-env
 pm2 save
+
+echo "  install prod cron (auto-refresh + liveness) — self-maintaining live site"
+mkdir -p /root/public-projects/govarbitrage/logs
+# cron runs with a minimal PATH; bake in node's bin dir resolved right now.
+NODE_BIN="$(dirname "$(command -v node)")"
+cat > /etc/cron.d/govarbitrage <<CRON
+SHELL=/bin/bash
+PATH=$NODE_BIN:/usr/local/bin:/usr/bin:/bin
+# Refresh all 6 free feeds daily at 12:00 (UPSERT — keeps the live site fresh).
+0 12 * * * root cd /root/public-projects/govarbitrage && ( npx tsx scripts/import-govdeals-free.ts 120; npx tsx scripts/import-gsa.ts 200; npx tsx scripts/import-grays.ts 100; npx tsx scripts/import-municibid-free.ts 100; npx tsx scripts/import-publicsurplus-free.ts 100; npx tsx scripts/import-govplanet-free.ts 120 ) >> logs/refresh.log 2>&1
+# Fast dead-listing sweep every 15 min (Tier1 instant-expire + Tier2 verify).
+*/15 * * * * root cd /root/public-projects/govarbitrage && npx tsx scripts/liveness-sweep.ts 40 >> logs/liveness.log 2>&1
+CRON
+chmod 0644 /etc/cron.d/govarbitrage
+echo "  cron installed: refresh @12:00, liveness every 15m (PATH node=$NODE_BIN)"
 REMOTE
 
 echo "▶ smoke test"

← e9ed2a5 Add HOT DEAL alerts + fast dead-listing removal + listing li  ·  back to Govarbitrage  ·  Unified admin credential (admin@agentabrams.com) durable acr 6b2f576 →