#!/usr/bin/env bash
# Run FROM YOUR COMPUTER to update the VPS over SSH (no password in repo — use SSH keys)
#
# Setup once on your PC:
#   ssh-copy-id root@YOUR_VPS_IP
#
# Usage:
#   export VPS_HOST=root@123.456.789.0
#   export APP_DIR=/var/www/saas-accounting
#   bash scripts/deploy/deploy-to-vps.sh
#
set -euo pipefail

VPS_HOST="${VPS_HOST:?Set VPS_HOST e.g. root@123.456.789.0}"
APP_DIR="${APP_DIR:-/var/www/saas-accounting}"

echo "== Deploying to ${VPS_HOST} =="

ssh -o BatchMode=yes "${VPS_HOST}" "cd '${APP_DIR}' && bash scripts/deploy/vps-update.sh"

echo "== Done. Check: https://test.duiclick.com =="
