feat(ollama): implement hybrid security model and initialize llama3
- Reconfigured Traefik labels to support dual-router logic: - Priority 100: Token-based bypass via 'X-Ollama-Key' header for automation. - Priority 50: Standard Authelia SSO protection for browser access. - Documented the 'Trusted Payload' flow in docs/usability.md. - Initialized the service by pulling the 'llama3' model to the shared volume.
This commit is contained in:
1 parent
52ede71f9b
commit
d9013cca0a
2 files changed
+38
-6
No files matched your search
@@ -16,12 +16,26 @@ services:
|
||||
- proxy-net
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.ollama.rule=Host(`ollama.arch-services.mywire.org`)"
|
||||
- "traefik.http.routers.ollama.entrypoints=websecure"
|
||||
- "traefik.http.routers.ollama.tls.certresolver=myresolver"
|
||||
- "traefik.http.services.ollama.loadbalancer.server.port=11434"
|
||||
- "traefik.http.services.ollama.loadbalancer.healthcheck.path=/api/tags"
|
||||
- "traefik.http.services.ollama.loadbalancer.healthcheck.interval=10s"
|
||||
# Router 1: API/Automation (Token-based)
|
||||
- "traefik.http.routers.ollama-api.rule=Host(`ollama.arch-services.mywire.org`) && Header(`X-Ollama-Key`, `sk-ollama-hardened-hub-2026`)"
|
||||
- "traefik.http.routers.ollama-api.entrypoints=websecure"
|
||||
- "traefik.http.routers.ollama-api.tls.certresolver=myresolver"
|
||||
- "traefik.http.routers.ollama-api.priority=100"
|
||||
- "traefik.http.routers.ollama-api.service=ollama-svc"
|
||||
|
||||
# Router 2: Browser/Standard (Authelia Protected)
|
||||
- "traefik.http.routers.ollama-browser.rule=Host(`ollama.arch-services.mywire.org`)"
|
||||
- "traefik.http.routers.ollama-browser.entrypoints=websecure"
|
||||
- "traefik.http.routers.ollama-browser.tls.certresolver=myresolver"
|
||||
- "traefik.http.routers.ollama-browser.middlewares=authelia-auth@docker"
|
||||
- "traefik.http.routers.ollama-browser.priority=50"
|
||||
- "traefik.http.routers.ollama-browser.service=ollama-svc"
|
||||
|
||||
# Shared Service
|
||||
- "traefik.http.services.ollama-svc.loadbalancer.server.port=11434"
|
||||
- "traefik.http.services.ollama-svc.loadbalancer.healthcheck.path=/api/tags"
|
||||
- "traefik.http.services.ollama-svc.loadbalancer.healthcheck.interval=10s"
|
||||
|
||||
|
||||
volumes:
|
||||
ollama_data:
|
||||
|
||||
@@ -47,3 +47,21 @@ To add a new service to the Hub:
|
||||
|
||||
## 📝 Logging
|
||||
Real-time logs can be viewed via **Dozzle** at `https://logs.arch-services.mywire.org`. This is preferred over `docker logs` for quick debugging across multiple containers.
|
||||
|
||||
## 🤖 Ollama API & Automation (Trusted Payload)
|
||||
Ollama uses a hybrid security model to allow both browser use and automated tools:
|
||||
|
||||
### Browser Use
|
||||
Accessing `https://ollama.arch-services.mywire.org` directly will prompt for **Authelia SSO** login.
|
||||
|
||||
### API & CLI Bypass
|
||||
For scripts, cron jobs, or terminal use, you can bypass SSO by including the `X-Ollama-Key` header.
|
||||
- **Header**: `X-Ollama-Key: sk-ollama-hardened-hub-2026`
|
||||
|
||||
**Example (curl):**
|
||||
```bash
|
||||
curl https://ollama.arch-services.mywire.org/api/generate \
|
||||
-H "X-Ollama-Key: sk-ollama-hardened-hub-2026" \
|
||||
-d '{"model": "llama3", "prompt": "hi"}'
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user