modificato deploy verso contabo

This commit is contained in:
David Frassi
2026-06-17 01:04:27 +02:00
parent 2d23dcae83
commit 97a11d5074
24 changed files with 1063 additions and 64 deletions
+40 -12
View File
@@ -8,19 +8,41 @@ else
exit 1
fi
# --- Configurazione Parallelismo ---
THREADS=${1:-${FTP_THREADS:-100}}
# --- Configurazione Target e Parallelismo ---
TARGET="tophost"
THREADS=""
if [ "$1" = "contabo" ] || [ "$1" = "tophost" ]; then
TARGET="$1"
THREADS="$2"
else
# Se il primo argomento è un numero, indica il numero di thread per tophost
if [[ "$1" =~ ^[0-9]+$ ]]; then
THREADS="$1"
fi
fi
THREADS=${THREADS:-${FTP_THREADS:-100}}
export FTP_THREADS=$THREADS
# --- Configurazione FTP per ROOT www.canticristiani.it ---
FTP_HOST="ftp.canticristiani.it"
FTP_USER="canticristiani.it"
FTP_PASS="$FTP_PASSWORD"
REMOTE_DIR="" # Carica nella root della cartella FTP
echo "🎯 Target di deploy: $TARGET"
if [ -z "$FTP_PASS" ]; then
echo "❌ Errore: FTP_PASSWORD non definita nel file .env"
exit 1
# --- Validazione configurazione basata sul target ---
if [ "$TARGET" = "tophost" ]; then
FTP_HOST="ftp.canticristiani.it"
FTP_USER="canticristiani.it"
FTP_PASS="$FTP_PASSWORD"
REMOTE_DIR=""
if [ -z "$FTP_PASS" ]; then
echo "❌ Errore: FTP_PASSWORD non definita nel file .env"
exit 1
fi
else
if [ -z "$VPS_HOST" ] || [ -z "$VPS_USER" ] || [ -z "$VPS_PATH" ]; then
echo "❌ Errore: VPS_HOST, VPS_USER o VPS_PATH non definiti nel file .env"
exit 1
fi
fi
# --- Aggiornamento Versione ---
@@ -61,5 +83,11 @@ BUILD_TIMESTAMP=$(date +%s)000
echo "{\"version\":\"$VERSION\",\"buildTime\":$BUILD_TIMESTAMP}" > www/version.json
echo "📄 Generato version.json: v$VERSION (timestamp: $BUILD_TIMESTAMP)"
# --- Upload via FTP ---
python3 scratch/deploy_ftp.py
# --- Upload ---
if [ "$TARGET" = "tophost" ]; then
echo "🚀 Upload via FTP su Tophost in corso..."
python3 scratch/deploy_ftp.py
else
echo "🚀 Upload via SSH/rsync su Contabo ($VPS_HOST) in corso..."
rsync -avz --delete www/ "$VPS_USER@$VPS_HOST:$VPS_PATH"
fi