mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 02:48:38 -04:00
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
169 lines
5.7 KiB
YAML
169 lines
5.7 KiB
YAML
# Development containers, these should only be used if you are developing.
|
|
# The database is SQLite inside the media directory (./test/config/wrolpi.db); no db service.
|
|
version: '3'
|
|
services:
|
|
controller: # WROLPi Controller Service
|
|
build:
|
|
context: .
|
|
dockerfile: docker/controller/Dockerfile
|
|
restart: unless-stopped
|
|
ports:
|
|
- "8080:80"
|
|
volumes:
|
|
# Controller code (for development hot-reload)
|
|
- ./controller:/app/controller
|
|
# Docker socket for container management
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
# Host system info (read-only)
|
|
- /proc:/host/proc:ro
|
|
- /sys:/host/sys:ro
|
|
# Media directory (needed for Samba share path validation)
|
|
- ${MEDIA_DIRECTORY:-./test}:/media/wrolpi
|
|
environment:
|
|
- DOCKERIZED=true
|
|
- MEDIA_DIRECTORY=/media/wrolpi
|
|
# Override CMD to enable auto-reload for development
|
|
command: ["python", "-m", "controller.serve"]
|
|
healthcheck:
|
|
test: [ 'CMD-SHELL', 'curl -f http://127.0.0.1:80/api/health || exit 1' ]
|
|
interval: 30s
|
|
timeout: 5s
|
|
start_period: 10s
|
|
retries: 3
|
|
|
|
api:
|
|
depends_on:
|
|
controller:
|
|
condition: service_started
|
|
build:
|
|
context: .
|
|
dockerfile: docker/api/Dockerfile
|
|
environment:
|
|
# Sanic 25.x wants 'spawn' but our code uses 'fork' for multiprocessing.
|
|
# This tells Sanic to accept the existing start method.
|
|
- SANIC_START_METHOD_SET=1
|
|
volumes:
|
|
- './main.py:/opt/wrolpi/main.py'
|
|
- './wrolpi:/opt/wrolpi/wrolpi'
|
|
- './modules:/opt/wrolpi/modules'
|
|
- './scripts:/opt/wrolpi/scripts'
|
|
- './test:/opt/wrolpi/test'
|
|
- './test:/media/wrolpi'
|
|
- './alembic:/opt/wrolpi/alembic'
|
|
- './alembic.ini:/opt/wrolpi/alembic.ini'
|
|
ports:
|
|
- ${REACT_APP_API-0.0.0.0:8081}:8081
|
|
user: '${UID-1000}:${GID-1000}'
|
|
healthcheck:
|
|
test: [ 'CMD-SHELL', 'curl http://127.0.0.1:8081/api/echo' ]
|
|
interval: 2m
|
|
|
|
archive: # Python/Sanic wrapper around Singlefile and Readability.
|
|
build:
|
|
context: .
|
|
dockerfile: docker/archive/Dockerfile
|
|
volumes:
|
|
- './docker/archive/main.py:/app/main.py'
|
|
ports:
|
|
- '8083:8080'
|
|
healthcheck:
|
|
test: [ 'CMD-SHELL', 'curl http://127.0.0.1:8080/' ]
|
|
interval: 2m
|
|
|
|
app: # React App
|
|
depends_on:
|
|
- api
|
|
build:
|
|
context: .
|
|
dockerfile: docker/app/Dockerfile
|
|
volumes:
|
|
- './app/public:/app/public'
|
|
- './app/src:/app/src'
|
|
- './app/package.json:/app/package.json'
|
|
- '.env:/app/.env'
|
|
command: 'npm run start'
|
|
stdin_open: true
|
|
healthcheck:
|
|
test: [ 'CMD-SHELL', 'curl http://127.0.0.1:3000' ]
|
|
interval: 1m
|
|
user: '${UID-1000}:${GID-1000}'
|
|
environment:
|
|
# Force React to use Caddy port to connect to it's websocket.
|
|
- WDS_SOCKET_PORT=0
|
|
# react-scripts lints in-process on every incremental rebuild, which costs time on each
|
|
# save and buries the compile result under a few hundred warnings the repo has carried
|
|
# for years. This container only serves; linting still happens where it is acted on --
|
|
# `npm run build` and CI both run it, and both fail on a real error.
|
|
#
|
|
# NOT a memory fix, though it was tried as one after the dev server was OOM-killed three
|
|
# times in an afternoon. Measured either way, the container settles anywhere between
|
|
# 3.0GB and 3.7GB and the spread between two runs of the SAME configuration is wider
|
|
# than the spread between configurations. Raising Docker Desktop's VM limit is what
|
|
# actually stopped the kills.
|
|
- DISABLE_ESLINT_PLUGIN=true
|
|
|
|
web: # Caddy reverse proxy - handles HTTPS for all services.
|
|
depends_on:
|
|
- app
|
|
- zim
|
|
- help
|
|
build:
|
|
context: .
|
|
dockerfile: docker/web/Dockerfile
|
|
ports:
|
|
- ${WEB_HOST-0.0.0.0}:${WEB_HTTPS_PORT-8443}:443
|
|
- '8084:8084'
|
|
- '8085:8085'
|
|
- '8086:8086'
|
|
volumes:
|
|
- './docker/web/Caddyfile:/etc/caddy/Caddyfile'
|
|
- './icon.ico:/etc/caddy/favicon.ico'
|
|
- './icon.png:/etc/caddy/icon.png'
|
|
- './test:/opt/media'
|
|
- './modules/map/static:/opt/wrolpi/modules/map/static:ro'
|
|
# No mount over /opt/wrolpi-blobs. A bind mount REPLACES the image's directory rather
|
|
# than merging with it, and the host './blobs' this used to mount is git-ignored -- so
|
|
# it was empty on every clone and hid the blobs the image provides. The web image bakes
|
|
# map-overview.pmtiles in; see docker/web/Dockerfile.
|
|
environment:
|
|
- MEDIA_DIRECTORY=/opt/media
|
|
# Set EXTRA_SANS to include the host's LAN IP in the TLS certificate.
|
|
# Example: EXTRA_SANS=IP:10.0.0.5
|
|
- EXTRA_SANS=${EXTRA_SANS:-}
|
|
healthcheck:
|
|
test: [ 'CMD-SHELL', 'wget --spider --no-check-certificate https://127.0.0.1:443 || exit 1' ]
|
|
interval: 1m
|
|
|
|
zim: # kiwix-serve
|
|
build:
|
|
context: .
|
|
dockerfile: docker/zim/Dockerfile
|
|
volumes:
|
|
- './test:/media/wrolpi'
|
|
- './docker/zim/entrypoint.sh:/entrypoint.sh'
|
|
healthcheck:
|
|
test: [ 'CMD-SHELL', 'curl http://127.0.0.1:80' ]
|
|
interval: 1m
|
|
|
|
samba: # Samba file sharing - started/stopped by the controller based on configured shares.
|
|
build:
|
|
context: .
|
|
dockerfile: docker/samba/Dockerfile
|
|
restart: "no"
|
|
depends_on:
|
|
controller:
|
|
condition: service_healthy
|
|
ports:
|
|
- "445:445"
|
|
volumes:
|
|
- ${MEDIA_DIRECTORY:-./test}:/media/wrolpi
|
|
|
|
help: # The WROLPi Help documentation.
|
|
build:
|
|
context: .
|
|
dockerfile: docker/help/Dockerfile
|
|
volumes:
|
|
- './docker/help/wrolpi-help:/opt/wrolpi-help'
|
|
healthcheck:
|
|
test: [ 'CMD-SHELL', 'curl http://127.0.0.1:8086' ]
|
|
interval: 1m
|