Files
Frank Schwenk 86989c1a4c chore: deduplicate compose environment blocks
Use YAML anchor x-app-env for the shared worker/web environment vars.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-18 17:11:28 +02:00

76 lines
2.4 KiB
YAML

# live.f12.rocks — event photo pipeline: Syncthing drop -> gmic/rembg -> web.
#
# worker + web share one host directory (Syncthing share root):
# ${DATA_HOST_DIR:-/home/frank/sync.schwenk.online/data/livef12} -> /data
# worker watches /data/incoming, writes /data/variants + /data/intermediates
# web reads meta/ + image dirs, writes remix variants
#
# Syncthing itself runs on the host (not in this compose). Copy .env.example
# to .env for local overrides (e.g. DATA_HOST_DIR=./data). Never commit .env.
x-app-env: &app-env
DATA_DIR: /data
OUTPUT_COUNT: ${OUTPUT_COUNT:-3}
BLEND_OPACITY: ${BLEND_OPACITY:-30%}
BLEND_OPACITY_MIN: ${BLEND_OPACITY_MIN:-10}
BLEND_OPACITY_MAX: ${BLEND_OPACITY_MAX:-50}
FILTER_TIMEOUT: ${FILTER_TIMEOUT:-120}
FILTER_TIMEOUT_LONG: ${FILTER_TIMEOUT_LONG:-300}
MAX_FILTER_ATTEMPTS: ${MAX_FILTER_ATTEMPTS:-8}
MAX_EDGE_PX: ${MAX_EDGE_PX:-2000}
REMBG_MODEL: ${REMBG_MODEL:-u2net}
REMBG_ALPHA: ${REMBG_ALPHA:-1}
NICE_LEVEL: ${NICE_LEVEL:-18}
services:
worker:
build: .
restart: unless-stopped
# Same UID as Syncthing (PUID=1002) so shared /data stays writable.
user: "1002:1002"
command: ["python3", "-m", "app.worker"]
environment:
<<: *app-env
volumes:
- ${DATA_HOST_DIR:-/home/frank/sync.schwenk.online/data/livef12}:/data
- ./assets:/data/assets:ro
- rembg_cache:/app/.home
# Sequential-only by design (no threads/async in worker.py); these
# limits just make sure gmic/rembg can't starve the host too.
# Keep headroom on the ~8GB host — birefnet-general needs more than we have.
cpus: "1.0"
mem_limit: 4g
networks:
- internal
web:
build: .
restart: unless-stopped
user: "1002:1002"
command: ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
depends_on:
- worker
environment:
<<: *app-env
SITE_TITLE: live.f12.rocks
volumes:
- ${DATA_HOST_DIR:-/home/frank/sync.schwenk.online/data/livef12}:/data
- ./assets:/data/assets:ro
labels:
- "traefik.enable=true"
- "traefik.http.routers.livef12rocks.rule=Host(`live.f12.rocks`)"
- "traefik.http.routers.livef12rocks.entrypoints=websecure"
- "traefik.http.routers.livef12rocks.tls.certresolver=myresolver"
- "traefik.http.services.livef12rocks.loadbalancer.server.port=8000"
networks:
- internal
- traefik
networks:
internal: {}
traefik:
external: true
volumes:
rembg_cache: