Files
glenloch-media/docker-compose.yml
T
bhursey 0cb315ea88
CI / build (push) Has been cancelled
feat(editor): bridge the advanced photo editor into the event workflow
Event photos can now be opened in Lumenroom, a WebGL2 develop module, from the
photo editor's Advanced button. The dashboard signs a short-lived token scoped
to one user and event; Lumenroom exchanges it, imports the event's photo list
and proxies bytes on demand, so nothing is copied and the temporary catalog
expires with the bridge session. Saving in Lumenroom renders the photo and
writes it back as the event's edited JPEG, with the advanced recipe kept in
event_photos.advanced_edit_json.

Lumenroom is vendored under lumenroom/ and built as a second compose service,
so one clone and `docker compose up -d --build` deploys both apps.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-21 01:34:20 +00:00

164 lines
7.1 KiB
YAML

# Media Team Hub — portable stack (app + Postgres).
#
# docker compose up --build app db # run the app
# docker compose --profile tools run --rm migrate # run migrations + seed
#
# The app is standard HTTP on :3000 — put it behind your reverse proxy.
# Host ports are chosen to avoid everything already running on this host
# (see the port audit): app=3000, postgres published on 5433 (local 5432 is taken).
services:
app:
build:
context: .
dockerfile: Dockerfile
environment:
NODE_ENV: production
# Built from the POSTGRES_* values in .env. Use a URL-safe password
# (hex is simplest); reserved URL characters must be percent-encoded.
DATABASE_URL: postgres://${POSTGRES_USER:-media}:${POSTGRES_PASSWORD:-media}@db:5432/${POSTGRES_DB:-media}
# Fallback base URL only. Generated links (magic link, invite, publish
# emails) use the origin of the request that created them, so access via
# http://<lan-ip>:3000 and https://<public-domain> both produce working
# links. Keep NEXTAUTH_URL on http unless everything is served over TLS:
# an https value makes Auth.js mark the session cookie Secure, and a
# Secure cookie is rejected by browsers on plain-http LAN access.
NEXTAUTH_URL: ${NEXTAUTH_URL:-http://localhost:3000}
NEXTAUTH_SECRET: ${NEXTAUTH_SECRET:-dev-only-secret-change-me}
POSTMARK_FROM: ${POSTMARK_FROM:-media@localhost}
POSTMARK_SERVER_TOKEN: ${POSTMARK_SERVER_TOKEN:-}
ARCHIVE_FOLDER: ${ARCHIVE_FOLDER:-Glenloch Media}
APP_ORIGIN: ${APP_ORIGIN:-http://localhost:3000}
# Canonical origin for emailed links. Set this to the public URL when the
# app is reachable from outside the LAN; empty means "use the request
# origin" (convenient locally, but a client-controlled Host header).
PUBLIC_ORIGIN: ${PUBLIC_ORIGIN:-}
CHURCH_TIMEZONE: America/New_York
# Shared secret for the HTTP cron routes (Authorization: Bearer …).
CRON_SECRET: ${CRON_SECRET:-}
# New emails become pending_approval unless explicitly auto-activated.
AUTO_ACTIVATE_NEW_USERS: ${AUTO_ACTIVATE_NEW_USERS:-false}
# This local stack has no mail provider by default; the console transport
# prints the sign-in link. Set false once real mail is configured.
MAGIC_LINK_DEV_TRANSPORT: ${MAGIC_LINK_DEV_TRANSPORT:-true}
# Destructive E2E/test reset endpoint. Keep false in real deployments.
ALLOW_DEV_RESET: ${ALLOW_DEV_RESET:-false}
# Dev deployments write messages here; a named volume makes them
# inspectable (`docker compose exec app ls /tmp/outbox`).
OUTBOX_DIR: /tmp/outbox
# Training attachments only. Metadata is in Postgres; bytes live here.
# Original event photos and videos require the media storage share below
# and are blocked
# (with an in-app warning) until it is configured and writable.
UPLOAD_DIR: /tmp/uploads
# Primary storage inside the container for original event photos and videos.
# For NFS, either let Docker mount the export itself:
# docker compose -f docker-compose.yml -f docker-compose.nfs.yml up -d
# or mount the export on the Docker host, set MEDIA_ARCHIVE_DIR to that
# host path, and restart:
# MEDIA_ARCHIVE_DIR=/mnt/nfs/glenloch docker compose up -d
# Then set the share name and folder in Settings → Media storage. The
# default named volume exists only so the stack boots; it is not accepted
# as media storage once the app checks the configured share.
ARCHIVE_DIR: /archive
NFS_SHARE: ${NFS_SHARE:-}
# Advanced-editor bridge. Both must be set for "Advanced" in the photo
# editor to work; the secret must match Lumenroom's BRIDGE_SECRET.
BRIDGE_SECRET: ${BRIDGE_SECRET:-}
# Browser-facing URL of the vendored Lumenroom service below. On a LAN
# that is http://<lan-ip>:8787; behind TLS use https://edit.example.org.
LUMENROOM_URL: ${LUMENROOM_URL:-http://localhost:8787}
volumes:
- outbox-data:/tmp/outbox
- uploads-data:/tmp/uploads
- ${MEDIA_ARCHIVE_DIR:-archive-data}:/archive
ports:
# Default keeps LAN access working. A proxied host should set
# APP_BIND=127.0.0.1 so only Caddy/Nginx can reach the app.
- "${APP_BIND:-0.0.0.0}:${APP_PORT:-3000}:3000"
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:3000/api/health >/dev/null 2>&1 || exit 1"]
interval: 30s
timeout: 5s
retries: 3
start_period: 30s
logging:
options:
max-size: "10m"
max-file: "3"
restart: unless-stopped
# Advanced photo editor (Lumenroom), vendored under ./lumenroom so one clone
# and one `docker compose up -d --build` deploys both apps. Its catalog is
# temporary bridge data; originals stay on the app's media storage.
lumenroom:
build:
context: ./lumenroom
dockerfile: Dockerfile
environment:
NODE_ENV: production
# Internal address: only Lumenroom's server calls the dashboard.
GLENLOCH_URL: ${GLENLOCH_URL:-http://app:3000}
# Must match the app's BRIDGE_SECRET, or "Advanced" fails to sign in.
BRIDGE_SECRET: ${BRIDGE_SECRET:-}
LUMENROOM_BRIDGE_TTL_HOURS: ${LUMENROOM_BRIDGE_TTL_HOURS:-12}
LUMENROOM_INVITE: ${LUMENROOM_INVITE:-}
LUMENROOM_RAW_WORKERS: ${LUMENROOM_RAW_WORKERS:-4}
volumes:
# SQLite catalog, cached previews and thumbnails (safe to lose).
- lumenroom-data:/data
ports:
# The browser must reach this directly. Put it behind the same reverse
# proxy and bind it to loopback there, e.g. LUMENROOM_BIND=127.0.0.1.
- "${LUMENROOM_BIND:-0.0.0.0}:${LUMENROOM_PORT:-8787}:8787"
logging:
options:
max-size: "10m"
max-file: "3"
restart: unless-stopped
db:
image: postgres:16-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER:-media}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-media}
POSTGRES_DB: ${POSTGRES_DB:-media}
# Host 5433 -> container 5432 (local postgres already holds 5432).
# Override POSTGRES_PORT if 5433 is taken by another stack.
ports:
# Loopback by default: the app reaches Postgres over the Compose network.
- "${POSTGRES_BIND:-127.0.0.1}:${POSTGRES_PORT:-5433}:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-media} -d ${POSTGRES_DB:-media}"]
interval: 5s
timeout: 5s
retries: 10
restart: unless-stopped
# One-shot migrations + seed. Run on demand:
# docker compose --profile tools run --rm migrate
migrate:
build:
context: .
dockerfile: Dockerfile
target: tools
command: ["sh", "-c", "pnpm db:migrate && pnpm db:seed"]
environment:
DATABASE_URL: postgres://${POSTGRES_USER:-media}:${POSTGRES_PASSWORD:-media}@db:5432/${POSTGRES_DB:-media}
depends_on:
db:
condition: service_healthy
profiles: ["tools"]
volumes:
pgdata:
outbox-data:
uploads-data:
archive-data:
lumenroom-data: