Kod zyl tylko na dysku PIHA w /opt/llm-gateway (bez gita). Przeniesiony do
services/llm-gateway/ pod pelny wzorzec homelaba:
- app/main.py: kod 1:1 z PIHA + OLLAMA_URL/CHAT_MODEL/CODE_MODEL
nadpisywalne przez env (defaulty bez zmian)
- docker-compose.yml: bind TYLKO do Tailscale IP (${TAILSCALE_BIND_IP},
wzorzec fleet-prometheus), nie 0.0.0.0 jak w starym compose
- service.yaml, env.example (bez sekretow), healthcheck.sh, README, testy
- hosts/piha/runtime/llm-gateway: mem_limit 256m (PIHA jest RAM-bound)
- rejestracja w hosts/piha/services.yaml i inventory/topology.yaml
Zepsuty /opt/llm-gateway/docker-compose.yml (zduplikowany klucz ports)
celowo NIE przeniesiony.
DoD: pytest 4 passed; docker build + smoke run OK (GET / -> gateway ok).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
25 lines
1.1 KiB
YAML
25 lines
1.1 KiB
YAML
services:
|
|
llm-gateway:
|
|
build: .
|
|
container_name: llm-gateway
|
|
restart: unless-stopped
|
|
ports:
|
|
# tailscale-internal: the listen socket is bound ONLY to the node's
|
|
# Tailscale interface IP (TAILSCALE_BIND_IP), never 0.0.0.0 — same
|
|
# convention as fleet-prometheus. Reachability is enforced in the bind
|
|
# itself; consumers reach it as http://piha:8080 over the mesh.
|
|
# Requires .env (from env.example) next to this file at deploy.
|
|
- "${TAILSCALE_BIND_IP}:8080:8080"
|
|
environment:
|
|
# Ollama upstream on SOLARIA; "solaria" resolves via the host's
|
|
# Tailscale MagicDNS, forwarded by Docker's embedded DNS.
|
|
- OLLAMA_URL=${OLLAMA_URL:-http://solaria:11434/api/generate}
|
|
# python:3.12-slim has no curl/wget, but it does have python — same
|
|
# in-container check pattern as control-plane.
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/', timeout=3).read()"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 5
|
|
start_period: 10s
|