fix(deploy): update.sh an tatsächliche Server-Struktur anpassen
- FRONTEND_DIR: /opt/archivmail/frontend → /opt/archivmail/web - Go Build: CGO_ENABLED=1 -tags xapian -buildvcs=false (Xapian-Support) - Frontend: standalone-Output deployen statt .next/ direkt - Services: archivmail-frontend → archivmail-web Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -21,7 +21,7 @@ die() { echo -e "${RED}[ERR]${NC} $*" >&2; exit 1; }
|
||||
REPO_URL="${REPO_URL:-https://gitea.perlbach24.de/scripte/archivmail.git}"
|
||||
INSTALL_DIR="/opt/archivmail"
|
||||
BUILD_DIR="/opt/archivmail/_build"
|
||||
FRONTEND_DIR="/opt/archivmail/frontend"
|
||||
FRONTEND_DIR="/opt/archivmail/web"
|
||||
BIN_DIR="/opt/archivmail/bin"
|
||||
|
||||
echo ""
|
||||
@@ -55,7 +55,7 @@ fi
|
||||
|
||||
info "Baue Go Backend..."
|
||||
cd "$BUILD_DIR"
|
||||
go build -o "$BUILD_DIR/archivmail-new" ./cmd/archivmail/
|
||||
CGO_ENABLED=1 go build -tags xapian -buildvcs=false -o "$BUILD_DIR/archivmail-new" ./cmd/archivmail/
|
||||
log "Go Backend gebaut"
|
||||
|
||||
# ── Next.js Frontend bauen ────────────────────────────────────────────────
|
||||
@@ -71,8 +71,8 @@ log "Frontend gebaut"
|
||||
# ── Dienste stoppen ───────────────────────────────────────────────────────
|
||||
|
||||
info "Stoppe Dienste..."
|
||||
systemctl stop archivmail-frontend 2>/dev/null || warn "archivmail-frontend nicht aktiv"
|
||||
systemctl stop archivmail 2>/dev/null || warn "archivmail nicht aktiv"
|
||||
systemctl stop archivmail-web 2>/dev/null || warn "archivmail-web nicht aktiv"
|
||||
systemctl stop archivmail 2>/dev/null || warn "archivmail nicht aktiv"
|
||||
|
||||
# ── Dateien einspielen ────────────────────────────────────────────────────
|
||||
|
||||
@@ -83,17 +83,14 @@ chmod +x "$BIN_DIR/archivmail"
|
||||
ln -sf "$BIN_DIR/archivmail" /usr/local/bin/archivmail
|
||||
log "Backend eingespielt"
|
||||
|
||||
info "Spiele Frontend ein..."
|
||||
info "Spiele Frontend ein (standalone)..."
|
||||
mkdir -p "$FRONTEND_DIR"
|
||||
rsync -a --delete \
|
||||
"$BUILD_DIR/.next/" "$FRONTEND_DIR/.next/" \
|
||||
2>/dev/null || cp -r "$BUILD_DIR/.next/." "$FRONTEND_DIR/.next/"
|
||||
cp "$BUILD_DIR/package.json" "$FRONTEND_DIR/package.json"
|
||||
cp "$BUILD_DIR/package-lock.json" "$FRONTEND_DIR/package-lock.json"
|
||||
cp "$BUILD_DIR/next.config.ts" "$FRONTEND_DIR/next.config.ts"
|
||||
|
||||
cd "$FRONTEND_DIR"
|
||||
npm ci --omit=dev --prefer-offline 2>/dev/null || npm ci --omit=dev
|
||||
rsync -a --delete "$BUILD_DIR/.next/standalone/" "$FRONTEND_DIR/"
|
||||
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/"
|
||||
fi
|
||||
log "Frontend eingespielt"
|
||||
|
||||
# ── Datenbankmigrationen (falls vorhanden) ────────────────────────────────
|
||||
@@ -108,7 +105,7 @@ fi
|
||||
|
||||
info "Starte Dienste..."
|
||||
systemctl start archivmail
|
||||
systemctl start archivmail-frontend
|
||||
systemctl start archivmail-web
|
||||
log "Dienste gestartet"
|
||||
|
||||
# ── Status prüfen ─────────────────────────────────────────────────────────
|
||||
@@ -117,8 +114,8 @@ sleep 2
|
||||
BACKEND_OK=0
|
||||
FRONTEND_OK=0
|
||||
|
||||
systemctl is-active --quiet archivmail && BACKEND_OK=1
|
||||
systemctl is-active --quiet archivmail-frontend && FRONTEND_OK=1
|
||||
systemctl is-active --quiet archivmail && BACKEND_OK=1 || true
|
||||
systemctl is-active --quiet archivmail-web && FRONTEND_OK=1 || true
|
||||
|
||||
echo ""
|
||||
echo " ┌──────────────────────────────────────┐"
|
||||
@@ -130,4 +127,4 @@ echo " └───────────────────────
|
||||
echo ""
|
||||
|
||||
[[ $BACKEND_OK -eq 1 && $FRONTEND_OK -eq 1 ]] && log "Update abgeschlossen." \
|
||||
|| warn "Ein oder mehrere Dienste sind nicht aktiv. Prüfe: journalctl -u archivmail -u archivmail-frontend"
|
||||
|| warn "Ein oder mehrere Dienste sind nicht aktiv. Prüfe: journalctl -u archivmail -u archivmail-web"
|
||||
|
||||
Reference in New Issue
Block a user