diff --git a/install.sh b/install.sh index 2326256..f5589ad 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,6 @@ #!/bin/bash # archivmail Installer -# Unterstützte Systeme: Debian 12 / 13 +# Unterstütztes System: Debian 13 (trixie) # # Aufruf: # bash install.sh # Interaktiv (Modus-Auswahl) @@ -18,6 +18,13 @@ die() { echo -e "${RED}[ERR]${NC} $*" >&2; exit 1; } [[ $EUID -eq 0 ]] || die "Bitte als root ausführen: sudo bash install.sh" +# ── OS-Prüfung: nur Debian 13 (trixie) ────────────────────────────────────── +_os_id=$(. /etc/os-release 2>/dev/null && echo "$ID" || echo "") +_os_ver=$(. /etc/os-release 2>/dev/null && echo "$VERSION_ID" || echo "") +[[ "$_os_id" == "debian" && "$_os_ver" == "13" ]] \ + || die "Nur Debian 13 (trixie) wird unterstützt (erkannt: ${_os_id} ${_os_ver})" +log "Debian 13 erkannt" + # ── Gemeinsame Variablen ────────────────────────────────────────────────────── DB_PASSWORD="${DB_PASSWORD:-$(openssl rand -base64 24 | tr -dc 'a-zA-Z0-9' | head -c 32)}" API_SECRET="${API_SECRET:-$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9' | head -c 64)}" @@ -375,26 +382,41 @@ EOF # ══════════════════════════════════════════════════════════════════════════════ install_native() { - # ── 1. Pakete ───────────────────────────────────────────────────────────── + # ── 1. Basispakete (kein golang-go — zu alt in Debian-Repos) ──────────── info "Installiere Systempakete..." apt-get update -qq apt-get install -y -qq \ - golang-go nodejs npm postgresql nginx \ - curl git rsync logrotate openssl + nodejs npm postgresql nginx \ + curl wget git rsync logrotate openssl ca-certificates log "Pakete installiert" - # ── 1b. Manticore Search ────────────────────────────────────────────────── + # ── 1b. Go 1.24 von upstream (apt-Paket ist zu alt) ────────────────────── + GO_VERSION="1.24.4" + info "Installiere Go ${GO_VERSION} von upstream..." + if /usr/local/go/bin/go version 2>/dev/null | grep -q "go${GO_VERSION}"; then + log "Go ${GO_VERSION} bereits installiert" + else + _go_arch="amd64" + [[ "$(dpkg --print-architecture)" == "arm64" ]] && _go_arch="arm64" + curl -fsSL "https://dl.google.com/go/go${GO_VERSION}.linux-${_go_arch}.tar.gz" \ + | tar -C /usr/local -xz + log "Go $(/usr/local/go/bin/go version | awk '{print $3}') installiert" + fi + export PATH="$PATH:/usr/local/go/bin" + ln -sf /usr/local/go/bin/go /usr/local/bin/go + ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt + + # ── 1c. Manticore Search ────────────────────────────────────────────────── info "Installiere Manticore Search..." if ! command -v searchd >/dev/null 2>&1 && ! systemctl is-active --quiet manticore 2>/dev/null; then - apt-get install -y -qq wget gnupg2 lsb-release 2>/dev/null || true - MANTICORE_CODENAME=$(lsb_release -cs 2>/dev/null || echo "bookworm") + # Manticore hat kein natives trixie-Paket — bookworm-Paket ist kompatibel wget -q -O /tmp/manticore.deb \ - "https://repo.manticoresearch.com/repository/manticoresearch_${MANTICORE_CODENAME}/pool/main/m/manticoresearch/manticoresearch_6.3.6_amd64.deb" 2>/dev/null \ + "https://repo.manticoresearch.com/repository/manticoresearch_bookworm/pool/main/m/manticoresearch/manticoresearch_6.3.6_amd64.deb" 2>/dev/null \ || wget -q -O /tmp/manticore.deb \ - "https://github.com/manticoresoftware/manticoresearch/releases/download/6.3.6/manticoresearch_6.3.6.202408011246.4c39781ba-1+${MANTICORE_CODENAME}_amd64.deb" 2>/dev/null \ + "https://github.com/manticoresoftware/manticoresearch/releases/download/6.3.6/manticoresearch_6.3.6.202408011246.4c39781ba-1+bookworm_amd64.deb" 2>/dev/null \ || true if [[ -f /tmp/manticore.deb ]]; then - dpkg -i /tmp/manticore.deb 2>/dev/null || apt-get install -f -y 2>/dev/null || true + dpkg -i /tmp/manticore.deb 2>/dev/null || apt-get install -f -y -qq 2>/dev/null || true rm -f /tmp/manticore.deb log "Manticore Search installiert" else @@ -406,15 +428,6 @@ install_native() { systemctl enable --now manticore 2>/dev/null || warn "Manticore-Dienst konnte nicht gestartet werden" systemctl is-active --quiet manticore && log "Manticore Search läuft" - # go im PATH sicherstellen (Debian legt binary nicht immer in /usr/bin) - if ! command -v go >/dev/null 2>&1; then - GO_BIN=$(find /usr/lib/go-*/bin /usr/local/go/bin -name "go" 2>/dev/null | head -1) - [[ -n "$GO_BIN" ]] || die "go binary nicht gefunden nach Installation" - ln -sf "$GO_BIN" /usr/local/bin/go - log "go binary verlinkt: $GO_BIN → /usr/local/bin/go" - fi - log "go $(go version | awk '{print $3}')" - # ── 2. Systembenutzer ───────────────────────────────────────────────────── info "Lege Systembenutzer '$AM_USER' an..." id "$AM_USER" &>/dev/null \ @@ -514,6 +527,10 @@ index: backend: manticore manticore_dsn: "manticore@tcp(127.0.0.1:9306)/" batch_size: 100 + batch_mode: true + +ocr: + batch_mode: true audit: log_path: ${LOG_DIR}/audit.log @@ -660,7 +677,6 @@ WorkingDirectory=${INSTALL_DIR}/web ExecStart=/usr/bin/node server.js Environment=NODE_ENV=production Environment=PORT=3000 -Environment=NEXT_PUBLIC_API_URL=http://127.0.0.1:8080 Restart=on-failure RestartSec=5 StandardOutput=journal diff --git a/update.sh b/update.sh index f428fb4..13fd96f 100755 --- a/update.sh +++ b/update.sh @@ -54,12 +54,11 @@ command -v go >/dev/null || die "go nicht gefunden — apt-get install golang- if ! command -v searchd >/dev/null 2>&1 && ! systemctl is-active --quiet manticore 2>/dev/null; then info "Manticore Search nicht gefunden — installiere..." - apt-get install -y wget gnupg2 lsb-release 2>/dev/null || true - MANTICORE_CODENAME=$(lsb_release -cs 2>/dev/null || echo "bookworm") + # bookworm-Paket auf trixie verwenden (kein natives trixie-Paket verfügbar) wget -q -O /tmp/manticore.deb \ - "https://repo.manticoresearch.com/repository/manticoresearch_${MANTICORE_CODENAME}/pool/main/m/manticoresearch/manticoresearch_6.3.6_amd64.deb" 2>/dev/null \ + "https://repo.manticoresearch.com/repository/manticoresearch_bookworm/pool/main/m/manticoresearch/manticoresearch_6.3.6_amd64.deb" 2>/dev/null \ || wget -q -O /tmp/manticore.deb \ - "https://github.com/manticoresoftware/manticoresearch/releases/download/6.3.6/manticoresearch_6.3.6.202408011246.4c39781ba-1+${MANTICORE_CODENAME}_amd64.deb" 2>/dev/null \ + "https://github.com/manticoresoftware/manticoresearch/releases/download/6.3.6/manticoresearch_6.3.6.202408011246.4c39781ba-1+bookworm_amd64.deb" 2>/dev/null \ || true if [[ -f /tmp/manticore.deb ]]; then dpkg -i /tmp/manticore.deb 2>/dev/null || apt-get install -f -y 2>/dev/null || true