From a4379fe3737d6e86e84f1f556220a40d034a153e Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Thu, 26 Feb 2026 10:38:52 +0100 Subject: [PATCH] feat(stack): consolidate Ollama, Stable Audio, and TRELLIS into models stack Merge three individual GPU service stacks into a unified models.yml. All services share the RTX 2080 Ti and docker-dataplane network. Co-Authored-By: Claude Opus 4.6 --- stacks/models.yml | 199 ++++++++++++++++++++++++++++++++++++++++ stacks/ollama.yml | 78 ---------------- stacks/stable-audio.yml | 90 ------------------ stacks/trellis.yml | 116 ----------------------- 4 files changed, 199 insertions(+), 284 deletions(-) create mode 100644 stacks/models.yml delete mode 100644 stacks/ollama.yml delete mode 100644 stacks/stable-audio.yml delete mode 100644 stacks/trellis.yml diff --git a/stacks/models.yml b/stacks/models.yml new file mode 100644 index 0000000..6e68273 --- /dev/null +++ b/stacks/models.yml @@ -0,0 +1,199 @@ +version: '3.8' + +# Models Stack - GPU-Accelerated ML/AI Model Services +# Purpose: All GPU model serving (LLM inference, audio generation, 3D generation) +# Ports: 11434 (Ollama API), 11500 (Stable Audio UI), 11510 (TRELLIS UI) +# GPU: YES - Shared RTX 2080 Ti (11GB VRAM) +# Network: docker-dataplane + +services: + # ============================================ + # Ollama - LLM Inference Server + # API: http://localhost:11434 + # ============================================ + ollama: + image: ollama/ollama:latest + container_name: ollama + restart: unless-stopped + ports: + - "11434:11434" + volumes: + # Model storage on SSD for fast load times + - /home/jpmschweitzer/docker-data/ollama/models:/root/.ollama + environment: + - TZ=Europe/Amsterdam + - NVIDIA_VISIBLE_DEVICES=all + - NVIDIA_DRIVER_CAPABILITIES=all + # Process requests sequentially to avoid batch overflow panics + - OLLAMA_NUM_PARALLEL=1 + # Unload LLMs after 5 minutes idle (keeps VRAM free for other services) + - OLLAMA_KEEP_ALIVE=5m + # Only keep one model loaded at a time (embedding model stays, LLMs swap) + - OLLAMA_MAX_LOADED_MODELS=1 + healthcheck: + test: ["CMD-SHELL", "curl -fSs http://localhost:11434/api/tags || exit 1"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 60s + deploy: + resources: + limits: + memory: 8G + reservations: + memory: 1G + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + networks: + - docker-dataplane + + # ============================================ + # Stable Audio Open - AI Audio Generation + # Web UI: http://localhost:11500 + # Image: locally built + # ============================================ + stable-audio: + image: stable-audio-open:local + container_name: stable-audio + restart: unless-stopped + ports: + - "11500:8000" + volumes: + # HuggingFace cache for model weights (~6GB) + - /home/jpmschweitzer/docker-data/stable-audio/hf-cache:/root/.cache/huggingface + environment: + - TZ=Europe/Amsterdam + - NVIDIA_VISIBLE_DEVICES=all + - NVIDIA_DRIVER_CAPABILITIES=compute,utility + - HF_TOKEN=${HF_TOKEN} + healthcheck: + test: ["CMD-SHELL", "curl -fSs http://localhost:8000/ || exit 1"] + interval: 60s + timeout: 30s + retries: 3 + start_period: 300s + deploy: + resources: + limits: + memory: 16G + reservations: + memory: 8G + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + labels: + - "com.centurylinklabs.watchtower.enable=false" + networks: + - docker-dataplane + + # ============================================ + # TRELLIS - 3D Model Generation (Low-VRAM Fork) + # Web UI: http://localhost:11510 + # Image: locally built + # ============================================ + trellis: + image: trellis:local + container_name: trellis + restart: unless-stopped + ports: + - "11510:7860" + volumes: + # SSD: HuggingFace model cache (~5GB) + - /home/jpmschweitzer/docker-data/trellis/hf-cache:/root/.cache/huggingface + # HDD: Generated GLB files + - /mnt/media/trellis/outputs:/app/outputs + # Entrypoint script (patches Gradio bugs without rebuilding image) + - /home/jpmschweitzer/docker-data/trellis/entrypoint.sh:/app/entrypoint.sh:ro + command: ["bash", "/app/entrypoint.sh"] + environment: + - TZ=Europe/Amsterdam + - NVIDIA_VISIBLE_DEVICES=all + - NVIDIA_DRIVER_CAPABILITIES=compute,utility + # VRAM Optimization (for 11GB card) + - ATTN_BACKEND=xformers + - SPCONV_ALGO=native + - PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True + # Gradio must bind to 0.0.0.0 inside Docker + - GRADIO_SERVER_NAME=0.0.0.0 + # HuggingFace token for model downloads (set in Portainer) + - HF_TOKEN=${HF_TOKEN:-} + healthcheck: + test: ["CMD-SHELL", "curl -fSs http://localhost:7860/ || exit 1"] + interval: 60s + timeout: 30s + retries: 3 + start_period: 300s + memswap_limit: 20G + deploy: + resources: + limits: + memory: 20G + reservations: + memory: 4G + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + labels: + - "com.centurylinklabs.watchtower.enable=false" + networks: + - docker-dataplane + +networks: + docker-dataplane: + external: true + name: docker-dataplane + +# ============================================================================= +# GPU CONTENTION +# ============================================================================= +# +# All three services share the RTX 2080 Ti (11GB VRAM). +# Ollama unloads models after 5 min idle to free VRAM. +# For heavy Stable Audio or TRELLIS generations, consider stopping Ollama: +# docker stop ollama && && docker start ollama +# +# ============================================================================= +# OLLAMA +# ============================================================================= +# +# After Deployment: +# 1. Verify GPU access: docker exec ollama nvidia-smi +# 2. Pull a model: docker exec ollama ollama pull llama3.2:3b +# 3. List models: docker exec ollama ollama list +# 4. Test inference: docker exec ollama ollama run llama3.2:3b "Hello" +# +# Recommended Models for RTX 2080 Ti (11GB VRAM): +# - llama3.2:3b (2GB) - Fast, general purpose +# - mistral:7b (4GB) - High quality, coding +# - codellama:7b (4GB) - Code-specialized +# - phi3:mini (2GB) - Fast reasoning +# +# ============================================================================= +# STABLE AUDIO +# ============================================================================= +# +# Prerequisites: +# 1. Build image: cd ~/docker-data/stable-audio-open && docker build -t stable-audio-open:local . +# 2. Create HuggingFace token: https://huggingface.co/settings/tokens (read access) +# 3. Accept model license: https://huggingface.co/stabilityai/stable-audio-open-1.0 +# 4. mkdir -p ~/docker-data/stable-audio/hf-cache +# 5. Set HF_TOKEN in Portainer environment variables +# +# ============================================================================= +# TRELLIS +# ============================================================================= +# +# Prerequisites: +# 1. Build image: cd ~/docker-data/trellis && docker build -t trellis:local . (~20-30 min) +# 2. mkdir -p ~/docker-data/trellis/hf-cache /mnt/media/trellis/outputs +# +# Game Asset Pipeline: +# 1. Open Gradio UI at http://tower-of-joy:11510 +# 2. Upload reference image or enter text prompt +# 3. Generate 3D model (uses 6-8GB VRAM) +# 4. Download GLB file from outputs +# 5. Import into Blender, apply textures, render sprites diff --git a/stacks/ollama.yml b/stacks/ollama.yml deleted file mode 100644 index d6ce2a4..0000000 --- a/stacks/ollama.yml +++ /dev/null @@ -1,78 +0,0 @@ -version: '3.8' - -# Ollama - GPU-Accelerated ML Model Serving -# Phase 1: Foundation Setup -# Ports: 11434 (API) -# GPU: YES - Requires NVIDIA Container Toolkit -# Storage: SSD or HDD for models (models are 2-15GB each) - -services: - ollama: - image: ollama/ollama:latest - container_name: ollama - restart: unless-stopped - ports: - - "11434:11434" # Ollama API endpoint - volumes: - # Model storage - choose based on available space: - # SSD (faster load times): /home/jpmschweitzer/docker-data/ollama/models - # HDD (more space): /mnt/media/ollama/models - - /home/jpmschweitzer/docker-data/ollama/models:/root/.ollama - environment: - - TZ=Europe/Amsterdam - - NVIDIA_VISIBLE_DEVICES=all - - NVIDIA_DRIVER_CAPABILITIES=all - # Process requests sequentially to avoid batch overflow panics - - OLLAMA_NUM_PARALLEL=1 - # Unload LLMs after 5 minutes idle (keeps VRAM free for other services) - - OLLAMA_KEEP_ALIVE=5m - # Only keep one model loaded at a time (embedding model stays, LLMs swap) - - OLLAMA_MAX_LOADED_MODELS=1 - healthcheck: - test: ["CMD-SHELL", "curl -fSs http://localhost:11434/api/tags || exit 1"] - interval: 30s - timeout: 10s - retries: 3 - start_period: 60s - deploy: - resources: - limits: - memory: 8G - reservations: - memory: 1G - devices: - - driver: nvidia - count: 1 - capabilities: [gpu] - networks: - - docker-dataplane - -networks: - docker-dataplane: - external: true - name: docker-dataplane - -# GPU Requirements: -# - RTX 2080 Ti (11GB VRAM) -# - Suitable for 3B-13B parameter models -# - NVIDIA Container Toolkit must be installed -# -# After Deployment: -# 1. Verify GPU access: docker exec ollama nvidia-smi -# 2. Pull a model: docker exec ollama ollama pull llama3.2:3b -# 3. List models: docker exec ollama ollama list -# 4. Test inference: docker exec ollama ollama run llama3.2:3b "Hello" -# 5. Monitor GPU during inference: watch -n 1 nvidia-smi -# -# Recommended Models for RTX 2080 Ti (11GB VRAM): -# - llama3.2:3b (2GB) - Fast, general purpose -# - mistral:7b (4GB) - High quality, coding -# - codellama:7b (4GB) - Code-specialized -# - phi3:mini (2GB) - Fast reasoning -# -# API Usage: -# curl http://localhost:11434/api/generate -d '{ -# "model": "llama3.2:3b", -# "prompt": "Why is the sky blue?", -# "stream": false -# }' diff --git a/stacks/stable-audio.yml b/stacks/stable-audio.yml deleted file mode 100644 index bb946ee..0000000 --- a/stacks/stable-audio.yml +++ /dev/null @@ -1,90 +0,0 @@ -version: '3.8' - -# Stable Audio Open - AI Audio Generation -# Phase: ML Infrastructure -# Ports: 8000 (Gradio Web UI) -# GPU: YES - Requires NVIDIA Container Toolkit (8GB+ VRAM) -# Storage: SSD recommended for model cache -# Image: Built locally from https://github.com/SaladTechnologies/stable-audio-open - -services: - stable-audio: - image: stable-audio-open:local - container_name: stable-audio - restart: unless-stopped - ports: - - "11500:8000" # Gradio Web UI (internal only) - volumes: - # HuggingFace cache for model weights (~6GB) - - /home/jpmschweitzer/docker-data/stable-audio/hf-cache:/root/.cache/huggingface - environment: - - TZ=Europe/Amsterdam - - NVIDIA_VISIBLE_DEVICES=all - - NVIDIA_DRIVER_CAPABILITIES=compute,utility - - HF_TOKEN=${HF_TOKEN} - healthcheck: - test: ["CMD-SHELL", "curl -fSs http://localhost:8000/ || exit 1"] - interval: 60s - timeout: 30s - retries: 3 - start_period: 300s # Model download + load takes time - deploy: - resources: - limits: - memory: 16G - reservations: - memory: 8G - devices: - - driver: nvidia - count: 1 - capabilities: [gpu] - networks: - - docker-dataplane - -networks: - docker-dataplane: - external: true - name: docker-dataplane - -# GPU Requirements: -# - RTX 2080 Ti (11GB VRAM) - minimum viable, may struggle with long generations -# - Recommended: 16GB+ VRAM for reliable 47s audio generation -# - NVIDIA Container Toolkit must be installed -# -# IMPORTANT: GPU Contention -# - This service shares GPU with Ollama and Jellyfin -# - Consider stopping Ollama when generating audio for better VRAM availability -# - Monitor with: watch -n 1 nvidia-smi -# -# Prerequisites: -# 1. Build image: cd /home/jpmschweitzer/docker-data/stable-audio-open && docker build -t stable-audio-open:local . -# 2. Create HuggingFace token: https://huggingface.co/settings/tokens (read access) -# 3. Accept model license: https://huggingface.co/stabilityai/stable-audio-open-1.0 -# 4. Create data directories: -# mkdir -p /home/jpmschweitzer/docker-data/stable-audio/{hf-cache,output} -# -# After Deployment: -# 1. Set HF_TOKEN in Portainer environment variables -# 2. Deploy stack via Portainer -# 3. First run downloads model weights (~6GB) - be patient -# 4. Verify GPU access: docker exec stable-audio nvidia-smi -# 5. Access Web UI: http://tower-of-joy:11500 or http://audio.schweitz.internal (via NPM) -# -# NPM Configuration (audio.schweitz.internal): -# - Domain: audio.schweitz.internal -# - Scheme: http -# - Forward Hostname: stable-audio (or tower-of-joy) -# - Forward Port: 11500 -# - Block Common Exploits: Yes -# - Websockets Support: Yes (required for Gradio) -# -# API Usage (Gradio API): -# curl -X POST http://audio.schweitz.internal/api/predict \ -# -H "Content-Type: application/json" \ -# -d '{"data": ["epic orchestral music, cinematic", 30, 100, 7]}' -# Parameters: [prompt, duration_seconds, diffusion_steps, cfg_scale] -# -# Rebuilding Image: -# cd /home/jpmschweitzer/docker-data/stable-audio-open -# git pull -# docker build -t stable-audio-open:local . diff --git a/stacks/trellis.yml b/stacks/trellis.yml deleted file mode 100644 index 656ca00..0000000 --- a/stacks/trellis.yml +++ /dev/null @@ -1,116 +0,0 @@ -version: '3.8' - -# TRELLIS 1 - 3D Model Generation (Low-VRAM Fork) -# Purpose: Generate 3D meshes with UV mappings for game asset pipeline -# Ports: 11510 (Gradio Web UI) -# GPU: YES - Optimized for 11GB VRAM (RTX 2080 Ti) -# Storage: SSD for model cache, HDD for GLB outputs -# Image: Built locally from /home/jpmschweitzer/docker-data/trellis/ - -services: - trellis: - image: trellis:local - container_name: trellis - restart: unless-stopped - ports: - - "11510:7860" # Gradio Web UI - volumes: - # SSD: HuggingFace model cache (~5GB) - - /home/jpmschweitzer/docker-data/trellis/hf-cache:/root/.cache/huggingface - # HDD: Generated GLB files - - /mnt/media/trellis/outputs:/app/outputs - # Entrypoint script (patches Gradio bugs without rebuilding image) - - /home/jpmschweitzer/docker-data/trellis/entrypoint.sh:/app/entrypoint.sh:ro - command: ["bash", "/app/entrypoint.sh"] - environment: - - TZ=Europe/Amsterdam - - NVIDIA_VISIBLE_DEVICES=all - - NVIDIA_DRIVER_CAPABILITIES=compute,utility - # VRAM Optimization (for 11GB card) - - ATTN_BACKEND=xformers - - SPCONV_ALGO=native - - PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True - # Gradio must bind to 0.0.0.0 inside Docker - - GRADIO_SERVER_NAME=0.0.0.0 - # HuggingFace token for model downloads (set in Portainer) - - HF_TOKEN=${HF_TOKEN:-} - healthcheck: - test: ["CMD-SHELL", "curl -fSs http://localhost:7860/ || exit 1"] - interval: 60s - timeout: 30s - retries: 3 - start_period: 300s # Model download + load time - memswap_limit: 20G - deploy: - resources: - limits: - memory: 20G - reservations: - memory: 4G - devices: - - driver: nvidia - count: 1 - capabilities: [gpu] - labels: - - "com.centurylinklabs.watchtower.enable=false" # Manual updates for local builds - networks: - - docker-dataplane - -networks: - docker-dataplane: - external: true - name: docker-dataplane - -# ============================================================================= -# PREREQUISITES -# ============================================================================= -# -# 1. Build the Docker image first: -# cd /home/jpmschweitzer/docker-data/trellis -# docker build -t trellis:local . -# (Takes ~20-30 minutes for CUDA compilation) -# -# 2. Directories are already created: -# /home/jpmschweitzer/docker-data/trellis/hf-cache (SSD - model cache) -# /mnt/media/trellis/outputs (HDD - generated GLB files) -# -# ============================================================================= -# AFTER DEPLOYMENT -# ============================================================================= -# -# 1. Verify GPU access: -# docker exec trellis nvidia-smi -# -# 2. Check logs: -# docker logs trellis -# -# 3. Access Web UI: -# http://tower-of-joy:11510 -# http://192.168.86.149:11510 -# -# 4. Monitor VRAM during generation: -# watch -n 1 nvidia-smi -# -# ============================================================================= -# USAGE - GAME ASSET PIPELINE -# ============================================================================= -# -# 1. Open Gradio UI at http://tower-of-joy:11510 -# 2. Upload reference image or enter text prompt -# 3. Generate 3D model (uses 6-8GB VRAM) -# 4. Download GLB file from outputs -# 5. Import GLB into Blender (File > Import > glTF) -# 6. Apply custom textures, set up isometric camera -# 7. Render at 1024x1024, downsample to 64x64 tile sprites -# -# ============================================================================= -# GPU CONTENTION NOTE -# ============================================================================= -# -# TRELLIS shares the RTX 2080 Ti with Ollama and Jellyfin. -# For best results during complex generations: -# docker stop ollama -# # Run TRELLIS generation -# docker start ollama -# -# =============================================================================