← back to Re Flyer Aggregator

scripts/sync-viewer-data-to-kamatera.sh

18 lines

#!/bin/bash
# Push the fresh /search + / viewer data to the LIVE Kamatera re-flyers-viewer
# (pm2 re-flyers-viewer :9906, https://reflyers.designerwallcoverings.com).
# Called at the end of dtt-cron.sh (4x/day) so prod tracks Mac2's regen. $0 (local rsync).
# Data-only: the app code/HTML/nav-agent is deployed separately; this ships just the JSON.
set -euo pipefail
export PATH="/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin"
cd "$(dirname "$0")/.."
DEST=root@45.61.58.125:/root/public-projects/re-flyer-aggregator
# -R preserves each file's relative path, so they land at the matching prod path in one pass.
rsync -azR -e ssh \
  public/flyers/flyers.json \
  data/article-archive.json \
  public/sources.json \
  public/advertising/broker-ad-signals.json \
  "$DEST/"
echo "synced viewer data to Kamatera $(date '+%Y-%m-%d %H:%M:%S')"