Files
portainer-core/stacks/models.yml
T
jpmschweitzerandClaude Opus 4.6 a4379fe373 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 <noreply@anthropic.com>
2026-02-26 10:38:52 +01:00

200 lines
6.7 KiB
YAML

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 && <generate> && 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