diff --git a/AGENTS.md b/AGENTS.md index 3ca684c..04bd7e5 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -49,7 +49,7 @@ Kein Linter konfiguriert. Bei Bedarf: `ruff check app/` oder `black app/` 1. **Ein-Datei-App**: `main.py` enthält alle Endpunkte und Logik → bewusst simpel gehalten 2. **Keine DB**: Alles In-Memory → Neustart = Cache-Verlust (akzeptabel) -3. **Exclude-Filter**: Whitelist-Logik (alles anzeigen AUSSER exclude_destinations) +3. **Exclude-Filter**: Blacklist-Logik (alles anzeigen AUSSER exclude_destinations) 4. **Template-Rendering**: Server-seitig via Jinja2, kein Frontend-Framework 5. **Config-Pfad**: `CONFIG_PATH` Env-Var oder `config.yaml` als Fallback @@ -70,7 +70,7 @@ Kein Linter konfiguriert. Bei Bedarf: `ruff check app/` oder `black app/` ## Sicherheit - Keine Secrets im Code -- Config.yaml kann sensible Stationsnamen enthalten → Volume-Mount, nicht ins Image +- Config.yaml kann sensitive Stationsnamen enthalten → in Produktion als Read-Only-Volume-Mount überschreiben; das Image enthält nur eine Default-Config - GHCR-Token nur in CI, nie im Repo ## Deployment-Hinweise diff --git a/README.md b/README.md index 3218e90..66cd992 100644 --- a/README.md +++ b/README.md @@ -53,18 +53,20 @@ uvicorn app.main:app --reload ```bash docker build -t mvg-departures . -docker run -p 8000:8000 -v $(pwd)/config.yaml:/app/config.yaml mvg-departures +docker run -p 8000:8000 -e TZ=Europe/Berlin -v $(pwd)/config.yaml:/app/config.yaml mvg-departures ``` -## Deployment (Beispiel docker-compose, nicht im Repo) +## Deployment + +Siehe `docker-compose.yml` im Repo als Referenz. Beispiel (Owner anpassen): ```yaml services: mvg-departures: - image: ghcr.io//mvg-departures:latest + image: ghcr.io/skoelle/mvg-departures:latest container_name: mvg-departures ports: - - "8090:8000" + - "8000:8000" volumes: - ./config.yaml:/app/config.yaml:ro environment: @@ -108,25 +110,32 @@ https://www.mvg.de/api/bgw-pt/v3/departures?globalId=de:09162:910&limit=10&trans ``` mvg-departures/ ├── app/ -│ ├── main.py # FastAPI-App, Endpunkte, Caching +│ ├── __init__.py +│ ├── main.py # FastAPI-App, Endpunkte, Caching │ ├── config.py # Config-Loader (YAML → Dataclasses) │ └── templates/ │ └── index.html # Jinja2-Template (Mobile-UI) ├── config.yaml # Stationskonfiguration +├── docker-compose.yml # Deployment-Beispiel ├── requirements.txt # Python-Dependencies ├── Dockerfile +├── .dockerignore +├── .gitignore +├── AGENTS.md +├── SPEC.md +├── renovate.json └── .github/workflows/ └── build.yml # CI/CD: Docker-Build + GHCR-Push ``` ## Tech-Stack -- **Runtime**: Python 3.12 +- **Runtime**: Python 3.14 - **Framework**: FastAPI + Uvicorn - **Templating**: Jinja2 (server-seitig) - **MVG-API**: `mvg` Python-Client (oeffentlich, kein Auth noetig) - **Config**: YAML via `pyyaml` -- **Container**: Docker (python:3.12-slim) +- **Container**: Docker (python:3.14-slim) ## Caching diff --git a/SPEC.md b/SPEC.md index 636317e..793321e 100644 --- a/SPEC.md +++ b/SPEC.md @@ -16,7 +16,7 @@ mvg-departures/ │ └── index.html # Jinja2-Template (mobile HTML-Ansicht) ├── config.yaml # Stationskonfiguration ├── requirements.txt # Python-Dependencies -├── Dockerfile # Multi-Stage Build (python:3.12-slim) +├── Dockerfile # Single-Stage Build (python:3.14-slim) ├── docker-compose.yml # Deployment-Beispiel └── .github/workflows/ └── build.yml # CI/CD: Docker-Build + GHCR-Push @@ -26,13 +26,13 @@ mvg-departures/ | Komponente | Technologie | |---|---| -| Runtime | Python 3.12 | +| Runtime | Python 3.14 | | Web-Framework | FastAPI | | Templating | Jinja2 | | API-Client | `mvg` (PyPI) | | Config | YAML (`pyyaml`) | | Server | Uvicorn | -| Container | Docker (python:3.12-slim) | +| Container | Docker (python:3.14-slim) | | CI/CD | GitHub Actions → GHCR | ## 4. Datenfluss diff --git a/app/config.py b/app/config.py index 44a06ad..a8128aa 100644 --- a/app/config.py +++ b/app/config.py @@ -1,4 +1,4 @@ -"""Config-Loader fuer die Stationsliste aus config.yaml.""" +"""Config-Loader für die Stationsliste aus config.yaml.""" import os import yaml from dataclasses import dataclass, field