hebammekrystyna/deploy_flask.sh
2026-04-14 14:13:01 +02:00

102 lines
2.7 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -euo pipefail
SRC_ROOT="/Volumes/MacBook SD/Projekte/HebammeKrystyna"
DST_ROOT="/Volumes/docker/flask-postgres/app-hebammekrystyna"
NAS_USER="BKolb"
NAS_HOST="192.168.0.10"
CONTAINER_NAME="flask_hebammekrystyna"
echo "🚀 Starte Deployment..."
[ -d "$SRC_ROOT" ] || { echo "❌ Quelle fehlt: $SRC_ROOT"; exit 1; }
[ -d "$DST_ROOT" ] || { echo "❌ Ziel fehlt: $DST_ROOT"; exit 1; }
########################################
# 1. CORE CODE (ohne images/styles/files)
########################################
echo "📦 Synchronisiere Core-Projektdateien ..."
rsync -av --delete \
--exclude '.DS_Store' \
--exclude '._*' \
--exclude '__pycache__/' \
--exclude '*.pyc' \
--exclude '*.pyo' \
--exclude '*.log' \
--exclude '.git/' \
--exclude '.venv/' \
--exclude 'venv/' \
--exclude 'node_modules/' \
--exclude 'files/' \
--exclude 'images/' \
--exclude 'styles/' \
"$SRC_ROOT/" "$DST_ROOT/"
########################################
# 2. IMAGES
########################################
echo "🖼️ Synchronisiere images/ ..."
if [ -d "$SRC_ROOT/images" ]; then
mkdir -p "$DST_ROOT/images"
rsync -av --delete \
--exclude '.DS_Store' \
--exclude '._*' \
"$SRC_ROOT/images/" "$DST_ROOT/images/"
else
echo "⚠️ images/ nicht gefunden übersprungen."
fi
########################################
# 3. STYLES
########################################
echo "🎨 Synchronisiere styles/ ..."
if [ -d "$SRC_ROOT/styles" ]; then
mkdir -p "$DST_ROOT/styles"
rsync -av --delete \
--exclude '.DS_Store' \
--exclude '._*' \
"$SRC_ROOT/styles/" "$DST_ROOT/styles/"
else
echo "⚠️ styles/ nicht gefunden übersprungen."
fi
########################################
# 4. TEMPLATES
########################################
echo "📄 Synchronisiere templates/ ..."
if [ -d "$SRC_ROOT/templates" ]; then
mkdir -p "$DST_ROOT/templates"
rsync -av --delete \
--exclude '.DS_Store' \
--exclude '._*' \
"$SRC_ROOT/templates/" "$DST_ROOT/templates/"
else
echo "⚠️ templates/ nicht gefunden übersprungen."
fi
########################################
# 5. HINWEIS FILES
########################################
echo "📁 files/ wird bewusst NICHT synchronisiert."
########################################
# 6. OPTIONAL: CONTAINER RESTART
########################################
echo "🔄 Starte Container neu ... MANUELL zu tun"
#ssh "${NAS_USER}@${NAS_HOST}" "docker restart ${CONTAINER_NAME}" \
# && echo "✅ Container erfolgreich neu gestartet" \
# || echo "⚠️ Container konnte nicht neu gestartet werden"
########################################
# DONE
########################################
echo "🎉 Deployment abgeschlossen."