#!/bin/bash
# Sync coordinator files to the Orange Pi.
# Run from this PC whenever you want to push changes.
# Firmware flashing is always done locally — never synced.

REMOTE="root@192.168.1.133"
REMOTE_DIR="/opt/esp32_cluster/coordinator"

echo "[DEPLOY] Syncing coordinator to ${REMOTE}:${REMOTE_DIR}"

rsync -av --progress --delete \
  --exclude='events.db' \
  --exclude='__pycache__' \
  --exclude='*.pyc' \
  /home/sandbox/Documents/projects/esp32_cluster/coordinator/ \
  "${REMOTE}:${REMOTE_DIR}/"

echo "[DEPLOY] Done."
echo ""
echo "To restart services on the Orange Pi:"
echo "  ssh ${REMOTE} 'systemctl restart udp_ingest dashboard'"
echo ""
echo "To check service status:"
echo "  ssh ${REMOTE} 'systemctl status udp_ingest dashboard'"
