diff --git a/.gitignore b/.gitignore index cbcf3ae..e23a514 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,9 @@ __pycache__/ .claude/worktrees/ Ban Yaro - Google Play package/ /unsplash/ + +# Selbst-gehostete Vektor-Tiles (groß, gehören nicht ins Repo) +tiles/build/ +*.pmtiles +*.osm.pbf +*.mbtiles diff --git a/Makefile b/Makefile index c16bf3f..3c0be1b 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,7 @@ TAR_EXCLUDE := --exclude='.git' \ --exclude='./backend/__pycache__' \ --exclude='./.env' \ --exclude='./*.db' \ + --exclude='./tiles' \ --exclude='./.DS_Store' .PHONY: help deploy deploy-clean staging release sync push restart build stop status \ diff --git a/backend/main.py b/backend/main.py index f4ecac6..453fb98 100644 --- a/backend/main.py +++ b/backend/main.py @@ -371,6 +371,13 @@ app.mount("/js", StaticFiles(directory=f"{STATIC_DIR}/js"), name="js") app.mount("/icons", StaticFiles(directory=f"{STATIC_DIR}/icons"), name="icons") app.mount("/img", StaticFiles(directory=f"{STATIC_DIR}/img"), name="img") +# Selbst-gehostete Vektor-Tiles (.pmtiles) — liegen im data-Volume, NICHT im Image. +# Starlette FileResponse beherrscht Range-Requests (206) → MapLibre/pmtiles-Protokoll. +# Guard: Mount nur wenn das Verzeichnis existiert (sonst No-Op, z. B. lokal/Prod ohne Tiles). +_TILES_DIR = os.getenv("TILES_DIR", "/data/tiles") +if os.path.isdir(_TILES_DIR): + app.mount("/tiles", StaticFiles(directory=_TILES_DIR), name="tiles") + # User-generierte Medien (Fotos aus Tagebuch, Giftköder-Alarm, etc.) MEDIA_DIR = os.getenv("MEDIA_DIR", "/data/media") os.makedirs(MEDIA_DIR, exist_ok=True)