Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ DOWNLOADS_ROOT=/opt/homelab/downloads
# -----------------------------------------------------------------------------
# OLLAMA / AI
# -----------------------------------------------------------------------------
OLLAMA_GPU_ENABLED=false # Set to true if you have NVIDIA GPU
COMPOSE_PROFILES=cpu # AI Stack GPU configuration (cpu, nvidia, amd)
HF_ENDPOINT= # Set to https://hf-mirror.com for CN users

# -----------------------------------------------------------------------------
# NOTIFICATIONS
Expand Down
110 changes: 84 additions & 26 deletions stacks/ai/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
services:
ollama:
image: ollama/ollama:0.3.14
# ============================================================================
# OLLAMA
# ============================================================================
ollama-cpu:
image: ollama/ollama:0.3.12
container_name: ollama
restart: unless-stopped
profiles: ["cpu"]
networks:
- proxy
volumes:
Expand All @@ -15,15 +19,58 @@ services:
- traefik.http.routers.ollama.entrypoints=websecure
- traefik.http.routers.ollama.tls=true
- traefik.http.services.ollama.loadbalancer.server.port=11434
healthcheck:
test: [CMD-SHELL, "curl -sf http://localhost:11434/api/tags || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s

ollama-nvidia:
image: ollama/ollama:0.3.12
container_name: ollama
restart: unless-stopped
profiles: ["nvidia"]
networks:
- proxy
volumes:
- ollama-data:/root/.ollama
environment:
- OLLAMA_ORIGINS=*
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
labels:
- traefik.enable=true
- "traefik.http.routers.ollama.rule=Host(`ollama.${DOMAIN}`)"
- traefik.http.routers.ollama.entrypoints=websecure
- traefik.http.routers.ollama.tls=true
- traefik.http.services.ollama.loadbalancer.server.port=11434

ollama-amd:
image: ollama/ollama:0.3.12-rocm
container_name: ollama
restart: unless-stopped
profiles: ["amd"]
networks:
- proxy
volumes:
- ollama-data:/root/.ollama
environment:
- OLLAMA_ORIGINS=*
devices:
- /dev/kfd:/dev/kfd
- /dev/dri:/dev/dri
labels:
- traefik.enable=true
- "traefik.http.routers.ollama.rule=Host(`ollama.${DOMAIN}`)"
- traefik.http.routers.ollama.entrypoints=websecure
- traefik.http.routers.ollama.tls=true
- traefik.http.services.ollama.loadbalancer.server.port=11434

# ============================================================================
# OPEN WEBUI
# ============================================================================
open-webui:
image: ghcr.io/open-webui/open-webui:v0.3.35
image: ghcr.io/open-webui/open-webui:0.3.32
container_name: open-webui
restart: unless-stopped
networks:
Expand All @@ -34,24 +81,19 @@ services:
- OLLAMA_BASE_URL=http://ollama:11434
- WEBUI_SECRET_KEY=${WEBUI_SECRET_KEY:-changeme-secret-32chars}
- DEFAULT_LOCALE=zh-CN
depends_on:
ollama:
condition: service_healthy
- HF_ENDPOINT=${HF_ENDPOINT:-}
labels:
- traefik.enable=true
- "traefik.http.routers.open-webui.rule=Host(`ai.${DOMAIN}`)"
- traefik.http.routers.open-webui.entrypoints=websecure
- traefik.http.routers.open-webui.tls=true
- traefik.http.services.open-webui.loadbalancer.server.port=8080
healthcheck:
test: [CMD-SHELL, "curl -sf http://localhost:8080/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s

# ============================================================================
# STABLE DIFFUSION
# ============================================================================
stable-diffusion:
image: ghcr.io/abiosoft/sd-webui-docker:cpu-v1.10.1
image: universonic/stable-diffusion-webui:latest-sha
container_name: stable-diffusion
restart: unless-stopped
networks:
Expand All @@ -60,19 +102,34 @@ services:
- sd-models:/app/models
- sd-output:/app/outputs
environment:
- COMMANDLINE_ARGS=--no-half --skip-torch-cuda-test --use-cpu all
- COMMANDLINE_ARGS=${SD_ARGS:---no-half --skip-torch-cuda-test --use-cpu all}
- HF_ENDPOINT=${HF_ENDPOINT:-}
labels:
- traefik.enable=true
- "traefik.http.routers.sd.rule=Host(`sd.${DOMAIN}`)"
- traefik.http.routers.sd.entrypoints=websecure
- traefik.http.routers.sd.tls=true
- traefik.http.services.sd.loadbalancer.server.port=7860
healthcheck:
test: [CMD-SHELL, "curl -sf http://localhost:7860/ || exit 1"]
interval: 60s
timeout: 30s
retries: 3
start_period: 120s

# ============================================================================
# PERPLEXICA
# ============================================================================
perplexica:
image: itzcrazykns1337/perplexica:main-sha
container_name: perplexica
restart: unless-stopped
networks:
- proxy
volumes:
- perplexica-data:/data
environment:
- SEARXNG_API_URL=${SEARXNG_API_URL:-http://searxng:8080}
labels:
- traefik.enable=true
- "traefik.http.routers.perplexica.rule=Host(`search.${DOMAIN}`)"
- traefik.http.routers.perplexica.entrypoints=websecure
- traefik.http.routers.perplexica.tls=true
- traefik.http.services.perplexica.loadbalancer.server.port=3000

networks:
proxy:
Expand All @@ -83,3 +140,4 @@ volumes:
open-webui-data:
sd-models:
sd-output:
perplexica-data: