homelab-codex-ws/services/llm-gateway/service.yaml
oskar 70ff08b4a0 feat(llm-gateway): wciagniecie shadow-serwisu z PIHA do GitOps
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>
2026-07-03 13:41:44 +02:00

27 lines
965 B
YAML

service:
name: llm-gateway
owner_node: piha
role: llm-router
exposure: private # Tailscale-only bind (TAILSCALE_BIND_IP); no public ingress, no npm
dependencies:
- ollama # upstream inference @ SOLARIA :11434 (external node; SOLARIA may be powered down)
ports:
- container: 8080
host: 8080
protocol: tcp
healthcheck:
type: http
endpoint: http://localhost:8080/ # GET / -> {"status":"gateway ok"}
interval: 30s
timeout: 10s
retries: 5
restart_policy: unless-stopped
persistence:
paths: [] # stateless — nothing to back up
runtime:
config_files:
- .env # TAILSCALE_BIND_IP (+ optional OLLAMA_URL); gitignored, from env.example
env_vars:
- TAILSCALE_BIND_IP # required — compose port-bind interpolation
- OLLAMA_URL # optional — defaults to http://solaria:11434/api/generate