117 lines
4.3 KiB
YAML
117 lines
4.3 KiB
YAML
services:
|
|
# Minimal privileged init container: sets the GPU power limit then exits.
|
|
# Runs before stemengine so the main container never needs SYS_ADMIN.
|
|
stemengine-gpu-init:
|
|
container_name: stemengine-gpu-init
|
|
image: nvidia/cuda:12.1.0-base-ubuntu22.04
|
|
runtime: nvidia
|
|
restart: "no"
|
|
cap_add:
|
|
- SYS_ADMIN
|
|
entrypoint:
|
|
- sh
|
|
- -c
|
|
- |
|
|
PL="${STEMENGINE_GPU_POWER_LIMIT:-50}"
|
|
if [ "$$PL" != "0" ]; then
|
|
echo "[gpu-init] Setting power limit to $${PL} W..."
|
|
nvidia-smi --power-limit="$$PL" && echo "[gpu-init] Done." || echo "[gpu-init] Failed."
|
|
fi
|
|
environment:
|
|
- STEMENGINE_GPU_POWER_LIMIT=${STEMENGINE_GPU_POWER_LIMIT:-100}
|
|
deploy:
|
|
resources:
|
|
reservations:
|
|
devices:
|
|
- driver: nvidia
|
|
count: all
|
|
capabilities: [gpu]
|
|
|
|
stemengine:
|
|
container_name: stemengine
|
|
image: ghcr.io/seclusionenthusiast/stemengine:latest
|
|
runtime: nvidia
|
|
entrypoint: []
|
|
restart: unless-stopped
|
|
depends_on:
|
|
stemengine-gpu-init:
|
|
condition: service_completed_successfully
|
|
networks:
|
|
- t2_proxy
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
ports:
|
|
- "8000:8000"
|
|
volumes:
|
|
# Source code (live mount — changes reflect immediately via uvicorn --reload)
|
|
- ${SEFOLDER}/backend:/app/backend
|
|
- ${SEFOLDER}/lyrics-sync:/app/lyrics-sync
|
|
# Persistent storage for uploaded files and job outputs
|
|
- ${SEFOLDER}/jobs:/app/media/jobs
|
|
- ${SEFOLDER}/uploads:/app/media/uploads
|
|
- ${SEFOLDER}/imports:/app/media/imports
|
|
- ${SEFOLDER}/db:/app/media/db
|
|
# LRC sync data
|
|
- ${SEFOLDER}/lrc_sync:/app/media/lrc_sync
|
|
# Model caches (avoid re-downloading after container restart)
|
|
- ${SEFOLDER}/stemengine-models:/root/.cache
|
|
- ${SEFOLDER}/opt:/opt
|
|
# Frontend source — live mount so vite --watch picks up edits without a rebuild.
|
|
- ${SEFOLDER}/frontend:/app/frontend
|
|
# node_modules overlay: preserves the image-seeded packages; overlays the dir mount above.
|
|
- stemengine-node-modules:/app/frontend/node_modules
|
|
# Projects folder (where separated stems are stored)
|
|
- ${PROJECTS}:/app/media/projects
|
|
- ${SEFOLDER}/start.sh:/app/start.sh:ro
|
|
command: /app/start.sh
|
|
environment:
|
|
- PUID=${PUID:-1000}
|
|
- PGID=${PGID:-1000}
|
|
- TZ=${TZ:-UTC}
|
|
# Root media directory — all path defaults derive from this.
|
|
- MEDIA_DIR=/app/media
|
|
# Storage layout (defaults shown — uncomment and change to override)
|
|
- UPLOAD_DIR=/app/media/uploads
|
|
- JOBS_DIR=/app/media/jobs
|
|
- PROJECTS_DIR=/app/media/projects
|
|
- DB_PATH=/app/media/db/stemengine.db
|
|
- LRC_SYNC_DIR=/app/media/lrc_sync
|
|
- BS_ROFORMER_MODEL_DIR=/opt/bs_roformer_models
|
|
- MEL_BAND_MODEL_DIR=/opt/mel_band_models
|
|
- MDXNET_MODEL_DIR=/opt/mdxnet_models
|
|
- SCNET_MODEL_DIR=/opt/scnet_models
|
|
- MEDLEYVOX_MODEL_DIR=/opt/medleyvox_models
|
|
- APOLLO_MODEL_DIR=/opt/apollo_models
|
|
- ASPIRATION_MODEL_DIR=/opt/aspiration_models
|
|
- BANDIT_MODEL_DIR=/opt/bandit_models
|
|
# - SEPACAP_MODEL_DIR=/opt/sepacap_models
|
|
# - SEPREFORMER_MODEL_DIR=/opt/sepreformer_models
|
|
- CPU_SEPARATION=${CPU_SEPARATION:-false}
|
|
- STEMENGINE_GPU_POWER_LIMIT=${STEMENGINE_GPU_POWER_LIMIT:-100}
|
|
- MAX_UPLOAD_MB=${MAX_UPLOAD_MB:-500}
|
|
- PYTHONUNBUFFERED=1
|
|
# Prevent CUDA OOM from allocator fragmentation when multiple large models
|
|
# (Demucs, BS-RoFormer, Whisper) are loaded in the same process.
|
|
- PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
|
|
# Secret key for encrypting credentials at rest (required for Settings UI storage)
|
|
# Generate with: python3 -c "import secrets; print(secrets.token_hex(32))"
|
|
- SECRET_KEY=${SECRET_KEY}
|
|
# Subsonic server (optional — can also be set via the Settings UI)
|
|
- SUBSONIC_URL=${NAVSERVER}
|
|
- SUBSONIC_USERNAME=${NAVUSER}
|
|
- SUBSONIC_PASSWORD=${NAVPASS}
|
|
- HF_TOKEN=${HF_TOKEN}
|
|
deploy:
|
|
resources:
|
|
reservations:
|
|
devices:
|
|
- driver: nvidia
|
|
count: all
|
|
capabilities: [gpu]
|
|
volumes:
|
|
# Persists node_modules across container restarts; seeded from image on first start.
|
|
stemengine-node-modules:
|
|
networks:
|
|
t2_proxy:
|
|
external: true
|