Files
maptool/docker-compose.yaml
T
randy 24ac5931f8
CI / check (push) Successful in 40s
CI / deploy (push) Successful in 12s
Link POI popups to offline Wikipedia via kiwix-serve
lib/maptool/kiwix.rb: a small reachability check for an external
kiwix-serve instance. GET /api/kiwix reports it (same optional-
integration pattern as offline-tiles/terrain-tiles); the frontend
adds a "Nearby on Wikipedia" link to a point's popup pointing straight
at kiwix-serve's own geo search (GET /search?latitude=&longitude=
&distance=, confirmed from libkiwix's actual source rather than
guessed) — linked to directly, not proxied/embedded, since it already
has a full search UI of its own.

docker-compose.yaml: new `kiwix` service (ghcr.io/kiwix/kiwix-serve)
on the default network, KIWIX_URL wired to reach it by service name.
The ZIM itself isn't part of the repo (large, self-contained archive)
— data/kiwix/ gitignored same as the *.pmtiles files, setup steps in
docs/development.adoc.

No kiwix-serve/ZIM available here to test end-to-end — verified the
app side against a stand-in local HTTP server (GET /api/kiwix flips
available correctly) and confirmed the generated popup link matches
the real geo-search query shape. docker-compose.yaml validated with
`docker-compose config`. Full test suite: 118 runs, 0 failures.
2026-09-09 13:44:37 +02:00

69 lines
3.5 KiB
YAML

services:
maptool:
build: .
image: maptool:latest
restart: unless-stopped
ports:
- "4567:4567"
environment:
# "[::]", not "0.0.0.0": binding the IPv6 wildcard also accepts IPv4
# connections (dual-stack is the Linux default), so this covers both
# without a second listener. Puma's bind URL needs the brackets around
# a literal IPv6 address (config/puma.rb interpolates this as-is).
BIND_HOST: "[::]"
RACK_ENV: production
# Read from .env (docker compose loads it automatically) — not
# committed, see docs/deployment.adoc.
SESSION_SECRET: ${SESSION_SECRET:?SESSION_SECRET is required, see docs/deployment.adoc}
GITEA_OAUTH_CLIENT_ID: ${GITEA_OAUTH_CLIENT_ID:?GITEA_OAUTH_CLIENT_ID is required, see docs/deployment.adoc}
GITEA_OAUTH_CLIENT_SECRET: ${GITEA_OAUTH_CLIENT_SECRET:?GITEA_OAUTH_CLIENT_SECRET is required, see docs/deployment.adoc}
MAPTOOL_ALLOWED_GITEA_USER: ${MAPTOOL_ALLOWED_GITEA_USER:?MAPTOOL_ALLOWED_GITEA_USER is required, see docs/deployment.adoc}
# Optional: blank disables the LiveTrack webhook endpoint rather than
# failing to start, since it's not needed for the app's core function.
LIVETRACK_WEBHOOK_SECRET: ${LIVETRACK_WEBHOOK_SECRET:-}
# The kiwix service below, reached by its compose service name (both
# are on the same default compose network) — port matches its own
# --port=8080 in the command below. Not made conditional on the ZIM
# actually being present: GET /api/kiwix pings it and just reports
# unavailable if the container isn't up/reachable, same story as
# every other optional-local-file feature (offline.pmtiles, etc).
KIWIX_URL: "http://kiwix:8080"
volumes:
# Uploaded GPX files and the offline PMTiles extract — kept outside
# the image so a rebuild/redeploy doesn't wipe them (see
# docs/development.adoc for how the deploy job treats this
# directory).
- ./data:/app/data
# Fakes a GNSS fix (a loop around Bratislava, see
# bin/gnss_simulator.rb/docs/development.adoc) since there's no real
# receiver attached here — the "GNSS" control would otherwise just show
# "no fix" always. Remove this service (and nothing else) whenever a real
# receiver/gpsd setup replaces it. network_mode ties it to maptool's own
# network namespace rather than a bridge network, since GpsdClient
# connects to a hardcoded 127.0.0.1:2947 — same as gpsd itself normally
# being local to the machine it serves.
gnss-simulator:
image: maptool:latest
depends_on:
- maptool
restart: unless-stopped
network_mode: "service:maptool"
command: ["ruby", "bin/gnss_simulator.rb"]
# Serves an offline Wikipedia ZIM for the popup's "Nearby on Wikipedia"
# link (see docs/development.adoc for where to get one and drop it in —
# same "not part of the repo, place it under ./data locally" story as
# offline.pmtiles/terrain.pmtiles). On the default compose network (not
# network_mode: "service:maptool" — unlike gnss-simulator this doesn't
# need a hardcoded localhost port, KIWIX_URL above reaches it by this
# service's own name), so maptool and kiwix stay independent containers.
# Keeps restarting (harmlessly) if data/kiwix/wikipedia.zim isn't there
# yet — GET /api/kiwix just reports unavailable until it comes up.
kiwix:
image: ghcr.io/kiwix/kiwix-serve:latest
restart: unless-stopped
command: ["--port=8080", "/data/wikipedia.zim"]
volumes:
- ./data/kiwix:/data