2025-12-10 18:55:38 +01:00
# Mindnet v2.4 – Admin Guide
**Datei:** `docs/mindnet_admin_guide_v2.4.md`
2025-12-10 10:26:44 +01:00
**Stand:** 2025-12-10
2025-12-10 18:55:38 +01:00
**Status:** **FINAL** (Inkl. Frontend Deployment & Interview Config)
**Quellen:** `Handbuch.md` , `mindnet_developer_guide_v2.4.md` .
2025-12-07 12:11:51 +01:00
2025-12-10 10:26:44 +01:00
> Dieses Handbuch richtet sich an **Administratoren**. Es beschreibt Installation, Konfiguration, Backup-Strategien, Monitoring und den sicheren Betrieb der Mindnet-Instanz (API + UI + DB).
2025-12-07 12:11:51 +01:00
---
## 1. Zielgruppe & Scope
2025-12-10 10:26:44 +01:00
Mindnet ist als **Multi-Service-Architektur** konzipiert, die lokal oder auf einem privaten Server läuft.
2025-12-08 09:07:34 +01:00
Wir unterscheiden strikt zwischen:
2025-12-10 10:26:44 +01:00
* **Production:** Backend (8001) + Frontend (8501). Stabiler `main` Branch.
* **Development:** Backend (8002) + Frontend (8502). Experimentelle Feature-Branches.
2025-12-07 12:11:51 +01:00
---
2025-12-08 09:07:34 +01:00
## 2. Initial Setup & Installation
2025-12-07 12:11:51 +01:00
### 2.1 Systemvoraussetzungen
* **OS:** Linux (Ubuntu 22.04+ empfohlen) oder macOS.
2025-12-08 16:14:52 +01:00
* **Runtime:** Python 3.10+, Docker (für Qdrant), Ollama (für LLM).
2025-12-07 12:11:51 +01:00
* **Hardware:**
2025-12-08 16:14:52 +01:00
* CPU: 4+ Cores empfohlen (für Import & Inference).
* RAM: Min. 8GB empfohlen (4GB System + 4GB für Phi-3/Qdrant).
2025-12-07 12:11:51 +01:00
* Disk: SSD empfohlen für Qdrant-Performance.
2025-12-08 09:07:34 +01:00
### 2.2 Installation (Code)
2025-12-09 17:11:03 +01:00
2025-12-07 12:11:51 +01:00
# 1. Repository klonen
2025-12-08 09:07:34 +01:00
git clone < repo-url > /home/llmadmin/mindnet
cd /home/llmadmin/mindnet
2025-12-07 12:11:51 +01:00
# 2. Umgebung einrichten
python3 -m venv .venv
source .venv/bin/activate
2025-12-10 10:26:44 +01:00
# 3. Dependencies installieren (inkl. Streamlit)
2025-12-07 12:11:51 +01:00
pip install -r requirements.txt
2025-12-10 10:26:44 +01:00
# 4. Verzeichnisse anlegen
2025-12-08 09:07:34 +01:00
mkdir -p logs qdrant_storage data/logs
2025-12-07 12:11:51 +01:00
### 2.3 Qdrant Setup (Docker)
Wir nutzen Qdrant als Vektor-Datenbank. Persistenz ist wichtig.
2025-12-09 17:11:03 +01:00
2025-12-07 12:11:51 +01:00
docker run -d \
--name mindnet_qdrant \
--restart always \
-p 6333:6333 \
-v $(pwd)/qdrant_storage:/qdrant/storage \
qdrant/qdrant
2025-12-08 16:14:52 +01:00
### 2.4 Ollama Setup (LLM Service)
Mindnet benötigt einen lokalen LLM-Server für den Chat.
2025-12-09 17:11:03 +01:00
2025-12-08 16:14:52 +01:00
# 1. Installieren (Linux Script)
2025-12-10 10:26:44 +01:00
curl -fsSL [https://ollama.com/install.sh ](https://ollama.com/install.sh ) | sh
2025-12-08 16:14:52 +01:00
# 2. Modell laden (Phi-3 Mini für CPU-Performance)
ollama pull phi3:mini
# 3. Testen
curl http://localhost:11434/api/generate -d '{"model": "phi3:mini", "prompt":"Hi"}'
### 2.5 Konfiguration (ENV)
2025-12-10 18:55:38 +01:00
Erstelle eine `.env` Datei im Root-Verzeichnis. Die neuen Settings für WP-06/WP-07 (Timeout, Decision Config) sind essenziell für stabilen Betrieb auf CPUs.
2025-12-07 12:11:51 +01:00
# Qdrant Verbindung
QDRANT_URL="http://localhost:6333"
# Mindnet Core Settings
2025-12-08 16:14:52 +01:00
COLLECTION_PREFIX="mindnet"
2025-12-07 12:11:51 +01:00
MINDNET_TYPES_FILE="./config/types.yaml"
2025-12-09 17:11:03 +01:00
# LLM / RAG Settings
2025-12-08 16:14:52 +01:00
MINDNET_LLM_MODEL="phi3:mini"
2025-12-10 18:55:38 +01:00
MINDNET_OLLAMA_URL="http://127.0.0.1:11434"
2025-12-09 17:11:03 +01:00
2025-12-10 10:26:44 +01:00
# Config & Timeouts
2025-12-09 17:11:03 +01:00
MINDNET_PROMPTS_PATH="./config/prompts.yaml"
MINDNET_DECISION_CONFIG="./config/decision_engine.yaml"
MINDNET_LLM_TIMEOUT=300.0
2025-12-07 12:11:51 +01:00
2025-12-10 10:26:44 +01:00
### 2.6 Deployment via Systemd (Backend & Frontend)
Mindnet benötigt zwei Services pro Umgebung: API (Uvicorn) und UI (Streamlit).
**Production Backend (`/etc/systemd/system/mindnet-prod.service`):**
2025-12-08 09:07:34 +01:00
2025-12-10 10:26:44 +01:00
[Unit]
Description=Mindnet API Prod (8001)
After=network.target
[Service]
User=llmadmin
Group=llmadmin
WorkingDirectory=/home/llmadmin/mindnet
ExecStart=/home/llmadmin/mindnet/.venv/bin/uvicorn app.main:app --host 0.0.0.0 --port 8001 --env-file .env
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
**Production Frontend (`/etc/systemd/system/mindnet-ui-prod.service`):**
[Unit]
Description=Mindnet UI Prod (8501)
After=mindnet-prod.service
[Service]
User=llmadmin
Group=llmadmin
WorkingDirectory=/home/llmadmin/mindnet
# Environment Variables
Environment="MINDNET_API_URL=http://localhost:8001"
Environment="MINDNET_API_TIMEOUT=300"
Environment="STREAMLIT_SERVER_PORT=8501"
Environment="STREAMLIT_SERVER_ADDRESS=0.0.0.0"
Environment="STREAMLIT_SERVER_HEADLESS=true"
ExecStart=/home/llmadmin/mindnet/.venv/bin/streamlit run app/frontend/ui.py
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
**Firewall (UFW):**
Öffne die Ports für den Zugriff:
sudo ufw allow 8501/tcp # Prod UI
sudo ufw allow 8502/tcp # Dev UI (falls gewünscht)
2025-12-08 09:07:34 +01:00
2025-12-07 12:11:51 +01:00
---
## 3. Betrieb im Alltag
### 3.1 Regelmäßige Importe
2025-12-08 09:07:34 +01:00
Der Vault-Zustand sollte regelmäßig (z.B. stündlich per Cronjob) nach Qdrant synchronisiert werden.
2025-12-07 12:11:51 +01:00
**Cronjob-Beispiel (stündlich):**
2025-12-09 17:11:03 +01:00
2025-12-08 09:07:34 +01:00
0 * * * * cd /home/llmadmin/mindnet && .venv/bin/python3 -m scripts.import_markdown --vault /path/to/vault --prefix "mindnet" --apply --purge-before-upsert --sync-deletes >> ./logs/import.log 2>& 1
2025-12-07 12:11:51 +01:00
### 3.2 Health-Checks
2025-12-10 10:26:44 +01:00
Prüfe regelmäßig, ob alle Komponenten laufen.
2025-12-09 17:11:03 +01:00
2025-12-08 09:07:34 +01:00
sudo systemctl status mindnet-prod
2025-12-10 10:26:44 +01:00
sudo systemctl status mindnet-ui-prod
2025-12-08 16:14:52 +01:00
sudo systemctl status ollama
2025-12-07 12:11:51 +01:00
2025-12-08 09:07:34 +01:00
### 3.3 Logs & Monitoring
2025-12-10 10:26:44 +01:00
* **Backend Fehler:** `journalctl -u mindnet-prod -f`
* **Frontend Fehler:** `journalctl -u mindnet-ui-prod -f`
* Achte auf "Timeout"-Meldungen im Frontend, wenn das Backend zu langsam antwortet.
* **LLM Fehler:** `journalctl -u ollama -f`
2025-12-08 16:14:52 +01:00
* **Fachliche Logs:** `data/logs/search_history.jsonl`
2025-12-07 12:11:51 +01:00
---
## 4. Update-Prozess
2025-12-08 09:07:34 +01:00
Wenn neue Versionen ausgerollt werden (Deployment):
2025-12-07 12:11:51 +01:00
1. **Code aktualisieren:**
2025-12-09 17:11:03 +01:00
2025-12-08 09:07:34 +01:00
cd /home/llmadmin/mindnet
2025-12-07 12:11:51 +01:00
git pull origin main
2025-12-09 17:11:03 +01:00
2025-12-07 12:11:51 +01:00
2. **Dependencies prüfen:**
2025-12-09 17:11:03 +01:00
2025-12-08 09:07:34 +01:00
source .venv/bin/activate
2025-12-07 12:11:51 +01:00
pip install -r requirements.txt
2025-12-09 17:11:03 +01:00
2025-12-10 10:26:44 +01:00
3. **Dienste neustarten (Zwingend!):**
2025-12-09 17:11:03 +01:00
2025-12-08 09:07:34 +01:00
sudo systemctl restart mindnet-prod
2025-12-10 10:26:44 +01:00
sudo systemctl restart mindnet-ui-prod
2025-12-09 17:11:03 +01:00
2025-12-08 09:07:34 +01:00
4. **Schema-Migration (falls nötig):**
2025-12-09 17:11:03 +01:00
2025-12-08 09:07:34 +01:00
python3 -m scripts.import_markdown ... --apply
2025-12-07 12:11:51 +01:00
---
## 5. Backup & Restore
2025-12-08 09:07:34 +01:00
Datensicherheit ruht auf drei Säulen: Vault (Source), Qdrant (Index), JSONL-Logs (Lern-Daten).
2025-12-07 12:11:51 +01:00
### 5.1 Vault-Backup (Priorität 1)
2025-12-10 10:26:44 +01:00
Der Markdown-Vault ist die **Single Source of Truth** .
2025-12-07 12:11:51 +01:00
### 5.2 Qdrant-Snapshots (Priorität 2)
2025-12-08 09:07:34 +01:00
Für schnelle Wiederherstellung des Suchindex.
2025-12-09 17:11:03 +01:00
2025-12-07 12:11:51 +01:00
docker stop mindnet_qdrant
tar -czf qdrant_backup_$(date +%F).tar.gz ./qdrant_storage
docker start mindnet_qdrant
2025-12-08 09:07:34 +01:00
### 5.3 Log-Daten (Priorität 3)
2025-12-10 10:26:44 +01:00
Sichere den Ordner `data/logs/` . Verlust dieser Daten bedeutet Verlust des Trainingsmaterials für Self-Tuning.
2025-12-07 12:11:51 +01:00
2025-12-08 09:07:34 +01:00
### 5.4 Notfall-Wiederherstellung (Rebuild)
Wenn die Datenbank korrupt ist:
2025-12-09 17:11:03 +01:00
2025-12-07 12:11:51 +01:00
# 1. DB komplett leeren (Wipe)
python3 -m scripts.reset_qdrant --mode wipe --prefix "mindnet" --yes
# 2. Alles neu importieren
python3 -m scripts.import_markdown --vault /path/to/vault --prefix "mindnet" --apply
---
2025-12-08 09:07:34 +01:00
## 6. Governance & Sicherheit
2025-12-07 12:11:51 +01:00
2025-12-08 09:07:34 +01:00
### 6.1 Zugriffsschutz
Mindnet hat aktuell **keine integrierte Authentifizierung** .
2025-12-10 10:26:44 +01:00
* **Frontend:** Streamlit auf Port 8501 ist offen. Nutze Nginx Basic Auth oder VPN.
* **API:** Sollte nicht direkt im öffentlichen Netz stehen.
* **Qdrant:** Auf `127.0.0.1` beschränken.
2025-12-07 12:11:51 +01:00
2025-12-08 09:07:34 +01:00
### 6.2 Typen-Governance
2025-12-10 10:26:44 +01:00
Änderungen an der `types.yaml` (z.B. neue Gewichte) wirken global und erfordern Tests.