Files
MatchLiveTv/scripts/deploy/sync_to_server.sh
T
eminuxandCursor cc96c0396a Migliora sessioni admin e rende robusto il logout web.
Aggiunge filtri/colonne (società, orari) e dettaglio leggibile; evita 422 CSRF su logout e non cancella le cover slate custom in sync prod.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-20 20:41:12 +02:00

46 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# Sincronizza il monorepo sul server di produzione (pre-Gitea)
set -euo pipefail
SERVER="${DEPLOY_SERVER:-eminux@192.168.1.146}"
DEST="${DEPLOY_PATH:-/opt/matchlivetv}"
SRC="$(cd "$(dirname "$0")/../.." && pwd)"
echo "Sync $SRC -> $SERVER:$DEST"
if ssh "$SERVER" 'command -v rsync >/dev/null 2>&1'; then
rsync -avz --delete \
--exclude '.git' \
--exclude 'native/android/build' \
--exclude 'native/android/.gradle' \
--exclude 'native/android/app/build' \
--exclude 'native/android/dist' \
--exclude 'native/android/keystore' \
--exclude 'native/android/keystore.properties' \
--exclude 'native/android/local.properties' \
--exclude 'backend/log' \
--exclude 'backend/tmp' \
--exclude 'backend/.bundle' \
--exclude 'infra/.env' \
--exclude 'infra/slates/custom/' \
--exclude 'infra/garage/garage.prod.toml' \
--exclude 'infra/garage/prod-credentials.env' \
--exclude 'log/' \
--exclude 'node_modules' \
"$SRC/" "$SERVER:$DEST/"
else
echo "rsync non disponibile sul server, uso tar+scp..."
tar -C "$SRC" -czf /tmp/matchlivetv-deploy.tar.gz \
--exclude='./native/android/build' --exclude='./native/android/.gradle' \
--exclude='./native/android/app/build' --exclude='./native/android/dist' \
--exclude='./native/android/keystore' --exclude='./native/android/keystore.properties' \
--exclude='./backend/log' --exclude='./backend/tmp' --exclude='./infra/.env' \
--exclude='./infra/garage/garage.prod.toml' --exclude='./.git' .
scp /tmp/matchlivetv-deploy.tar.gz "$SERVER:~/matchlivetv-deploy.tar.gz"
ssh "$SERVER" "mkdir -p $DEST && tar -xzf ~/matchlivetv-deploy.tar.gz -C $DEST"
fi
echo "Done. On server run:"
echo " cd $DEST/infra && cp .env.production.example .env # edit secrets"
echo " docker compose -f docker-compose.prod.yml up -d --build"