Introduce the app/services/vision/ module with ABC interfaces, ONNX Runtime backend, model registry, and per-task implementations: - OpenCLIP ViT-B/32 embedder (image + text, 512-d) - RapidOCR engine (PP-OCRv4 via ONNX, no PaddlePaddle) - YOLOv8n object detector (raw ONNX, no ultralytics runtime) - YuNet + SFace face processor (Apache 2.0, opencv_zoo, 128-d) - DBSCAN face clustering helper Add VisionSettings to config (mulita.yml + Pydantic), bootstrap_models.py for first-boot weight downloads, models_data Docker volume, and ROCm backend stub for future GPU acceleration. No Celery tasks wired yet — models load but nothing invokes them. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
135 lines
4.1 KiB
YAML
135 lines
4.1 KiB
YAML
services:
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
container_name: mulita-frontend
|
|
ports:
|
|
# Host port is configurable via FRONTEND_PORT in .env so multiple
|
|
# instances / other services on the same host don't collide.
|
|
- "${FRONTEND_PORT:-3000}:80"
|
|
depends_on:
|
|
- backend
|
|
networks:
|
|
- mulita-network
|
|
restart: unless-stopped
|
|
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
container_name: mulita-backend
|
|
ports:
|
|
# Direct backend access on the host is rarely needed (the frontend
|
|
# talks to it through the nginx /api proxy on the same network),
|
|
# but it's exposed for debugging / curl. Override with BACKEND_PORT.
|
|
- "${BACKEND_PORT:-8001}:8000"
|
|
volumes:
|
|
- ./mulita.yml:/app/config/mulita.yml:ro
|
|
# The single host → container mount for your photo library. Set
|
|
# PHOTO_DIRS in .env to your library root. Mounted :rw because file
|
|
# operations (rename, move, empty discard pile) need to mutate the
|
|
# filesystem; flip to :ro for a strict read-only library and the
|
|
# write endpoints will return EROFS.
|
|
- ${PHOTO_DIRS:-./photos}:/photos:rw
|
|
- thumbs_data:/data/thumbs
|
|
- proxies_data:/data/proxies
|
|
- db_data:/data/db # retained so the docker-compose.sqlite.yml override has somewhere to put mulita.db
|
|
# Run Alembic migrations before starting uvicorn. On a fresh Postgres
|
|
# the empty 0001 baseline is a no-op stamp; create_all in init_db then
|
|
# builds the schema.
|
|
command: sh -c "alembic upgrade head && uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload"
|
|
environment:
|
|
- DATABASE_URL=postgresql+asyncpg://mulita:mulita@db:5432/mulita
|
|
- REDIS_URL=redis://redis:6379
|
|
- CELERY_BROKER_URL=redis://redis:6379
|
|
- CELERY_RESULT_BACKEND=redis://redis:6379
|
|
- PHOTO_DIRS=${PHOTO_DIRS:-/photos}
|
|
- ALLOWED_ORIGINS=${ALLOWED_ORIGINS:-*}
|
|
- LOG_LEVEL=${LOG_LEVEL:-INFO}
|
|
- TZ=${TZ:-UTC}
|
|
depends_on:
|
|
redis:
|
|
condition: service_started
|
|
db:
|
|
condition: service_healthy
|
|
networks:
|
|
- mulita-network
|
|
restart: unless-stopped
|
|
|
|
worker:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
container_name: mulita-worker
|
|
command: celery -A app.tasks.celery worker --loglevel=${LOG_LEVEL:-info} --concurrency=${CELERYD_CONCURRENCY:-4}
|
|
volumes:
|
|
- ./mulita.yml:/app/config/mulita.yml:ro
|
|
- ${PHOTO_DIRS:-./photos}:/photos:rw
|
|
- thumbs_data:/data/thumbs
|
|
- proxies_data:/data/proxies
|
|
- db_data:/data/db
|
|
- models_data:/data/models
|
|
environment:
|
|
- DATABASE_URL=postgresql+asyncpg://mulita:mulita@db:5432/mulita
|
|
- REDIS_URL=redis://redis:6379
|
|
- CELERY_BROKER_URL=redis://redis:6379
|
|
- CELERY_RESULT_BACKEND=redis://redis:6379
|
|
- PHOTO_DIRS=${PHOTO_DIRS:-/photos}
|
|
- CELERYD_CONCURRENCY=${CELERYD_CONCURRENCY:-4}
|
|
- LOG_LEVEL=${LOG_LEVEL:-INFO}
|
|
- TZ=${TZ:-UTC}
|
|
depends_on:
|
|
redis:
|
|
condition: service_started
|
|
backend:
|
|
condition: service_started
|
|
db:
|
|
condition: service_healthy
|
|
networks:
|
|
- mulita-network
|
|
restart: unless-stopped
|
|
|
|
db:
|
|
image: pgvector/pgvector:pg16
|
|
container_name: mulita-db
|
|
environment:
|
|
POSTGRES_USER: mulita
|
|
POSTGRES_PASSWORD: mulita
|
|
POSTGRES_DB: mulita
|
|
volumes:
|
|
- pg_data:/var/lib/postgresql/data
|
|
networks:
|
|
- mulita-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U mulita -d mulita"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: mulita-redis
|
|
# Host port exposed only for local debugging; the backend / worker
|
|
# reach Redis via the internal mulita-network on its container name.
|
|
ports:
|
|
- "${REDIS_PORT:-6379}:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
networks:
|
|
- mulita-network
|
|
restart: unless-stopped
|
|
command: redis-server --appendonly yes
|
|
|
|
networks:
|
|
mulita-network:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
thumbs_data:
|
|
proxies_data:
|
|
db_data:
|
|
redis_data:
|
|
pg_data:
|
|
models_data: |