feat(A4): add MinIO service + storage abstraction (core/storage.py)
- Add MinIO service to docker-compose.yml (port 9000 API, 9001 console) - Add minio-data volume for persistent object storage - Create backend/app/core/storage.py: MinIOStorage + LocalStorage abstraction - MinIOStorage: boto3-based, auto-creates bucket, upload/download/exists/delete/presign - LocalStorage: fallback for dev (UPLOAD_DIR filesystem, backward compat) - get_storage() singleton: auto-selects based on MINIO_URL env var - Add MINIO_URL/USER/PASSWORD/BUCKET env vars to all service definitions - backend/pyproject.toml: docker>=6.1.0 → boto3>=1.34.0 - Add docker-compose.worker.yml: external render-worker for remote machines - Fix .gitignore: 'core' rule was too broad, now only matches root /core dump - Update .env.example: MinIO connection vars documented Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
# External render-worker configuration.
|
||||
#
|
||||
# Use this compose file on remote machines (GPU nodes, NAS, cloud VMs) that
|
||||
# only need Redis + MinIO access — no database, no backend, no frontend.
|
||||
#
|
||||
# Usage on remote machine:
|
||||
# export REDIS_URL=redis://main-server:6379/0
|
||||
# export MINIO_URL=http://main-server:9000
|
||||
# export MINIO_USER=minioadmin
|
||||
# export MINIO_PASSWORD=minioadmin
|
||||
# docker compose -f docker-compose.worker.yml up -d
|
||||
#
|
||||
# Requirements on remote machine:
|
||||
# - Blender >= 5.0.1 installed at /opt/blender (or set BLENDER_BIN)
|
||||
# - Docker + GPU drivers (NVIDIA recommended)
|
||||
|
||||
services:
|
||||
render-worker:
|
||||
image: schaefflerautomat-render-worker:latest
|
||||
# Or build locally: build: { context: ./render-worker, dockerfile: Dockerfile }
|
||||
environment:
|
||||
- REDIS_URL=${REDIS_URL:?Set REDIS_URL to the main server Redis URL}
|
||||
- POSTGRES_HOST=${POSTGRES_HOST:?Set POSTGRES_HOST to the main server DB host}
|
||||
- POSTGRES_DB=${POSTGRES_DB:-schaeffler}
|
||||
- POSTGRES_USER=${POSTGRES_USER:-schaeffler}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD}
|
||||
- POSTGRES_PORT=${POSTGRES_PORT:-5432}
|
||||
- MINIO_URL=${MINIO_URL:?Set MINIO_URL to the main server MinIO URL}
|
||||
- MINIO_USER=${MINIO_USER:-minioadmin}
|
||||
- MINIO_PASSWORD=${MINIO_PASSWORD:-minioadmin}
|
||||
- MINIO_BUCKET=${MINIO_BUCKET:-uploads}
|
||||
- UPLOAD_DIR=/tmp/render-cache
|
||||
- BLENDER_BIN=${BLENDER_BIN:-/opt/blender/blender}
|
||||
- RENDER_SCRIPTS_DIR=/render-scripts
|
||||
- JWT_SECRET_KEY=${JWT_SECRET_KEY:?Set JWT_SECRET_KEY}
|
||||
volumes:
|
||||
- /opt/blender:/opt/blender:ro
|
||||
- render-cache:/tmp/render-cache
|
||||
deploy:
|
||||
replicas: ${RENDER_WORKER_REPLICAS:-1}
|
||||
resources:
|
||||
reservations:
|
||||
devices:
|
||||
- driver: nvidia
|
||||
count: 1
|
||||
capabilities: [gpu, compute, utility, graphics]
|
||||
|
||||
volumes:
|
||||
render-cache:
|
||||
Reference in New Issue
Block a user