update.sh: switch backend sync to git pull instead of rsync
Servers now have git repos initialized tracking origin/main. Step 3 does git pull --ff-only instead of rsync. Frontend dist is still rsynced since it's gitignored. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
# Schritte (Reihenfolge ist kritisch):
|
||||
# 1. Tests auf Server 137 ausführen (via SSH)
|
||||
# 2. Frontend bauen (lokal, npm run build)
|
||||
# 3. Backend-Code auf Server(n) synchronisieren (rsync)
|
||||
# 3. git pull origin main auf Server(n)
|
||||
# 4. Alembic-Migration auf Server ausführen
|
||||
# 5. Service neustarten
|
||||
# 6. Health-Check (3 Versuche)
|
||||
@@ -347,37 +347,30 @@ for server in "${SERVERS[@]}"; do
|
||||
SERVER_OK=true
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# SCHRITT 3: Backend synchronisieren
|
||||
# SCHRITT 3: git pull vom Gitea
|
||||
# -------------------------------------------------------------------------
|
||||
step "[$SERVER_SHORT] Schritt 3: Backend-Code synchronisieren"
|
||||
info "rsync: $BACKEND_DIR/ → $server:$REMOTE_PATH/backend/"
|
||||
step "[$SERVER_SHORT] Schritt 3: git pull (origin/main)"
|
||||
|
||||
RSYNC_EXCLUDE=(
|
||||
"--exclude=__pycache__"
|
||||
"--exclude=*.pyc"
|
||||
"--exclude=.env"
|
||||
"--exclude=venv/"
|
||||
"--exclude=.git/"
|
||||
"--exclude=*.egg-info/"
|
||||
"--exclude=.pytest_cache/"
|
||||
"--exclude=htmlcov/"
|
||||
"--exclude=.coverage"
|
||||
)
|
||||
GIT_PULL_CMD="git config --global --add safe.directory $REMOTE_PATH 2>/dev/null; cd $REMOTE_PATH && git pull --ff-only origin main 2>&1"
|
||||
|
||||
if run_rsync -avz "${RSYNC_EXCLUDE[@]}" \
|
||||
"$BACKEND_DIR/" \
|
||||
"$server:$REMOTE_PATH/backend/" ; then
|
||||
ok "Backend synchronisiert"
|
||||
step_record "3. Backend-Sync [$SERVER_SHORT]" "OK"
|
||||
if $OPT_DRYRUN; then
|
||||
echo -e " ${YELLOW}[DRY-RUN]${RESET} ssh $server \"$GIT_PULL_CMD\""
|
||||
step_record "3. git pull [$SERVER_SHORT]" "SKIP"
|
||||
else
|
||||
RSYNC_RC=$?
|
||||
fail "rsync FEHLGESCHLAGEN (Exit-Code: $RSYNC_RC)"
|
||||
fail "Befehl war: rsync -avz ${RSYNC_EXCLUDE[*]} $BACKEND_DIR/ $server:$REMOTE_PATH/backend/"
|
||||
step_record "3. Backend-Sync [$SERVER_SHORT]" "FAIL"
|
||||
SERVER_OK=false
|
||||
ALL_SERVERS_OK=false
|
||||
warn "Server $server wird übersprungen (rsync fehlgeschlagen)"
|
||||
continue
|
||||
GIT_OUTPUT=$(ssh -o ConnectTimeout=30 -o BatchMode=yes "$server" "$GIT_PULL_CMD" 2>&1)
|
||||
GIT_RC=$?
|
||||
echo "$GIT_OUTPUT" | while IFS= read -r line; do info "$line"; done
|
||||
if [ $GIT_RC -eq 0 ]; then
|
||||
ok "git pull erfolgreich"
|
||||
step_record "3. git pull [$SERVER_SHORT]" "OK"
|
||||
else
|
||||
fail "git pull FEHLGESCHLAGEN (Exit-Code: $GIT_RC)"
|
||||
step_record "3. git pull [$SERVER_SHORT]" "FAIL"
|
||||
SERVER_OK=false
|
||||
ALL_SERVERS_OK=false
|
||||
warn "Server $server wird übersprungen (git pull fehlgeschlagen)"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user