feat: migrate from TileServer-GL to Martin
- docker-compose: ghcr.io/maplibre/martin:v1.10.1, Port 3000 - config/martin.yaml: Auto-Discovery MBTiles/Styles/Sprites/Fonts, CORS built-in - nginx-Container entfernt (NPM uebernimmt Proxy/SSL/Routing) - config/config.json + nginx/ entfernt (TileServer-GL Artefakte) - docs: alle Endpunkt-URLs auf Martin-Format aktualisiert - .github/copilot-instructions.md: Stack auf Martin (Rust) aktualisiert - Vorteile: Hot-Reload, CORS built-in, ~10x weniger RAM
This commit is contained in:
parent
7dd8b44ea8
commit
cd73f91021
11 changed files with 159 additions and 209 deletions
|
|
@ -1,2 +1,3 @@
|
||||||
# Beispiel – in .env kopieren und anpassen
|
# Beispiel – in .env kopieren und anpassen
|
||||||
TILE_PORT=8080
|
# Kein TILE_PORT mehr noetig – Martin laeuft direkt auf Port 3000
|
||||||
|
# NPM (Nginx Proxy Manager) uebernimmt SSL und Routing
|
||||||
|
|
|
||||||
37
.github/copilot-instructions.md
vendored
37
.github/copilot-instructions.md
vendored
|
|
@ -5,32 +5,31 @@ Selbst gehosteter Tile-Server (rd13) – stellt Karten-Tiles (OSM Vektor + Satel
|
||||||
für interne Dienste bereit: MediaWiki (Kartographer), Nextcloud Maps, Home Assistant und weitere Web-Apps.
|
für interne Dienste bereit: MediaWiki (Kartographer), Nextcloud Maps, Home Assistant und weitere Web-Apps.
|
||||||
|
|
||||||
## Stack
|
## Stack
|
||||||
- Language: Shell (Bash/Fish), JSON, Nginx config
|
- Language: Shell (Bash/Fish), YAML, JSON
|
||||||
- Infrastructure: Docker Compose, TileServer-GL (Node.js), nginx
|
- Infrastructure: Docker Compose, Martin (Rust), Nginx Proxy Manager (System-Proxy)
|
||||||
- Data: MBTiles / PMTiles (OpenMapTiles-Schema), Planetiler (Java)
|
- Data: MBTiles / PMTiles (OpenMapTiles-Schema), Planetiler (Java)
|
||||||
- Map styles: MapLibre GL / Mapbox GL JSON
|
- Map styles: MapLibre GL JSON (client-seitiges Rendering)
|
||||||
- Reverse Proxy: nginx mit CORS + Rate-Limiting
|
- Reverse Proxy: Nginx Proxy Manager (extern, SSL, Routing) – kein eigener nginx-Container
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
- Pattern: Single-purpose service (tile serving only)
|
- Pattern: Single-purpose service (tile serving only)
|
||||||
- `tileserver` Container: TileServer-GL rendert Tiles aus MBTiles-Dateien
|
- `martin` Container: Rust-basierter Tile-Server, serviert Vektor- und Raster-Tiles aus MBTiles/PMTiles
|
||||||
- `nginx` Container: CORS-Header, Rate-Limiting, Caching-Header, externer Endpunkt
|
- Kein nginx-Sidecar – CORS via Martin built-in, Proxy/SSL via NPM
|
||||||
- Kartendaten liegen in `data/` (nicht im Git, da mehrere GB)
|
- Kartendaten liegen in `data/` (nicht im Git, da mehrere GB)
|
||||||
- Styles in `data/styles/`, Fonts in `data/fonts/`
|
- Styles in `data/styles/`, Fonts in `data/fonts/`, Sprites in `data/sprites/`
|
||||||
- Key constraints:
|
- Key constraints:
|
||||||
- MBTiles/PMTiles nie ins Git committen (.gitignore)
|
- MBTiles/PMTiles nie ins Git committen (.gitignore)
|
||||||
- Secrets immer via `.env` (`.env` selbst auch ignoriert)
|
- Secrets immer via `.env` (`.env` selbst auch ignoriert)
|
||||||
- CORS muss für alle Dienste im LAN offen sein (internes Netz)
|
- CORS via Martin-Config (alle Origins erlaubt für LAN)
|
||||||
|
|
||||||
## Conventions
|
## Conventions
|
||||||
- Branch naming: `feat/<beschreibung>`, `fix/<beschreibung>`
|
- Branch naming: `feat/<beschreibung>`, `fix/<beschreibung>`
|
||||||
- Commit format: Conventional Commits (`feat|fix|chore|docs|refactor|ci`)
|
- Commit format: Conventional Commits (`feat|fix|chore|docs|refactor|ci`)
|
||||||
- File structure:
|
- File structure:
|
||||||
```
|
```
|
||||||
config/ TileServer-GL config.json
|
config/ Martin-Konfiguration (martin.yaml)
|
||||||
data/ MBTiles, Fonts, Sprites, Styles (nicht im Git)
|
data/ MBTiles, Fonts, Sprites, Styles (nicht im Git)
|
||||||
docs/ Integrations-Anleitungen (MediaWiki, Nextcloud, Home Assistant, API)
|
docs/ Integrations-Anleitungen (MediaWiki, Nextcloud, Home Assistant, API)
|
||||||
nginx/ nginx.conf, cors.conf
|
|
||||||
prompts/ GitHub Copilot Prompt-Templates
|
prompts/ GitHub Copilot Prompt-Templates
|
||||||
scripts/ Daten-Download, Deploy-Hilfen
|
scripts/ Daten-Download, Deploy-Hilfen
|
||||||
```
|
```
|
||||||
|
|
@ -40,30 +39,34 @@ für interne Dienste bereit: MediaWiki (Kartographer), Nextcloud Maps, Home Assi
|
||||||
|
|
||||||
### Before starting any task
|
### Before starting any task
|
||||||
1. `docker compose config` – Syntax validieren
|
1. `docker compose config` – Syntax validieren
|
||||||
2. `docker compose logs tileserver` – laufende Fehler prüfen
|
2. `docker compose logs martin` – laufende Fehler prüfen
|
||||||
3. Impact analysis – betrifft die Änderung CORS, Caching oder Endpunkt-URLs?
|
3. Impact analysis – betrifft die Änderung CORS, Caching oder Endpunkt-URLs?
|
||||||
4. Test strategy – mit curl / Browser gegen lokalen Server testen
|
4. Test strategy – mit curl / Browser gegen lokalen Server testen
|
||||||
|
|
||||||
### Definition of Done (DoD)
|
### Definition of Done (DoD)
|
||||||
- [ ] `docker compose config` fehlerfrei
|
- [ ] `docker compose config` fehlerfrei
|
||||||
- [ ] Server startet ohne Fehler in den Logs
|
- [ ] Server startet ohne Fehler in den Logs
|
||||||
- [ ] Tile-Endpunkt antwortet (`curl http://localhost:PORT/health`)
|
- [ ] Tile-Endpunkt antwortet (`curl http://localhost:3000/health`)
|
||||||
- [ ] CORS-Header korrekt gesetzt (prüfen mit `curl -I -H "Origin: ..."`)
|
- [ ] CORS-Header korrekt gesetzt (prüfen mit `curl -I -H "Origin: ..."`)
|
||||||
- [ ] Keine Secrets in docker-compose.yml oder Configs
|
- [ ] Keine Secrets in docker-compose.yml oder Configs
|
||||||
- [ ] .gitignore schützt MBTiles und .env
|
- [ ] .gitignore schützt MBTiles und .env
|
||||||
- [ ] Commit message folgt Conventional Commits
|
- [ ] Commit message folgt Conventional Commits
|
||||||
|
|
||||||
## Tile-Server spezifische Hinweise
|
## Tile-Server spezifische Hinweise
|
||||||
- Styles müssen auf `http://localhost:8080` zeigen (intern) – nginx setzt öffentliche URL
|
- Martin serviert Tiles direkt aus MBTiles/PMTiles – kein server-seitiges Rendering
|
||||||
|
- Clients (MediaWiki, Nextcloud, HA) rendern OSM-Vektorkacheln via MapLibre GL im Browser
|
||||||
|
- Satellit-Raster-Tiles (PNG) werden direkt aus raster MBTiles durchgereicht
|
||||||
|
- Hot-Reload: neue `.mbtiles`-Datei in `data/` ablegen → sofort unter `/catalog` sichtbar
|
||||||
- Zoom-Level 0–14 reichen für die meisten Anwendungsfälle (Dateigröße vs. Detail)
|
- Zoom-Level 0–14 reichen für die meisten Anwendungsfälle (Dateigröße vs. Detail)
|
||||||
- Planetiler benötigt min. 4 GB RAM für Deutschland, 8 GB für Europa
|
- Planetiler benötigt min. 4 GB RAM für Deutschland, 8 GB für Europa
|
||||||
- Satellitenkacheln: kostenfrei nur bis Zoom 10 (NASA GIBS oder maptiler.com)
|
- Satellitenkacheln: kostenfrei nur bis Zoom 10 (NASA GIBS oder maptiler.com)
|
||||||
- TileJSON-Endpoints: `/styles/{name}.json` und `/data/{name}.json`
|
- TileJSON-Endpoints: `/{source_id}` z.B. `/osm`, `/satellite`
|
||||||
|
- Katalog aller geladenen Sources: `/catalog`
|
||||||
|
|
||||||
## Security
|
## Security
|
||||||
- Keine Secrets in config.json oder nginx.conf
|
- Keine Secrets in martin.yaml oder docker-compose.yml
|
||||||
- nginx Rate-Limiting aktiv halten (100r/s, Burst 200)
|
- NPM Rate-Limiting aktiv halten
|
||||||
- Ports: nginx nach außen, tileserver nur intern (expose, nicht ports)
|
- Port 3000 nur intern exponieren wenn NPM im selben Docker-Netz läuft
|
||||||
- CORS auf `*` ist für internes LAN akzeptabel – für public deployment einschränken
|
- CORS auf `*` ist für internes LAN akzeptabel – für public deployment einschränken
|
||||||
|
|
||||||
## Non-Functional Requirements
|
## Non-Functional Requirements
|
||||||
|
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
{
|
|
||||||
"options": {
|
|
||||||
"paths": {
|
|
||||||
"root": "",
|
|
||||||
"fonts": "fonts",
|
|
||||||
"sprites": "sprites",
|
|
||||||
"styles": "styles",
|
|
||||||
"mbtiles": ""
|
|
||||||
},
|
|
||||||
"serveAllFonts": true,
|
|
||||||
"serveAllStyles": true
|
|
||||||
},
|
|
||||||
"data": {
|
|
||||||
"osm-openmaptiles": {
|
|
||||||
"mbtiles": "osm.mbtiles"
|
|
||||||
},
|
|
||||||
"satellite": {
|
|
||||||
"mbtiles": "satellite.mbtiles"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"styles": {
|
|
||||||
"osm-bright": {
|
|
||||||
"style": "styles/osm-bright/style.json"
|
|
||||||
},
|
|
||||||
"satellite-hybrid": {
|
|
||||||
"style": "styles/satellite-hybrid/style.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
43
config/martin.yaml
Normal file
43
config/martin.yaml
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
# Martin Tile Server – Konfiguration
|
||||||
|
# Dokumentation: https://maplibre.org/martin/
|
||||||
|
|
||||||
|
listen_addresses: "0.0.0.0:3000"
|
||||||
|
keep_alive: 75
|
||||||
|
worker_processes: 4
|
||||||
|
preferred_encoding: gzip
|
||||||
|
|
||||||
|
# CORS – erlaubt Zugriff von allen LAN-Diensten (MediaWiki, Nextcloud, Home Assistant)
|
||||||
|
# Fuer public deployment: origins auf eigene Domains einschraenken
|
||||||
|
cors:
|
||||||
|
allowed_origins:
|
||||||
|
- "*"
|
||||||
|
allowed_methods:
|
||||||
|
- GET
|
||||||
|
- OPTIONS
|
||||||
|
allowed_headers:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
# Auto-Discovery: alle *.mbtiles und *.pmtiles aus /data laden
|
||||||
|
# osm.mbtiles -> Source-ID: osm -> /{z}/{x}/{y} unter /osm/
|
||||||
|
# satellite.mbtiles -> Source-ID: satellite -> /{z}/{x}/{y} unter /satellite/
|
||||||
|
mbtiles:
|
||||||
|
paths:
|
||||||
|
- /data
|
||||||
|
|
||||||
|
# MapLibre GL Styles aus /data/styles/ servieren
|
||||||
|
# -> GET /styles/{id} (Style-JSON fuer MapLibre GL Clients)
|
||||||
|
styles:
|
||||||
|
paths:
|
||||||
|
- /data/styles
|
||||||
|
|
||||||
|
# Sprites (Icons, Pins, Marker) aus /data/sprites/
|
||||||
|
# -> GET /sprites/{id}.json und /sprites/{id}.png
|
||||||
|
sprites:
|
||||||
|
paths:
|
||||||
|
- /data/sprites
|
||||||
|
|
||||||
|
# Schriftarten fuer Karten-Labels
|
||||||
|
# -> GET /fonts/{font_name}/{start}-{end}.pbf
|
||||||
|
fonts:
|
||||||
|
paths:
|
||||||
|
- /data/fonts
|
||||||
|
|
@ -1,30 +1,17 @@
|
||||||
services:
|
services:
|
||||||
tileserver:
|
martin:
|
||||||
image: maptiler/tileserver-gl:latest
|
image: ghcr.io/maplibre/martin:v1.10.1
|
||||||
container_name: rd13_tileserver
|
container_name: rd13_martin
|
||||||
expose:
|
ports:
|
||||||
- "8080"
|
- "3000:3000"
|
||||||
volumes:
|
volumes:
|
||||||
- ./data:/data
|
- ./data:/data
|
||||||
- ./config/config.json:/data/config.json:ro
|
- ./config/martin.yaml:/config/martin.yaml:ro
|
||||||
command: ["--config", "/data/config.json", "--port", "8080", "--verbose"]
|
command: ["--config", "/config/martin.yaml"]
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080/health"]
|
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000/health"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 3
|
||||||
start_period: 20s
|
start_period: 10s
|
||||||
|
|
||||||
nginx:
|
|
||||||
image: nginx:alpine
|
|
||||||
container_name: rd13_tileserver_proxy
|
|
||||||
ports:
|
|
||||||
- "${TILE_PORT:-8080}:80"
|
|
||||||
volumes:
|
|
||||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
||||||
- ./nginx/cors.conf:/etc/nginx/cors.conf:ro
|
|
||||||
depends_on:
|
|
||||||
tileserver:
|
|
||||||
condition: service_healthy
|
|
||||||
restart: unless-stopped
|
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,46 @@
|
||||||
# Allgemeine Tile-Server Endpunkte
|
# Martin Tile Server – Endpunkte
|
||||||
#
|
#
|
||||||
# Sobald der Server läuft, sind folgende Endpoints verfügbar:
|
# Sobald der Server laeuft (Port 3000, via NPM erreichbar):
|
||||||
#
|
#
|
||||||
# Web-Interface:
|
# Health-Check:
|
||||||
# http://SERVER:PORT/
|
# http://SERVER:3000/health
|
||||||
#
|
#
|
||||||
# Styles (Raster-Tiles, PNG):
|
# Katalog aller geladenen Sources (MBTiles/PMTiles):
|
||||||
# http://SERVER:PORT/styles/osm-bright/{z}/{x}/{y}.png ← OSM
|
# http://SERVER:3000/catalog
|
||||||
# http://SERVER:PORT/styles/satellite-hybrid/{z}/{x}/{y}.png ← Satellit
|
|
||||||
# http://SERVER:PORT/styles/osm-bright/{z}/{x}/{y}@2x.png ← Retina
|
|
||||||
#
|
#
|
||||||
# Daten (Vektor-Tiles, PBF):
|
# Vektor-Tiles (OSM, OpenMapTiles-Schema – PBF):
|
||||||
# http://SERVER:PORT/data/osm-openmaptiles/{z}/{x}/{y}.pbf
|
# http://SERVER:3000/osm/{z}/{x}/{y}
|
||||||
# http://SERVER:PORT/data/satellite/{z}/{x}/{y}.png
|
# TileJSON-Metadaten: http://SERVER:3000/osm
|
||||||
#
|
#
|
||||||
# TileJSON (Metadaten für Leaflet, MapLibre, etc.):
|
# Raster-Tiles (Satellit – PNG, direkt aus raster MBTiles):
|
||||||
# http://SERVER:PORT/styles/osm-bright.json
|
# http://SERVER:3000/satellite/{z}/{x}/{y}
|
||||||
# http://SERVER:PORT/data/osm-openmaptiles.json
|
# TileJSON-Metadaten: http://SERVER:3000/satellite
|
||||||
#
|
#
|
||||||
# WMTS (für QGIS, ArcGIS, etc.):
|
# MapLibre GL Style (fuer Clients die selbst rendern):
|
||||||
# http://SERVER:PORT/styles/osm-bright/wmts
|
# http://SERVER:3000/styles/osm-bright
|
||||||
|
# http://SERVER:3000/styles/satellite-hybrid
|
||||||
#
|
#
|
||||||
# Leaflet.js Beispiel:
|
# Sprites (Icons, Pins, eigene Marker):
|
||||||
# L.tileLayer('http://SERVER:PORT/styles/osm-bright/{z}/{x}/{y}.png', {
|
# http://SERVER:3000/sprites/default.json
|
||||||
# attribution: '© OpenMapTiles © OpenStreetMap contributors',
|
# http://SERVER:3000/sprites/default.png
|
||||||
# maxZoom: 20
|
|
||||||
# }).addTo(map);
|
|
||||||
#
|
#
|
||||||
# MapLibre GL Beispiel:
|
# Fonts (Karten-Labels):
|
||||||
|
# http://SERVER:3000/fonts/{font_name}/{start}-{end}.pbf
|
||||||
|
#
|
||||||
|
# MapLibre GL – Style direkt einbinden (empfohlen fuer alle Clients):
|
||||||
# new maplibregl.Map({
|
# new maplibregl.Map({
|
||||||
# style: 'http://SERVER:PORT/styles/osm-bright.json',
|
# style: 'http://SERVER:3000/styles/osm-bright',
|
||||||
# container: 'map'
|
# container: 'map'
|
||||||
# });
|
# });
|
||||||
#
|
#
|
||||||
# Home Assistant – configuration.yaml:
|
# Leaflet.js – Raster-Tiles (Satellit):
|
||||||
# map:
|
# L.tileLayer('http://SERVER:3000/satellite/{z}/{x}/{y}', {
|
||||||
# lovelace card (custom:map-card oder built-in):
|
# attribution: 'Sentinel-2 cloudless',
|
||||||
# tile_layer_url: 'http://SERVER:PORT/styles/osm-bright/{z}/{x}/{y}.png'
|
# maxZoom: 14
|
||||||
# tile_layer_attribution: '© OpenMapTiles © OpenStreetMap contributors'
|
# }).addTo(map);
|
||||||
#
|
#
|
||||||
# Für Home Assistant custom:map-card (HACS):
|
# Home Assistant custom:map-card – Satellit (Raster, direkt nutzbar):
|
||||||
# tile_layer_url: 'http://SERVER:PORT/styles/osm-bright/{z}/{x}/{y}.png'
|
# tile_layer_url: 'http://SERVER:3000/satellite/{z}/{x}/{y}'
|
||||||
# tile_layer_max_zoom: 19
|
#
|
||||||
|
# NPM Advanced Config (Caching-Header, einmalig eintragen):
|
||||||
|
# add_header Cache-Control "public, max-age=86400, stale-while-revalidate=3600" always;
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,20 @@
|
||||||
# Home Assistant – eigenen Tile-Server verwenden
|
# Home Assistant – eigenen Tile-Server verwenden
|
||||||
#
|
#
|
||||||
# Home Assistant kann über mehrere Wege eigene Karten-Tiles nutzen.
|
# Martin liefert Raster-Tiles (Satellit) direkt als PNG – ideal fuer HA.
|
||||||
|
# OSM-Vektorkarten werden ueber MapLibre GL Style eingebunden.
|
||||||
#
|
#
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# Option 1: Map Card (Standard Lovelace)
|
# Option 1: Map Card (Standard Lovelace) – Satellit (Raster, sofort nutzbar)
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# In einer Lovelace-Dashboard-Karte (type: map) wird der Tile-Server über
|
|
||||||
# ein custom Frontend-Modul eingebunden. Die eingebaute Map-Card unterstützt
|
|
||||||
# ab HA 2024.x direkt eigene Tile-Layer:
|
|
||||||
#
|
|
||||||
# Lovelace YAML (Dashboard → Karte bearbeiten → YAML-Modus):
|
|
||||||
#
|
|
||||||
# type: map
|
# type: map
|
||||||
# entities:
|
# entities:
|
||||||
# - person.YOUR_PERSON
|
# - person.YOUR_PERSON
|
||||||
# default_zoom: 12
|
# default_zoom: 12
|
||||||
# # Tile Layer Override (ab HA 2024.6+):
|
# tile_layer: https://TILE_SERVER_URL/satellite/{z}/{x}/{y}
|
||||||
# tile_layer: http://TILE_SERVER_URL:8080/styles/osm-bright/{z}/{x}/{y}.png
|
# tile_layer_attribution: "Sentinel-2 cloudless"
|
||||||
# tile_layer_attribution: "© OpenMapTiles © OpenStreetMap contributors"
|
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# Option 2: custom:map-card (HACS)
|
# Option 2: custom:map-card (HACS) – Satellit
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# https://github.com/nathan-gs/ha-map-card
|
# https://github.com/nathan-gs/ha-map-card
|
||||||
#
|
#
|
||||||
|
|
@ -28,25 +22,26 @@
|
||||||
# x: 48.137
|
# x: 48.137
|
||||||
# y: 11.576
|
# y: 11.576
|
||||||
# zoom: 12
|
# zoom: 12
|
||||||
# tile_layer_url: "http://TILE_SERVER_URL:8080/styles/osm-bright/{z}/{x}/{y}.png"
|
# tile_layer_url: "https://TILE_SERVER_URL/satellite/{z}/{x}/{y}"
|
||||||
# tile_layer_attribution: "© OpenMapTiles © OpenStreetMap contributors"
|
# tile_layer_attribution: "Sentinel-2 cloudless"
|
||||||
# tile_layer_max_zoom: 19
|
# tile_layer_max_zoom: 14
|
||||||
# entities:
|
# entities:
|
||||||
# - entity: person.YOUR_PERSON
|
# - entity: person.YOUR_PERSON
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# Option 3: Satellitenkarte als alternativer Layer
|
# Option 3: custom:map-card – OSM via MapLibre GL Style
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# type: custom:map-card
|
# type: custom:map-card
|
||||||
# tile_layer_url: "http://TILE_SERVER_URL:8080/styles/satellite-hybrid/{z}/{x}/{y}.png"
|
# tile_layer_url: "https://TILE_SERVER_URL/osm/{z}/{x}/{y}"
|
||||||
# tile_layer_attribution: "© OpenMapTiles © Sentinel-2"
|
# tile_layer_attribution: "© OpenMapTiles © OpenStreetMap contributors"
|
||||||
|
# tile_layer_max_zoom: 19
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# Hinweise
|
# Hinweise
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# - TILE_SERVER_URL ersetzen mit der IP/Hostname des Tile-Servers im LAN
|
# - TILE_SERVER_URL = oeffentliche URL via NPM (kein Port noetig bei HTTPS)
|
||||||
# - Port 8080 ist Standard (nginx-Proxy), anpassen falls abweichend
|
# - Satellit (Raster-PNG) ist direkt nutzbar ohne MapLibre GL
|
||||||
# - CORS ist bereits für das gesamte LAN (Origin: *) konfiguriert
|
# - OSM-Vektorkacheln: HA rendert sie nicht nativ – Raster-Tiles oder
|
||||||
# - Home Assistant muss den Tile-Server über HTTP im LAN erreichen können
|
# MapLibre GL Style-Einbindung ueber custom:map-card verwenden
|
||||||
# - Für HTTPS-Setups: Tile-Server ebenfalls über HTTPS erreichbar machen
|
# - CORS ist via Martin built-in konfiguriert (alle Origins erlaubt)
|
||||||
# (z.B. über nginx Reverse Proxy mit SSL-Terminierung)
|
# - Fuer HTTPS: NPM uebernimmt SSL-Terminierung
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,38 @@
|
||||||
# MediaWiki Kartographer – Konfiguration für LocalSettings.php
|
# MediaWiki Kartographer – Konfiguration fuer LocalSettings.php
|
||||||
#
|
#
|
||||||
# Füge diese Zeilen in deine LocalSettings.php ein.
|
# Fuelle diese Zeilen in deine LocalSettings.php ein.
|
||||||
# Ersetze TILE_SERVER_URL mit der tatsächlichen URL deines Servers.
|
# Ersetze TILE_SERVER_URL mit der oeffentlichen URL deines Servers (via NPM).
|
||||||
#
|
#
|
||||||
# Dokumentation: https://www.mediawiki.org/wiki/Extension:Kartographer
|
# Dokumentation: https://www.mediawiki.org/wiki/Extension:Kartographer
|
||||||
|
#
|
||||||
|
# Hinweis: Kartographer nutzt MapLibre GL im Browser – der Server liefert
|
||||||
|
# Vektor-Tiles und Style-JSON, das Rendering passiert client-seitig.
|
||||||
|
|
||||||
# Kartographer aktivieren
|
# Kartographer aktivieren
|
||||||
wfLoadExtension( 'Kartographer' );
|
wfLoadExtension( 'Kartographer' );
|
||||||
|
|
||||||
# Tile-Server URL (dein selbst gehosteter Server)
|
# Tile-Server-Basis-URL (oeffentliche URL via NPM, kein Port noetig bei HTTPS)
|
||||||
$wgKartographerMapServer = 'http://TILE_SERVER_URL:8080';
|
$wgKartographerMapServer = 'https://TILE_SERVER_URL';
|
||||||
|
|
||||||
# Welche Kartenstile stehen zur Verfügung?
|
# Verfuegbare Kartenstile
|
||||||
# Die Namen entsprechen den Keys in config/config.json → "styles"
|
# Die Namen entsprechen den Style-Dateien in data/styles/
|
||||||
$wgKartographerStyles = [
|
$wgKartographerStyles = [
|
||||||
'osm-bright', # OpenStreetMap Vektorkarte
|
'osm-bright', # OpenStreetMap Vektorkarte (MapLibre GL)
|
||||||
'satellite-hybrid', # Satellitenkarte
|
'satellite-hybrid', # Satellitenkarte
|
||||||
];
|
];
|
||||||
|
|
||||||
# Standard-Stil
|
# Standard-Stil
|
||||||
$wgKartographerDfltStyle = 'osm-bright';
|
$wgKartographerDfltStyle = 'osm-bright';
|
||||||
|
|
||||||
# Tile-URL-Muster für Raster-Tiles (XYZ)
|
|
||||||
# TileServer-GL stellt Tiles unter /styles/{style}/{z}/{x}/{y}.png bereit
|
|
||||||
$wgKartographerSrcsetScales = [ 1, 1.5, 2 ];
|
$wgKartographerSrcsetScales = [ 1, 1.5, 2 ];
|
||||||
|
|
||||||
# Optional: statische Kartenbilder für Vorschau (Mapshot)
|
# Tile-Endpunkte (Martin-Format):
|
||||||
# $wgKartographerStaticFullWidth = true;
|
# Vektor-Tiles: https://TILE_SERVER_URL/osm/{z}/{x}/{y}
|
||||||
|
# Satellit: https://TILE_SERVER_URL/satellite/{z}/{x}/{y}
|
||||||
|
# Style-JSON: https://TILE_SERVER_URL/styles/osm-bright
|
||||||
|
|
||||||
# Beispiel-Verwendung in einem Wiki-Artikel:
|
# Beispiel-Verwendung in einem Wiki-Artikel:
|
||||||
# <maplink zoom="12" latitude="48.137" longitude="11.576">
|
# <maplink zoom="12" latitude="48.137" longitude="11.576">
|
||||||
# {"type":"Feature","geometry":{"type":"Point","coordinates":[11.576,48.137]},
|
# {"type":"Feature","geometry":{"type":"Point","coordinates":[11.576,48.137]},
|
||||||
# "properties":{"title":"München","description":"Landeshauptstadt"}}
|
# "properties":{"title":"Muenchen","description":"Landeshauptstadt"}}
|
||||||
# </maplink>
|
# </maplink>
|
||||||
|
|
|
||||||
|
|
@ -3,25 +3,27 @@
|
||||||
# Nextcloud Maps App: https://apps.nextcloud.com/apps/maps
|
# Nextcloud Maps App: https://apps.nextcloud.com/apps/maps
|
||||||
#
|
#
|
||||||
# Konfiguration in Nextcloud Admin-Panel:
|
# Konfiguration in Nextcloud Admin-Panel:
|
||||||
# Einstellungen → Verwaltung → Maps → Tile server URL
|
# Einstellungen -> Verwaltung -> Maps -> Tile server URL
|
||||||
#
|
#
|
||||||
# Tile-Server-URLs (TileServer-GL XYZ-Format):
|
# Tile-Server-URLs (Martin-Format):
|
||||||
#
|
#
|
||||||
# OSM Vektorkarte (als Rasterbild gerendert):
|
# OSM Vektorkarte (MapLibre GL Style – Nextcloud rendert client-seitig):
|
||||||
# http://TILE_SERVER_URL:8080/styles/osm-bright/{z}/{x}/{y}.png
|
# https://TILE_SERVER_URL/styles/osm-bright
|
||||||
#
|
#
|
||||||
# Satellitenkarte:
|
# Satellitenkarte (Raster-Tiles, direkt nutzbar):
|
||||||
# http://TILE_SERVER_URL:8080/styles/satellite-hybrid/{z}/{x}/{y}.png
|
# https://TILE_SERVER_URL/satellite/{z}/{x}/{y}
|
||||||
#
|
#
|
||||||
# Rohe Vektorkacheln (OpenMapTiles Schema):
|
# Rohe Vektor-Tiles (OpenMapTiles-Schema):
|
||||||
# http://TILE_SERVER_URL:8080/data/osm-openmaptiles/{z}/{x}/{y}.pbf
|
# https://TILE_SERVER_URL/osm/{z}/{x}/{y}
|
||||||
#
|
#
|
||||||
# Über occ (Kommandozeile) setzen:
|
# Ueber occ (Kommandozeile) setzen:
|
||||||
# php occ config:app:set maps tileserverUrl \
|
# php occ config:app:set maps tileserverUrl # --value="https://TILE_SERVER_URL/satellite/{z}/{x}/{y}"
|
||||||
# --value="http://TILE_SERVER_URL:8080/styles/osm-bright/{z}/{x}/{y}.png"
|
#
|
||||||
|
# Hinweis: Fuer OSM als gerendertes Rasterbild nutze den Style-Endpunkt.
|
||||||
# Beispiel für docker-compose override wenn Nextcloud im selben Stack läuft:
|
# Nextcloud Maps unterstuetzt MapLibre GL Styles ab Version 1.4+.
|
||||||
|
#
|
||||||
|
# Beispiel fuer docker-compose override wenn Nextcloud im selben Stack laeuft:
|
||||||
#
|
#
|
||||||
# nextcloud:
|
# nextcloud:
|
||||||
# environment:
|
# environment:
|
||||||
# MAPS_TILE_SERVER: "http://rd13_tileserver_proxy/styles/osm-bright/{z}/{x}/{y}.png"
|
# MAPS_TILE_SERVER: "http://rd13_martin:3000/styles/osm-bright"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
# Shared CORS headers – included by nginx.conf
|
|
||||||
# Wird automatisch auf alle Responses angewendet.
|
|
||||||
# Für produktiven Betrieb kann Origin auf deine Domains eingeschränkt werden:
|
|
||||||
# add_header Access-Control-Allow-Origin "https://wiki.example.com" always;
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
worker_processes auto;
|
|
||||||
events { worker_connections 1024; }
|
|
||||||
|
|
||||||
http {
|
|
||||||
include mime.types;
|
|
||||||
default_type application/octet-stream;
|
|
||||||
sendfile on;
|
|
||||||
keepalive_timeout 65;
|
|
||||||
|
|
||||||
# Rate limiting – schützt vor Missbrauch durch externe Dienste
|
|
||||||
limit_req_zone $binary_remote_addr zone=tiles:10m rate=100r/s;
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name _;
|
|
||||||
|
|
||||||
# CORS für alle Clients (MediaWiki, Nextcloud, Home Assistant, etc.)
|
|
||||||
include /etc/nginx/cors.conf;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
limit_req zone=tiles burst=200 nodelay;
|
|
||||||
|
|
||||||
proxy_pass http://tileserver:8080;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
|
|
||||||
# Tile-Caching-Header
|
|
||||||
proxy_hide_header Cache-Control;
|
|
||||||
add_header Cache-Control "public, max-age=86400, stale-while-revalidate=3600";
|
|
||||||
|
|
||||||
# CORS-Header (aus cors.conf)
|
|
||||||
add_header Access-Control-Allow-Origin "*" always;
|
|
||||||
add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
|
|
||||||
add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept" always;
|
|
||||||
}
|
|
||||||
|
|
||||||
# CORS Preflight
|
|
||||||
location ~* \.(pbf|png|jpg|json)$ {
|
|
||||||
if ($request_method = OPTIONS) {
|
|
||||||
add_header Access-Control-Allow-Origin "*";
|
|
||||||
add_header Access-Control-Allow-Methods "GET, OPTIONS";
|
|
||||||
add_header Access-Control-Max-Age 86400;
|
|
||||||
return 204;
|
|
||||||
}
|
|
||||||
|
|
||||||
proxy_pass http://tileserver:8080;
|
|
||||||
add_header Access-Control-Allow-Origin "*" always;
|
|
||||||
add_header Cache-Control "public, max-age=86400";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Reference in a new issue