rd13_tile_server/history/prompts/2026-06-03_tile-server-setup_session.md

273 lines
7.9 KiB
Markdown
Raw Normal View History

# Tile Server Setup 2026-05-31 bis 2026-06-03
## Aufgabe / Ziel
Einen selbst gehosteten Tile Server in Docker aufsetzen, der für MediaWiki, Nextcloud,
Home Assistant und andere Dienste Karten bereitstellt. Initialisierung als Git-Repo
mit Push zur eigenen Forgejo-Instance.
---
## Verlauf
### Prompt 1
«ich möchte hier ein völlig neues repo eröffnen das schon zu meiner forgejo instance puscht und mit dem ai repo initialisiert wird um dann einen selbst gehosteten tile server zu betreiben in docker»
### Antwort 1
Git-Repo initialisiert, Remote gesetzt, copilot-setup-Dateien integriert. Initiales
docker-compose.yml mit TileServer-GL erstellt, 4 Commits gepusht.
```bash
git init
git remote add origin ssh://git@192.168.178.6:2222/cschulz/rd13_tile_server.git
git push -u origin main
```
---
### Prompt 2
«tile server soll für media wiki nextcloud und andere dienste karten bereitstellen können»
### Antwort 2
Dokumentation für MediaWiki, Nextcloud erstellt (`docs/mediawiki-config.php`,
`docs/nextcloud-config.md`). TileServer-GL Konfiguration angepasst.
---
### Prompt 3
«Home assistent sollte die karten auch nurtzen können»
### Antwort 3
`docs/homeassistant-config.md` mit Raster-Tiles und MapLibre-Style-Optionen für HA
erstellt und committed.
---
### Prompt 4
«Lass uns alles auf martin umbauen»
### Antwort 4
Nach Evaluation von 5 Tile-Servern (TileServer-GL, Martin, Tegola, t-rex, pg_tileserv)
Migration auf Martin (Rust, `ghcr.io/maplibre/martin:v1.10.1`):
- `docker-compose.yml` auf Martin umgebaut
- `config/martin.yaml` erstellt (CORS, worker_processes, mbtiles.paths)
- `config/config.json` (TileServer-GL) entfernt (`git rm -f`)
- Alle Docs auf Martin-Endpoints aktualisiert
---
### Prompt 5
«brauchen wir den nginx zwingend wenn ich einen system nginx proxy mit nginx manager habe?»
### Antwort 5
nginx-Container vollständig entfernt. Martin läuft als einziger Service, NPM
(Nginx Proxy Manager) übernimmt SSL/Routing/Caching.
```bash
git rm nginx/nginx.conf nginx/cors.conf
```
---
### Prompt 6
«dann lass uns mal die ganze welt in openstreetmap und satelit in /data laden und den externen Port noch auf 9982 legen»
### Antwort 6
- Port in `docker-compose.yml` auf `9982:3000` geändert
- `scripts/download-data.sh` erstellt (OSM via Planetiler + Satellit-Orchestrator)
- `scripts/download-satellite.py` erstellt (Sentinel-2 cloudless zoom 010 → MBTiles)
- Alle Commits gepusht
---
### Prompt 7
«lass uns den download detached starten das er fernab der session zu ende laufen kann»
### Antwort 7
```bash
tmux new-session -d -s rd13-download -c /mnt/services-data/rd13_tile_server \
'bash scripts/download-data.sh all 2>&1 | tee logs/download.log'
```
Probleme beim ersten Start:
1. `java: command not found` Planetiler braucht Java, nicht vorhanden
2. Font/Style-URLs falsch (v3.0.zip statt v2.0.zip)
Fix in `download-data.sh`: Planetiler via Docker statt lokal, korrekte URLs:
```bash
docker run --rm -v ./data:/data -e JAVA_TOOL_OPTIONS="-Xmx8g" \
ghcr.io/onthegomap/planetiler:latest \
--download --area=planet --output=/data/osm.mbtiles --force
```
---
### Prompt 8
«ein history promt file sieht noch so aus.... [zeigt Auto-Log ohne Konversation]»
### Antwort 8
Problem analysiert: post-commit Hook erzeugt nur Git-Metadaten, kein KI-Inhalt.
Lösung im `rd13_copilot_setup` Repo:
- `git-templates/hooks/post-commit` umgebaut: erkennt `*_session.md` (vom Agent
via `/history` erstellt) → hängt Git-Block an statt neue Datei zu erstellen
- `prompts/history.prompt.md` aktualisiert: Dateinamen-Konvention `_session.md`
dokumentiert
```bash
cd /mnt/services-data/rd13_copilot_setup
git add git-templates/hooks/post-commit prompts/history.prompt.md
git commit -m "feat: post-commit hängt git-block an session-datei an"
git push
```
---
### Prompt 9
«ach so ich bin im falschen repo lass uns das alles im rd13_copilot_setup repo einbauen und später verteilen.»
### Antwort 9
Bereits in rd13_copilot_setup umgesetzt (siehe Prompt 8).
---
### Prompt 10
«Ist der download fertig?»
### Antwort 10
Nach 2:10h: Planetiler in Phase `osm_pass1`, noch nicht fertig.
---
### Prompt 11
«wie sieht es mit den Karten daten aus sind alle da?»
### Antwort 11
Download abgebrochen. Log endet nach 2:10h mitten in `osm_pass1`. `osm.mbtiles`
nur 4 KB (leer). Ursache: Disk voll (302 GB frei, aber tmp/ braucht 264 GB + 87 GB
sources = kein Platz für finale MBTiles).
---
### Prompt 12
«ja lass uns das alles mal neu starten.»
### Antwort 12
```bash
# tmp/ gehört root (Docker) → sudo nötig
sudo rm -rf data/tmp/ && sudo rm -f data/osm.mbtiles
# → 566 GB frei
tmux new-session -d -s rd13-osm ... 'docker run ... planetiler ...'
```
Planetiler läuft, überspringt Download (sources gecacht). Aber nach 8h in Phase
`sort` (97%) wieder abgebrochen → Log endet nach 563 Zeilen in `osm_pass2`.
---
### Prompt 13
«Kann es sein das dies auch der falsche ansatz ist, gibt es einfacherere wege...»
### Antwort 13
Ja. Alternativen:
1. **OpenFreeMap MBTiles** fertiger Planet-Download, kein Processing
2. Nur eine Region (Deutschland ~700 MB, Planetiler 5 Min.)
3. Geofabrik-Extrakt
Empfehlung: Option 1 (OpenFreeMap), planet-weit, ~94 GB, direkt downloadbar.
---
### Prompt 14
«lass uns erstmal aufräumen und alles unnötige löschen und dann option 1 umsetzen.»
### Antwort 14
```bash
# Aufräumen (sudo wegen root-owned Dateien)
sudo rm -rf data/tmp/ data/sources/ data/osm.mbtiles data/planetiler.jar data/tile_weights.tsv.gz
# → 655 GB frei
```
OpenFreeMap Index geprüft:
```bash
curl -s "https://btrfs.openfreemap.com/files.txt" | grep "planet.*mbtiles"
# → aktuellste: areas/planet/20260531_080002_pt/tiles.mbtiles (~94 GB)
```
Download gestartet:
```bash
tmux new-session -d -s rd13-download ... \
'wget --continue -O data/osm.mbtiles \
"https://btrfs.openfreemap.com/areas/planet/20260531_080002_pt/tiles.mbtiles" \
2>&1 | tee logs/download-osm.log'
```
~20 MB/s, ETA ~80 Minuten.
---
### Prompt 15
«Lass uns die geänderte gitignore commiten»
### Antwort 15
```bash
git add .gitignore
git commit -m "chore: gitignore data/* statt einzelne einträge"
git push
# → e749b2a
```
---
### Prompt 16
«wie ist der aktuelle stand und lass uns die neuen änderungen comitten und pushen»
### Antwort 16
Download: 67% (64/94 GB), ~28 min.
```bash
git add .github/copilot-instructions.md
git commit -m "chore: copilot-instructions auf aktuelle version aktualisiert"
git push
# → df8518d
```
---
## Ergebnis
- Martin Tile Server vollständig konfiguriert (docker-compose, martin.yaml)
- Port 9982, kein nginx-Sidecar (NPM extern)
- Download-Scripts vorhanden (download-data.sh, download-satellite.py)
- Planet-MBTiles Download von OpenFreeMap läuft (~67% bei Session-Ende)
- Alle Commits auf Forgejo gepusht
## Entscheidungen
| Entscheidung | Begründung |
|---|---|
| Martin statt TileServer-GL | Rust, niedrig RAM, built-in CORS, hot-reload |
| kein nginx-Sidecar | NPM (Nginx Proxy Manager) bereits vorhanden |
| OpenFreeMap statt Planetiler | Kein Java/Processing nötig, fertig downloadbar |
| Port 9982 | Freier Port, kein Konflikt |
## Offene Punkte
- [ ] Download abwarten (fertig in ~30 Min nach Session-Start)
- [ ] `docker compose up -d` starten
- [ ] `curl http://localhost:9982/catalog` testen
- [ ] Satellit-Download (download-satellite.py) noch nicht gestartet
- [ ] NPM-Konfiguration (Cache-Header) manuell setzen
- [ ] Hook auf andere Repos verteilen (install-hooks.sh fehlt noch)
---
### Prompt (Copilot-Setup Agent)
Agent hat rd13_tile_server nach `git copilot-update` analysiert und fehlende Dateien nachgezogen.
### Antwort (Copilot-Setup Agent)
Fehlende Dateien im Repo angelegt:
- `docs/USER.md`, `docs/ADMIN.md`, `docs/MAINTAINER.md` (Templates aus rd13_copilot_setup)
- `.copilot-no-tests` (kein Test-Framework, Docker/Config-Repo)
`copilot-update.sh`/`.fish` um Schritt 4c erweitert → fehlende 3-Zielgruppen-Docs
werden künftig automatisch angelegt wenn `docs/` vorhanden ist.