Die Basis-URL der API wurde bisher aus dem Port der Seite abgeleitet (office.html: `if (location.port === "8090")`). Laeuft das Frontend hinter anderen Ports - in Produktion 4443 (web) / 4444 (api) - griff die Bedingung nicht, der relative Default /api/v1 lief gegen den Webserver ins Leere, und die Szene fiel still auf Demo-Daten zurueck: fremde Agenten-Namen und erfundene Ticketzahlen bei gleichzeitig leeren Detail-Modals. Die URL kommt jetzt aus MONITOR_API_BASE (.env, Default passend zum Port-Mapping in docker-compose.yml). Der Webserver liefert den Wert zur Laufzeit als /config.js aus; das nginx-Image setzt ihn beim Start per envsubst in die Config ein (default.conf -> default.conf.template). Damit bleibt html/ ein rein statisches, read-only gemountetes Verzeichnis - kein Build-Schritt, kein eigenes Entrypoint-Skript. Ein leerer Wert bedeutet "gleicher Origin" und faellt auf /api/v1 zurueck. Zusaetzlich macht ein roter Banner "API nicht erreichbar!" den Demo-Fallback sichtbar, statt ihn wie bisher stillschweigend als echte Daten auszugeben. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
55 lines
2.3 KiB
YAML
55 lines
2.3 KiB
YAML
services:
|
|
api:
|
|
build:
|
|
context: ./api
|
|
dockerfile: docker/Dockerfile
|
|
volumes:
|
|
- ./api:/app
|
|
# Optional: echte status.txt aus der Produktion zum Testen einbinden, z.B.
|
|
# - ./status.txt:/status.txt:ro
|
|
working_dir: /app
|
|
# Achtung: Eine Aenderung des Host-Ports muss in .env (MONITOR_API_BASE) nachgezogen
|
|
# werden - das Frontend laeuft im Browser und erreicht die API nicht ueber das
|
|
# Compose-Netzwerk, sondern ueber genau diesen Port.
|
|
ports:
|
|
- "8091:8080"
|
|
environment:
|
|
MONITOR_DB_PATH: /app/data/monitor.sqlite
|
|
MONITOR_ADMIN_API_KEY: ${MONITOR_ADMIN_API_KEY:-dev-admin-key}
|
|
MONITOR_STATUS_FILE: /status.txt
|
|
MONITOR_DESK_COUNT: 8
|
|
MONITOR_SSE_MAX_ITERATIONS: 30
|
|
MONITOR_SSE_POLL_INTERVAL: 2
|
|
CODEBERG_API_BASE: https://codeberg.org/api/v1
|
|
CODEBERG_OWNER: ${CODEBERG_OWNER:-fds2610}
|
|
CODEBERG_REPO: ${CODEBERG_REPO:-monitor}
|
|
CODEBERG_TOKEN: ${CODEBERG_TOKEN:-}
|
|
|
|
# Statisches Frontend (html/) - Phase 2 der Neuausrichtung (Buero-Visualisierung).
|
|
# Nur zur lokalen Ansicht/Entwicklung, kein Build-Schritt noetig (Vanilla HTML/CSS/JS).
|
|
web:
|
|
image: nginx:alpine
|
|
volumes:
|
|
- ./html:/usr/share/nginx/html:ro
|
|
# Ueberlagert den Platzhalter html/API.md - der muss existieren, weil in
|
|
# einem read-only gemounteten Verzeichnis kein Mountpoint angelegt werden kann.
|
|
- ./API.md:/usr/share/nginx/html/API.md:ro
|
|
# Setzt office.html als Einstiegsseite (sonst 403 auf der Basis-URL) und liefert
|
|
# /config.js aus. Als Template gemountet, damit das nginx-Image beim Start
|
|
# MONITOR_API_BASE per envsubst einsetzt (Ausgabe: /etc/nginx/conf.d/default.conf).
|
|
- ./docker/nginx/default.conf.template:/etc/nginx/templates/default.conf.template:ro
|
|
environment:
|
|
# Wird in docker/nginx/default.conf.template eingesetzt und als /config.js an den
|
|
# Browser ausgeliefert. Leer = gleicher Origin (relatives /api/v1).
|
|
MONITOR_API_BASE: ${MONITOR_API_BASE:-}
|
|
ports:
|
|
- "8090:80"
|
|
|
|
# Fuehrt die Node-basierten Frontend-Tests (tests/frontend/) aus. Node/npm sind nur im
|
|
# Container noetig, nicht auf dem Host (analog zum api-Service mit PHP/Composer).
|
|
frontend:
|
|
image: node:20-alpine
|
|
working_dir: /app
|
|
volumes:
|
|
- .:/app
|
|
command: npm test
|