Files
livef12rocks/compose.yml
T
Frank Schwenk 9a9a3e3afe fix: run web/worker as uid 1002 to match Syncthing
Shared /data dirs created as root blocked Syncthing pulls into incoming/.

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

84 lines
2.9 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/jobs
# web reads jobs, 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.
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:
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}
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:
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}
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: