From 2900187a0de607114d79c587b822b2bda95b58b7 Mon Sep 17 00:00:00 2001 From: sysops Date: Sat, 4 Apr 2026 21:00:06 +0200 Subject: [PATCH] chore: Xapian/Bleve-Reste aus install.sh, setup.sh und smoke_test.sh entfernen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - install.sh: REPO_URL auf Gitea gesetzt, libxapian-dev entfernt, xapian- Verzeichnis entfernt, config.yml-Template auf Manticore umgestellt, Manticore-Installationsschritt ergänzt, systemd-Unit auf manticore.service als Abhängigkeit, GitHub-URL-Sonderbehandlung entfernt - setup.sh: "Bleve backend" und "build with Xapian" Hinweise entfernt, Projektname von mailarchive auf archivmail korrigiert - smoke_test.sh: Binary-Namen auf aktuelles CLI-Format korrigiert Co-Authored-By: Claude Sonnet 4.6 --- install.sh | 51 +++++++++++++++++++++++++++++++++------------------ setup.sh | 11 +++++------ smoke_test.sh | 6 +++--- 3 files changed, 41 insertions(+), 27 deletions(-) diff --git a/install.sh b/install.sh index 0c42277..676564c 100755 --- a/install.sh +++ b/install.sh @@ -30,7 +30,7 @@ CONFIG_DIR="/etc/archivmail" SSL_DIR="/etc/ssl/archivmail" AM_USER="archivmail" FQDN="$(hostname -f 2>/dev/null || hostname)" -REPO_URL="${REPO_URL:-https://github.com/yourorg/archivmail.git}" +REPO_URL="${REPO_URL:-https://gitea.perlbach24.de/scripte/archivmail.git}" # ── Banner ──────────────────────────────────────────────────────────────────── echo "" @@ -50,7 +50,7 @@ if [[ -z "$INSTALL_MODE" ]]; then echo " 1) Nativ — Go/Node.js direkt auf dem Server kompiliert und gebaut" echo " (systemd-Dienste, PostgreSQL lokal, kein Docker nötig)" echo "" - echo " 2) Docker — Alle Abhängigkeiten (Go, Xapian, Node.js, PostgreSQL)" + echo " 2) Docker — Alle Abhängigkeiten (Go, Node.js, PostgreSQL, Manticore)" echo " laufen in Containern. Kein Build-Toolchain auf dem Host." echo " Deployment via GitHub Webhook (git pull → docker compose up)" echo "" @@ -75,8 +75,8 @@ echo "" install_docker() { # GitHub-Repo abfragen wenn nicht gesetzt - if [[ "$REPO_URL" == *"yourorg"* ]]; then - read -rp " GitHub-Repository URL (z.B. https://github.com/org/archivmail.git): " REPO_URL + if [[ "$REPO_URL" == *"yourorg"* || -z "$REPO_URL" ]]; then + read -rp " Gitea-Repository URL (z.B. https://gitea.example.com/org/archivmail.git): " REPO_URL [[ -n "$REPO_URL" ]] || die "Kein Repository angegeben." fi @@ -386,10 +386,32 @@ install_native() { apt-get update -qq apt-get install -y -qq \ golang-go nodejs npm postgresql nginx \ - libxapian-dev pkg-config build-essential \ curl git rsync logrotate openssl log "Pakete installiert" + # ── 1b. 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") + 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 \ + || 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 \ + || true + if [[ -f /tmp/manticore.deb ]]; then + dpkg -i /tmp/manticore.deb 2>/dev/null || apt-get install -f -y 2>/dev/null || true + rm -f /tmp/manticore.deb + log "Manticore Search installiert" + else + die "Manticore Search konnte nicht installiert werden — siehe: https://manticoresearch.com/install/" + fi + else + log "Manticore Search bereits installiert" + fi + 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) @@ -407,11 +429,11 @@ install_native() { # ── 3. Verzeichnisstruktur ──────────────────────────────────────────────── info "Erstelle Verzeichnisstruktur..." - mkdir -p "$STORE_DIR/store" "$STORE_DIR/astore" "$STORE_DIR/xapian" + mkdir -p "$STORE_DIR/store" "$STORE_DIR/astore" mkdir -p "$CONFIG_DIR" "$LOG_DIR" "$INSTALL_DIR" "$INSTALL_DIR/web" "$SSL_DIR" chown -R "$AM_USER:$AM_USER" "$STORE_DIR" "$LOG_DIR" chmod 755 "$STORE_DIR" - chmod 700 "$STORE_DIR/store" "$STORE_DIR/astore" "$STORE_DIR/xapian" + chmod 700 "$STORE_DIR/store" "$STORE_DIR/astore" log "Verzeichnisse erstellt" # ── 4. Keyfile ──────────────────────────────────────────────────────────── @@ -485,7 +507,6 @@ database: storage: store_path: ${STORE_DIR}/store astore_path: ${STORE_DIR}/astore - xapian_path: ${STORE_DIR}/xapian keyfile: ${CONFIG_DIR}/keyfile api: @@ -496,8 +517,8 @@ api: secure_cookies: true index: - path: ${STORE_DIR}/xapian - backend: xapian + backend: manticore + manticore_dsn: "manticore@tcp(127.0.0.1:9306)/" batch_size: 100 audit: @@ -606,8 +627,8 @@ LOGROTATE cat > /etc/systemd/system/archivmail.service << UNIT [Unit] Description=archivmail Mail Archive Daemon -After=network.target postgresql.service -Requires=postgresql.service +After=network.target postgresql.service manticore.service +Requires=postgresql.service manticore.service [Service] Type=simple @@ -661,12 +682,6 @@ UNIT # ── 11. Erstes Deployment via update.sh ─────────────────────────────────── info "Installiere update.sh und führe erstes Deployment durch..." _update_url="${REPO_URL/\.git/}/raw/branch/main/update.sh" - # GitHub-URLs anpassen (raw.githubusercontent.com statt github.com/raw/...) - if [[ "$REPO_URL" == *"github.com"* ]]; then - _repo_path="${REPO_URL#*github.com/}" - _repo_path="${_repo_path%.git}" - _update_url="https://raw.githubusercontent.com/${_repo_path}/main/update.sh" - fi curl -fsSL "$_update_url" -o "$INSTALL_DIR/update.sh" 2>/dev/null \ || { warn "update.sh konnte nicht geladen werden – überspringe Deployment"; } diff --git a/setup.sh b/setup.sh index abb8acd..1c5512a 100644 --- a/setup.sh +++ b/setup.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# setup.sh — First-time build setup for mailarchive +# setup.sh — First-time build setup for archivmail # Run once on a machine with internet access. # After this, the project builds and tests without internet. set -e @@ -21,7 +21,7 @@ echo "==> Verifying modules" go mod verify echo "" -echo "==> Building (Bleve backend — default)" +echo "==> Building (Manticore backend)" make build echo "" @@ -38,12 +38,11 @@ echo " Build successful!" echo "" echo " To start the daemon:" echo " sudo make install" -echo " sudo systemctl start mailarchive" +echo " sudo systemctl start archivmail" echo "" echo " Or run directly:" echo " ./bin/archivmail --config config/config.yml" echo "" -echo " To build with Xapian (optional, needs libxapian-dev):" -echo " apt install libxapian-dev" -echo " make build-xapian" +echo " Full-text search requires Manticore Search:" +echo " See: https://manticoresearch.com/install/" echo "========================================" diff --git a/smoke_test.sh b/smoke_test.sh index 851dd37..8636f7a 100644 --- a/smoke_test.sh +++ b/smoke_test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # test/smoke_test.sh — manual end-to-end smoke test # Run AFTER the daemon is started: -# ./bin/mailarchived --config config/config.test.yml +# ./bin/archivmail --config config/config.test.yml # # Requirements: curl, jq, swaks (apt install swaks) set -e @@ -107,8 +107,8 @@ Date: Thu, 12 Mar 2026 10:00:00 +0000 This mail was imported via CLI. EML -./bin/archivmail-import --config config/config.test.yml /tmp/test-eml/ && \ - ok "mailarchive-import" || fail "mailarchive-import" +./bin/archivmail import --config config/config.test.yml /tmp/test-eml/ && \ + ok "archivmail-import" || fail "archivmail-import" sep "Export" ./bin/archivmail-export --config config/config.test.yml --format eml --out /tmp/test-export/ && \