App 2.39.1, server 2.8.0: map roads from OpenFreeMap, on demand

The public Overpass answered 429/502 and needs ~40 s a tile while the
car gives up after 8 s, so the server cancelled its queries and the
car's retries added load. Now the server fetches only the tiles a car
asks for, as OpenStreetMap vector tiles from OpenFreeMap (MAP_TILES_URL),
decodes the transportation layer with a small reader of its own, and
keeps each tile 30 days on a volume (MAP_CACHE_DIR). A fetch finishes
even after the car has stopped waiting; the car hears 503 with
Retry-After and gets the tile on its next try.

App: OpenFreeMap/OpenMapTiles attribution on the map, retry after 15 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LhzAVaUyqcw5PkGjz4mWW6
This commit is contained in:
2026-10-26 23:54:30 +01:00
co-authored by Claude Opus 5.5
parent d9c7c5ea9a
commit 6be2ba5193
17 changed files with 891 additions and 332 deletions
+31 -4
View File
@@ -1,5 +1,21 @@
# The car server (Go). One replica on purpose: pending pairing requests and the wrong-password
# counters are kept in memory.
# The roads of the app's Grid map, fetched on demand, are kept on this small volume.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mg4-server-maps
namespace: mg4
labels:
app.kubernetes.io/name: mg4-server
app.kubernetes.io/part-of: mg4
spec:
accessModes: ["ReadWriteOnce"]
# No storageClassName: the cluster's default class is used.
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
@@ -25,11 +41,12 @@ spec:
runAsNonRoot: true
runAsUser: 65532
runAsGroup: 65532
fsGroup: 65532
seccompProfile:
type: RuntimeDefault
containers:
- name: server
# 2.6.2, pinned by digest so a re-pushed tag cannot change what runs.
# Pinned by digest so a re-pushed tag cannot change what runs (version in SPECS.md).
image: git.stinnesbeck.com/nils/mg4-server@sha256:e5da9452a9dbdfabe3340766cc51f18bb1418b2588ab534714550470abe1ce29
ports:
- name: http
@@ -50,9 +67,12 @@ spec:
value: https://git.stinnesbeck.com
- name: FORGE_REPO
value: nils/mg4
# The roads for the app's Grid map, from OpenStreetMap; "off" switches maps off.
- name: OVERPASS_URL
value: https://overpass-api.de/api/interpreter
# The roads for the app's Grid map: OpenStreetMap vector tiles, fetched only for the
# tiles a car asks for and kept on the volume below; "off" switches maps off.
- name: MAP_TILES_URL
value: https://tiles.openfreemap.org/planet
- name: MAP_CACHE_DIR
value: /var/cache/mg4-maps
- name: INFLUX_TOKEN
valueFrom:
secretKeyRef:
@@ -84,6 +104,13 @@ spec:
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]
volumeMounts:
- name: maps
mountPath: /var/cache/mg4-maps
volumes:
- name: maps
persistentVolumeClaim:
claimName: mg4-server-maps
---
apiVersion: v1
kind: Service