7bed571ffa
api: WS gateway with token auth (Postgres-backed servers table, seeded via `bun run seed`), column-granularity chunk store (hand-written SQL migrations, no drizzle-kit CLI — its config loader needs esbuild, which doesn't install cleanly here), dirty-chunk Redis stream producer with per-flush dedup, and a tile-serving route. worker: consumes the dirty-chunk stream via a proper consumer group, rasterizes each chunk's columns into a single-resolution top-down PNG (static pre-Flattening block-id palette), uploads to MinIO, and upserts the tile pointer. frontend: barebones Leaflet 2D viewer (CRS.Simple, one native zoom level) wired to /api/servers and /api/tiles. Object storage: tiles live in a dedicated `mcmapper-tiles` bucket on the existing shared MinIO instance (devstack-minio on octo-winsrv) instead of a per-stack container, via a scoped access key limited to that one bucket — see README's "Object storage" section. MINIO_SECRET_KEY is real and is deliberately not committed; docker-compose layers an untracked .env over .env.example for it. Full pipeline verified end-to-end against live containers: WS auth -> Postgres upsert -> deduped Redis dirty-chunk event -> worker rasterize -> MinIO upload -> tile fetch through the api route, including from the actual mod-side WS client (see MCMapper-Mod's matching commit).
81 lines
2.1 KiB
YAML
81 lines
2.1 KiB
YAML
services:
|
|
api:
|
|
build: ./api
|
|
# .env.example holds safe defaults (committed); an untracked ./api/.env layered on top
|
|
# supplies real secrets (MINIO_SECRET_KEY) — see api/.env.example.
|
|
env_file:
|
|
- ./api/.env.example
|
|
- path: ./api/.env
|
|
required: false
|
|
depends_on:
|
|
- postgres
|
|
- redis
|
|
expose:
|
|
- "3000"
|
|
restart: unless-stopped
|
|
|
|
frontend:
|
|
build: ./frontend
|
|
env_file: ./frontend/.env.example
|
|
depends_on:
|
|
- api
|
|
expose:
|
|
- "3001"
|
|
restart: unless-stopped
|
|
|
|
worker:
|
|
build: ./worker
|
|
env_file:
|
|
- ./worker/.env.example
|
|
- path: ./worker/.env
|
|
required: false
|
|
depends_on:
|
|
- postgres
|
|
- redis
|
|
restart: unless-stopped
|
|
# Scale render capacity locally with, e.g.: docker compose up --scale worker=3
|
|
# A `worker` can also run standalone on a separate machine, pointed at the same
|
|
# postgres/redis/minio over a private network (VPN/Tailscale/LAN) — see README.
|
|
|
|
postgres:
|
|
image: postgres:17-alpine
|
|
environment:
|
|
POSTGRES_USER: mcmapper
|
|
POSTGRES_PASSWORD: mcmapper
|
|
POSTGRES_DB: mcmapper
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
restart: unless-stopped
|
|
# Intentionally no `ports:` — only reachable on the compose network / a private
|
|
# network for remote workers, never exposed publicly.
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
volumes:
|
|
- redis-data:/data
|
|
restart: unless-stopped
|
|
# Same rule as postgres: no public ports.
|
|
|
|
# No `minio` service here: rendered tiles/meshes are stored in a dedicated bucket
|
|
# (`mcmapper-tiles`) on an existing shared MinIO instance instead of a per-stack container —
|
|
# see api/.env.example and worker/.env.example for the endpoint/credentials, and README.md
|
|
# for how that bucket + scoped access key were provisioned.
|
|
|
|
caddy:
|
|
image: caddy:2-alpine
|
|
volumes:
|
|
- ./Caddyfile:/etc/caddy/Caddyfile
|
|
- caddy-data:/data
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
depends_on:
|
|
- api
|
|
- frontend
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres-data:
|
|
redis-data:
|
|
caddy-data:
|