Remove admin port binding from docker run example

Port 8001 should not be exposed to the host directly.
Add nginx reverse proxy and SSH tunnel examples instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Oliver Hofmann 2026-04-28 08:41:18 +02:00
parent 317c7f0340
commit ff5c88ecfd

View File

@ -85,7 +85,6 @@ docker build -t llm-quota .
```bash ```bash
docker run -d \ docker run -d \
-p 8000:8000 \ -p 8000:8000 \
-p 8001:8001 \
-e ADMIN_PASSWORD=geheim \ -e ADMIN_PASSWORD=geheim \
-e OLLAMA_URL=http://host.docker.internal:11434 \ -e OLLAMA_URL=http://host.docker.internal:11434 \
-e DATABASE_URL=sqlite:///./data/quota.db \ -e DATABASE_URL=sqlite:///./data/quota.db \
@ -94,27 +93,45 @@ docker run -d \
llm-quota llm-quota
``` ```
Port 8001 (Admin) wird bewusst **nicht** an den Host gebunden. Die Admin-Oberfläche ist über einen Reverse-Proxy zu exponieren (siehe unten).
| Port | Dienst | | Port | Dienst |
|------|--------| |------|--------|
| `8000` | Proxy (für LLM-Clients) | | `8000` | Proxy (für LLM-Clients, öffentlich) |
| `8001` | Admin-API + Admin-Oberfläche | | `8001` | Admin-API + Admin-Oberfläche (nur intern) |
Admin-Oberfläche: `http://localhost:8001` ### Admin-Oberfläche via Reverse-Proxy zugänglich machen
Beispiel mit nginx — Port 8001 intern weiterleiten, nach außen absichern:
```nginx
server {
listen 443 ssl;
server_name admin.example.com;
location / {
proxy_pass http://localhost:8001;
}
}
```
Oder temporär für lokalen Zugriff per SSH-Tunnel:
```bash
ssh -L 8001:localhost:8001 user@server
```
### Mit PostgreSQL ### Mit PostgreSQL
```bash ```bash
docker run -d \ docker run -d \
-p 8000:8000 \ -p 8000:8000 \
-p 8001:8001 \
-e ADMIN_PASSWORD=geheim \ -e ADMIN_PASSWORD=geheim \
-e DATABASE_URL=postgresql://user:pass@db-host:5432/llm_quota \ -e DATABASE_URL=postgresql://user:pass@db-host:5432/llm_quota \
-e OLLAMA_URL=http://ollama:11434 \ -e OLLAMA_URL=http://ollama:11434 \
llm-quota llm-quota
``` ```
> **Hinweis:** Im Container bindet die Admin-API auf `0.0.0.0`. Port 8001 sollte nicht öffentlich exponiert werden — entweder per Firewall absichern oder hinter einem Reverse-Proxy (nginx, Caddy) betreiben.
## Proxy-Endpunkte (Port 8000) ## Proxy-Endpunkte (Port 8000)
Alle Endpunkte erfordern einen gültigen API-Key im `Authorization`-Header. Alle Endpunkte erfordern einen gültigen API-Key im `Authorization`-Header.