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):
|
# Schritte (Reihenfolge ist kritisch):
|
||||||
# 1. Tests auf Server 137 ausführen (via SSH)
|
# 1. Tests auf Server 137 ausführen (via SSH)
|
||||||
# 2. Frontend bauen (lokal, npm run build)
|
# 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
|
# 4. Alembic-Migration auf Server ausführen
|
||||||
# 5. Service neustarten
|
# 5. Service neustarten
|
||||||
# 6. Health-Check (3 Versuche)
|
# 6. Health-Check (3 Versuche)
|
||||||
@@ -347,37 +347,30 @@ for server in "${SERVERS[@]}"; do
|
|||||||
SERVER_OK=true
|
SERVER_OK=true
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# SCHRITT 3: Backend synchronisieren
|
# SCHRITT 3: git pull vom Gitea
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
step "[$SERVER_SHORT] Schritt 3: Backend-Code synchronisieren"
|
step "[$SERVER_SHORT] Schritt 3: git pull (origin/main)"
|
||||||
info "rsync: $BACKEND_DIR/ → $server:$REMOTE_PATH/backend/"
|
|
||||||
|
|
||||||
RSYNC_EXCLUDE=(
|
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"
|
||||||
"--exclude=__pycache__"
|
|
||||||
"--exclude=*.pyc"
|
|
||||||
"--exclude=.env"
|
|
||||||
"--exclude=venv/"
|
|
||||||
"--exclude=.git/"
|
|
||||||
"--exclude=*.egg-info/"
|
|
||||||
"--exclude=.pytest_cache/"
|
|
||||||
"--exclude=htmlcov/"
|
|
||||||
"--exclude=.coverage"
|
|
||||||
)
|
|
||||||
|
|
||||||
if run_rsync -avz "${RSYNC_EXCLUDE[@]}" \
|
if $OPT_DRYRUN; then
|
||||||
"$BACKEND_DIR/" \
|
echo -e " ${YELLOW}[DRY-RUN]${RESET} ssh $server \"$GIT_PULL_CMD\""
|
||||||
"$server:$REMOTE_PATH/backend/" ; then
|
step_record "3. git pull [$SERVER_SHORT]" "SKIP"
|
||||||
ok "Backend synchronisiert"
|
|
||||||
step_record "3. Backend-Sync [$SERVER_SHORT]" "OK"
|
|
||||||
else
|
else
|
||||||
RSYNC_RC=$?
|
GIT_OUTPUT=$(ssh -o ConnectTimeout=30 -o BatchMode=yes "$server" "$GIT_PULL_CMD" 2>&1)
|
||||||
fail "rsync FEHLGESCHLAGEN (Exit-Code: $RSYNC_RC)"
|
GIT_RC=$?
|
||||||
fail "Befehl war: rsync -avz ${RSYNC_EXCLUDE[*]} $BACKEND_DIR/ $server:$REMOTE_PATH/backend/"
|
echo "$GIT_OUTPUT" | while IFS= read -r line; do info "$line"; done
|
||||||
step_record "3. Backend-Sync [$SERVER_SHORT]" "FAIL"
|
if [ $GIT_RC -eq 0 ]; then
|
||||||
SERVER_OK=false
|
ok "git pull erfolgreich"
|
||||||
ALL_SERVERS_OK=false
|
step_record "3. git pull [$SERVER_SHORT]" "OK"
|
||||||
warn "Server $server wird übersprungen (rsync fehlgeschlagen)"
|
else
|
||||||
continue
|
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
|
fi
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user