From 5250ffcd52d1727e07d4b0bef4644b3e4c6b4340 Mon Sep 17 00:00:00 2001 From: sysops Date: Tue, 17 Mar 2026 20:32:10 +0100 Subject: [PATCH] fix(deploy): korrigiere update.sh Frontend-Standalone-Deployment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vorher: rsync --delete führte dazu dass FRONTEND_DIR nach dem Sync nur den _build/-Unterordner enthielt statt server.js direkt. Ursache: Next.js standalone spiegelt den absoluten Build-Pfad. Jetzt: FRONTEND_DIR wird vor dem Sync geleert (rm -rf) um veraltete Verzeichnisse zu entfernen; rsync ohne --delete kopiert den korrekten Standalone-Root direkt. Co-Authored-By: Claude Sonnet 4.6 --- update.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/update.sh b/update.sh index 6a98a25..cd3623a 100755 --- a/update.sh +++ b/update.sh @@ -65,6 +65,7 @@ fi info "Baue Go Backend..." cd "$BUILD_DIR" +go mod download CGO_ENABLED=1 go build -tags xapian -buildvcs=false -o "$BUILD_DIR/archivmail-new" ./cmd/archivmail/ log "Go Backend gebaut" @@ -103,14 +104,20 @@ ln -sf "$BIN_DIR/archivmail" /usr/local/bin/archivmail log "Backend eingespielt" info "Spiele Frontend ein (standalone)..." +# Next.js standalone mirrors the absolute build path — find the dir that contains server.js. +# The path is typically: .next/standalone//server.js +STANDALONE_SERVER=$(find "$BUILD_DIR/.next/standalone" -maxdepth 3 -name "server.js" | head -1) +[[ -n "$STANDALONE_SERVER" ]] || die "server.js nicht im standalone-Build gefunden" +STANDALONE_ROOT=$(dirname "$STANDALONE_SERVER") +# Clean destination and copy fresh standalone output +rm -rf "$FRONTEND_DIR" mkdir -p "$FRONTEND_DIR" -# Next.js standalone mirrors the absolute build path — find the dir that contains server.js -STANDALONE_ROOT=$(dirname "$(find "$BUILD_DIR/.next/standalone" -name "server.js" | head -1)") -rsync -a --delete "$STANDALONE_ROOT/" "$FRONTEND_DIR/" +rsync -a "$STANDALONE_ROOT/" "$FRONTEND_DIR/" +# Copy static assets from the full build (standalone doesn't include them) mkdir -p "$FRONTEND_DIR/.next/static" rsync -a --delete "$BUILD_DIR/.next/static/" "$FRONTEND_DIR/.next/static/" if [[ -d "$BUILD_DIR/public" ]]; then - rsync -a --delete "$BUILD_DIR/public/" "$FRONTEND_DIR/public/" + rsync -a "$BUILD_DIR/public/" "$FRONTEND_DIR/public/" fi log "Frontend eingespielt"