#!/usr/bin/env bash # deploy.sh — build and deploy BincioPlanner to planner.bincio.org # # Frontend: built by Vite, rsynced to /var/www/planner/ # Backend: server/ rsynced to the WorkingDirectory of bincio-planner.service, # then the service is restarted to pick up changes. set -e VPS=root@95.216.55.151 # ── Frontend ────────────────────────────────────────────────────────────────── echo "Building frontend…" VITE_ACTIVITY_URL=https://activity.bincio.org VITE_PLANNER_API_URL= npm run build echo "Deploying frontend…" rsync -az --delete dist/ "$VPS:/var/www/planner/" # ── Backend ─────────────────────────────────────────────────────────────────── echo "Deploying backend…" SERVER_DIR=$(ssh "$VPS" "systemctl show bincio-planner.service -p WorkingDirectory --value") if [[ -z "$SERVER_DIR" ]]; then echo "ERROR: could not read WorkingDirectory from bincio-planner.service" >&2 exit 1 fi rsync -az server/server.py server/pyproject.toml "$VPS:$SERVER_DIR/" echo "Restarting bincio-planner.service…" ssh "$VPS" "systemctl restart bincio-planner.service && systemctl is-active bincio-planner.service" echo "Deployed to planner.bincio.org"