feat: make stop/start/restart + Doku servicefreundlicher

Makefile: neue Targets 'stop' (Gateway + llama.cpp), 'start' (llm-up + run),
'restart' (stop + start). CONTAINER_NAME als überschreibbare Variable.
BEDIENUNGSANLEITUNG § 4: neuer Schnellbefehle-Block (§ 4.0) mit Tabellen für
alle Start-/Stop-Situationen; § 4.8 Stoppen und § 4.9 Neustart als dedizierte
Abschnitte. README: Stoppen, Neu starten und make-Targets aktualisiert.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Dieter Schlüter 2026-06-19 12:58:54 +02:00
commit a54daecbc8
3 changed files with 141 additions and 2 deletions

View file

@ -35,7 +35,7 @@ funktioniert trotzdem, die Ausgabe ist dann unformatiert.
1. [Was ist dieses System?](#1-was-ist-dieses-system) 1. [Was ist dieses System?](#1-was-ist-dieses-system)
2. [Installation und Einrichtung](#2-installation-und-einrichtung) 2. [Installation und Einrichtung](#2-installation-und-einrichtung)
3. [Betriebsprofile wählen](#3-betriebsprofile-wählen) 3. [Betriebsprofile wählen](#3-betriebsprofile-wählen)
4. [Starten und Stoppen](#4-starten-und-stoppen) — [4.5 llama.cpp](#45-llamacpp-server-für-profil-hybridlocal-dev) · [4.6 Ollama](#46-ollama-alternative-zu-llamacpp-kein-docker-nötig) · [4.7 Wechseln](#47-zwischen-llamacpp-und-ollama-wechseln) 4. [Starten und Stoppen](#4-starten-und-stoppen) — [4.0 Schnellbefehle](#40-schnellbefehle-überblick) · [4.5 llama.cpp](#45-llamacpp-server-für-profil-hybridlocal-dev) · [4.6 Ollama](#46-ollama-alternative-zu-llamacpp-kein-docker-nötig) · [4.7 Wechseln](#47-zwischen-llamacpp-und-ollama-wechseln) · [4.8 Stoppen](#48-alles-stoppen) · [4.9 Neustart](#49-komplett-neustart)
**Bedienung** **Bedienung**
5. [Das System benutzen](#5-das-system-benutzen) 5. [Das System benutzen](#5-das-system-benutzen)
@ -368,6 +368,41 @@ curl -s $URL/api/config | jq '{profile, default_route}'
> 🔧 Admin > 🔧 Admin
### 4.0 Schnellbefehle (Überblick)
Die wichtigsten Kommandos auf einen Blick — Details in den Abschnitten darunter.
**Starten:**
| Situation | Kommando |
|-----------|----------|
| Profil `cloud` — nur Gateway | `make run` |
| Profil `hybrid` / `local-dev` — llama.cpp + Gateway | `make start` |
| Profil `hybrid` / `local-dev` — Ollama + Gateway | `sudo systemctl start ollama && make run` |
| systemd-Dienst starten | `systemctl --user start voice-assistant` |
**Stoppen:**
| Situation | Kommando |
|-----------|----------|
| Gateway im Vordergrund | **Strg + C** |
| Gateway im Hintergrund / systemd | `make stop` |
| Alles (Gateway + llama.cpp) | `make stop` |
| llama.cpp allein | `make llm-down` |
| Ollama allein | `sudo systemctl stop ollama` |
**Neu starten (alles):**
```bash
make restart # make stop + make start (llama.cpp + Gateway)
# Nur Gateway neu starten (llama.cpp läuft weiter):
systemctl --user restart voice-assistant # systemd
# oder: Strg+C und make run # Vordergrund
```
---
### 4.1 Vordergrund (Entwicklung/Test) ### 4.1 Vordergrund (Entwicklung/Test)
```bash ```bash
@ -576,6 +611,63 @@ VA_PROFILE=hybrid make run
--- ---
### 4.8 Alles stoppen
```bash
make stop
```
Ein Befehl stoppt alle Voice-Assistant-Komponenten:
- Gateway (ob im Vordergrund gestartet, im Hintergrund oder als systemd-Dienst)
- llama.cpp-Docker-Container (`va_llm`)
Ollama ist ein systemd-Dienst und muss separat gestoppt werden:
```bash
sudo systemctl stop ollama
```
**Einzelne Komponenten stoppen:**
```bash
# Nur Gateway (Vordergrund):
Strg + C
# Nur Gateway (Hintergrund):
pkill -f "uvicorn app.main:app"
# Nur Gateway (systemd):
systemctl --user stop voice-assistant
# Nur llama.cpp:
make llm-down
# oder direkt:
docker rm -f va_llm
# Nur Ollama:
sudo systemctl stop ollama
```
### 4.9 Komplett-Neustart
```bash
make restart
```
Entspricht `make stop` gefolgt von `make start` (llama.cpp + Gateway). Sinnvoll nach
Konfigurationsänderungen, die einen Neustart erfordern (z. B. neue `.env`-Werte).
**Nur Gateway neu starten** (llama.cpp läuft weiter — schneller):
```bash
systemctl --user restart voice-assistant # systemd-Betrieb
# oder: Strg+C → make run # Vordergrund-Betrieb
```
> ⚠️ `make restart` startet llama.cpp neu (Modell lädt ~5 Min.). Wenn nur der Gateway-
> Code oder die Konfiguration geändert wurde, ist `systemctl --user restart voice-assistant`
> deutlich schneller.
---
## 5. Das System benutzen ## 5. Das System benutzen
> 👤 Endnutzer > 👤 Endnutzer
@ -1938,6 +2030,8 @@ in `app/dependencies.py` + Implementierung in `app/providers/`. → [Architektur
| local-dev-Profil | § 3.3 | | local-dev-Profil | § 3.3 |
| Ollama starten | § 4.6 | | Ollama starten | § 4.6 |
| Ollama ↔ llama.cpp wechseln | § 4.7 | | Ollama ↔ llama.cpp wechseln | § 4.7 |
| Stoppen (alle Varianten) | § 4.8 |
| Neustart | § 4.9 |
| Metriken / Monitoring | § 9.2, Anhang B.1 | | Metriken / Monitoring | § 9.2, Anhang B.1 |
| Mikrofon → Audio-Geräte | § 6.7 | | Mikrofon → Audio-Geräte | § 6.7 |
| Notfall-Erkennung | § 10 | | Notfall-Erkennung | § 10 |

View file

@ -6,7 +6,9 @@ endif
PORT ?= 8080 PORT ?= 8080
HOST ?= 0.0.0.0 HOST ?= 0.0.0.0
.PHONY: ensure-env install run test smoke docker-build llm-up llm-down llm-status CONTAINER_NAME ?= va_llm
.PHONY: ensure-env install run start stop restart test smoke docker-build llm-up llm-down llm-status
ensure-env: ensure-env:
@if [ ! -f .env ] && [ -f .env.example ]; then \ @if [ ! -f .env ] && [ -f .env.example ]; then \
@ -31,6 +33,26 @@ smoke: ensure-env
docker-build: docker-build:
docker build -t voice-assistant-gateway . docker build -t voice-assistant-gateway .
# --- Komplett-Befehle (Start / Stop / Restart) --------------------------------
# Stoppt alle Voice-Assistant-Komponenten: Gateway (Vordergrund + systemd) und
# llama.cpp-Container. Ollama (systemd) separat: sudo systemctl stop ollama
stop:
-pkill -f "uvicorn app.main:app" 2>/dev/null; true
-systemctl --user stop voice-assistant 2>/dev/null; true
-docker rm -f "$(CONTAINER_NAME)" 2>/dev/null; true
@echo "[*] Voice-Assistant gestoppt (Gateway + llama.cpp)."
# Startet llama.cpp-LLM-Server und danach das Gateway (Profil hybrid/local-dev).
# Fuer Profil cloud (kein lokales LLM): einfach 'make run'.
start: ensure-env
$(MAKE) llm-up
$(MAKE) run
# Faehrt alles herunter und startet neu (llama.cpp + Gateway).
restart: stop
$(MAKE) start
# --- Lokales LLM (llama.cpp-Server, zentrale unzensierte KI) ----------------- # --- Lokales LLM (llama.cpp-Server, zentrale unzensierte KI) -----------------
# Konfig per ENV ueberschreibbar, z. B.: GPU_DEVICE=2 HOST_PORT=8101 make llm-up # Konfig per ENV ueberschreibbar, z. B.: GPU_DEVICE=2 HOST_PORT=8101 make llm-up
llm-up: llm-up:

View file

@ -123,6 +123,26 @@ VA_PROFILE=hybrid make run
VA_PROFILE=local-dev make run VA_PROFILE=local-dev make run
``` ```
### Stoppen
```bash
make stop # Gateway (alle Varianten) + llama.cpp-Container
# Einzeln:
Strg + C # Gateway im Vordergrund
pkill -f "uvicorn app.main:app" # Gateway im Hintergrund
systemctl --user stop voice-assistant # Gateway als systemd-Dienst
make llm-down # nur llama.cpp
sudo systemctl stop ollama # nur Ollama
```
### Neu starten (alles)
```bash
make restart # make stop + make start (llama.cpp + Gateway)
# Nur Gateway neu (llama.cpp läuft weiter):
systemctl --user restart voice-assistant
```
### Backend wechseln (llama.cpp ↔ Ollama) ### Backend wechseln (llama.cpp ↔ Ollama)
Beide Server können nicht gleichzeitig laufen (geteilter GPU-Speicher). Beide Server können nicht gleichzeitig laufen (geteilter GPU-Speicher).
@ -142,6 +162,9 @@ sudo systemctl start ollama
```bash ```bash
make install # venv anlegen + Abhängigkeiten installieren make install # venv anlegen + Abhängigkeiten installieren
make run # Gateway starten (uvicorn --reload, Port aus .env) make run # Gateway starten (uvicorn --reload, Port aus .env)
make start # llama.cpp + Gateway starten (hybrid/local-dev)
make stop # alles stoppen (Gateway + llama.cpp)
make restart # make stop + make start
make test # Pytest-Suite (offline, kostenlos) make test # Pytest-Suite (offline, kostenlos)
make smoke # Live-End-to-End-Test gegen OpenRouter (geringe Kosten) make smoke # Live-End-to-End-Test gegen OpenRouter (geringe Kosten)
make llm-up # llama.cpp-Docker-Container starten make llm-up # llama.cpp-Docker-Container starten