Files
octoturge 1a0ccd8b17 Add GPU-accelerated rendering: cpu/gpu/hybrid RenderBackend (Phase 8)
Splits RenderBackend's per-voxel face-visibility extraction and tile
shading out as GPU-offloadable steps (wgpu compute shaders), while
keeping greedy-mesh merge/compaction CPU-only per the plan's "partial
GPU rendering" design. RENDER_BACKEND=cpu|gpu|hybrid selects the
strategy, falling back to cpu automatically (logged) if no compatible
GPU adapter is found. Verified against a real GPU: all tests pass,
including ones asserting byte-identical output between the cpu and
gpu backends; a new benchmark example honestly shows cpu currently
outperforming gpu/hybrid at realistic batch sizes since each call is
its own dispatch/readback round trip rather than batched across a
whole render batch (documented as a follow-up optimization).

Also fixes two real, pre-existing gaps found while validating the
worker's actual `docker build`: a missing .dockerignore was sending
the local multi-GB target/ dir into the build context, and the
Dockerfile's rust:1.80 pin was already too old for current
transitive dependency MSRVs (bumped to rust:1.97).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015tKdPZt78zbPUZMXWzKEKt
2026-08-09 21:39:32 +02:00

92 lines
2.6 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.
#
# RENDER_BACKEND=gpu/hybrid (worker/.env.example, Phase 8) needs the container to actually
# see a GPU — the nvidia-container-toolkit must be installed on the host, then uncomment:
# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: 1
# capabilities: [gpu]
# Default RENDER_BACKEND=cpu needs none of this — GPU rendering is opt-in, not required.
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: