Add deployments/ai-stack — combined production-shape example
Sanitized snapshot of the live srvno.de stack: Caddy + Ollama (with preseed) + ComfyUI + Open WebUI + Anubis stub. Real hostnames, secrets, and bcrypt hash replaced with placeholders so the dir is safe to commit. Caddyfile updated to point at comfyui:8188 (the source file pointed at the now-removed forge service). Dropped FIGMENT_/FORGE_/SEGMENT_IMAGE_TAG from the env example. Harmonised the init-models.sh mount path between ollama and model-init services. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
09fcec7c07
commit
5b61caa197
6 files changed
+308
No files matched your search
@@ -0,0 +1,187 @@
|
||||
# ai-stack — combined deployment example: caddy + comfyui + ollama +
|
||||
# open-webui (+ anubis later). One GPU host, one bridge network, one TLS
|
||||
# entry point.
|
||||
#
|
||||
# This is the "full meal" deployment. The minimal "just ComfyUI" example
|
||||
# lives in the repo root (../../docker-compose.yml).
|
||||
|
||||
name: ai-stack
|
||||
|
||||
volumes:
|
||||
comfyui-models:
|
||||
comfyui-custom-nodes:
|
||||
comfyui-input:
|
||||
comfyui-output:
|
||||
comfyui-user:
|
||||
ollama-data:
|
||||
open-webui-data:
|
||||
caddy-data:
|
||||
caddy-config:
|
||||
|
||||
services:
|
||||
# ---------------------------------------------------------------------------
|
||||
# Caddy — the only service exposed on 80/443. Terminates TLS (auto Let's
|
||||
# Encrypt), reverse-proxies to the in-compose services by name.
|
||||
# ---------------------------------------------------------------------------
|
||||
caddy:
|
||||
image: caddy:2-alpine
|
||||
container_name: caddy
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
- "443:443/udp" # HTTP/3
|
||||
volumes:
|
||||
- ./Caddyfile:/etc/caddy/Caddyfile:ro
|
||||
- caddy-data:/data
|
||||
- caddy-config:/config
|
||||
depends_on:
|
||||
- open-webui
|
||||
- comfyui
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:2019/config/"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Ollama — LLM daemon, GPU-backed.
|
||||
# ---------------------------------------------------------------------------
|
||||
ollama:
|
||||
image: ollama/ollama:latest
|
||||
container_name: ollama
|
||||
restart: unless-stopped
|
||||
# 11434 only published if you want direct access from the VM host.
|
||||
# Services inside the stack reach it via http://ollama:11434.
|
||||
ports:
|
||||
- "11434:11434"
|
||||
volumes:
|
||||
- ollama-data:/root/.ollama
|
||||
environment:
|
||||
- OLLAMA_HOST=0.0.0.0:11434
|
||||
- OLLAMA_KEEP_ALIVE=30m
|
||||
- OLLAMA_MAX_LOADED_MODELS=2
|
||||
- OLLAMA_FLASH_ATTENTION=1
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
devices:
|
||||
- driver: nvidia
|
||||
count: all
|
||||
capabilities: [gpu]
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "ollama list >/dev/null 2>&1 || exit 1"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 20s
|
||||
|
||||
# One-shot model puller. Runs after ollama is healthy, pulls whatever
|
||||
# init-models.sh lists, exits. `restart: "no"` keeps it from looping.
|
||||
model-init:
|
||||
image: ollama/ollama:latest
|
||||
container_name: ollama-model-init
|
||||
depends_on:
|
||||
ollama:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- ollama-data:/root/.ollama
|
||||
- ./init-models.sh:/init-models.sh:ro
|
||||
environment:
|
||||
- OLLAMA_HOST=ollama:11434
|
||||
entrypoint: ["/bin/sh", "/init-models.sh"]
|
||||
restart: "no"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# ComfyUI — image generation (txt2img + img2img), GPU-backed.
|
||||
# No host port published — Caddy fronts it. Uncomment 8188 only for
|
||||
# VM-local debug or to use ComfyUI's native web UI directly.
|
||||
#
|
||||
# Replaces the figment + segment + Forge trio. Open WebUI talks to
|
||||
# /prompt directly; SAM2/Grounding-DINO masking lives in custom_nodes
|
||||
# (install via ComfyUI-Manager) instead of as a separate sidecar.
|
||||
# ---------------------------------------------------------------------------
|
||||
comfyui:
|
||||
image: git.anomalous.dev/alphacentri/comfyui-nvidia:${COMFYUI_IMAGE_TAG:-latest}
|
||||
pull_policy: always
|
||||
container_name: comfyui
|
||||
restart: unless-stopped
|
||||
# ports:
|
||||
# - "8188:8188"
|
||||
volumes:
|
||||
- comfyui-models:/opt/comfyui/models
|
||||
- comfyui-custom-nodes:/opt/comfyui/custom_nodes
|
||||
- comfyui-input:/opt/comfyui/input
|
||||
- comfyui-output:/opt/comfyui/output
|
||||
- comfyui-user:/opt/comfyui/user
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
devices:
|
||||
- driver: nvidia
|
||||
count: all
|
||||
capabilities: [gpu]
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-sf", "http://127.0.0.1:8188/system_stats"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 120s
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Open WebUI — multi-user chat.
|
||||
# ---------------------------------------------------------------------------
|
||||
open-webui:
|
||||
image: ghcr.io/open-webui/open-webui:main
|
||||
container_name: open-webui
|
||||
restart: unless-stopped
|
||||
# ports: not published; Caddy fronts it
|
||||
environment:
|
||||
ENABLE_OPENAI_API: "false"
|
||||
WEBUI_AUTH: "true"
|
||||
ENABLE_SIGNUP: "false"
|
||||
DEFAULT_USER_ROLE: "pending"
|
||||
WEBUI_URL: "https://chat.example.com"
|
||||
WEBUI_SECRET_KEY: "${WEBUI_SECRET_KEY}"
|
||||
OLLAMA_BASE_URL: "http://ollama:11434"
|
||||
ENABLE_IMAGE_GENERATION: "true"
|
||||
IMAGE_GENERATION_ENGINE: "comfyui"
|
||||
COMFYUI_BASE_URL: "http://comfyui:8188"
|
||||
IMAGE_SIZE: "1024x1024"
|
||||
IMAGE_STEPS: "45"
|
||||
# Workflow JSON + node mappings are pasted into the admin panel
|
||||
# (Settings → Images). Source files live in this repo under
|
||||
# workflows/ — txt2img.json, txt2img.nodes.json, img2img.json,
|
||||
# img2img.nodes.json.
|
||||
volumes:
|
||||
- open-webui-data:/app/backend/data
|
||||
depends_on:
|
||||
ollama:
|
||||
condition: service_healthy
|
||||
comfyui:
|
||||
condition: service_started
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-sf", "http://127.0.0.1:8080/health"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Anubis — PoW anti-bot sidecar(s). One per protected hostname. To enable:
|
||||
# uncomment the block, generate a key with `openssl rand -hex 32`, and flip
|
||||
# the corresponding `reverse_proxy` target in Caddyfile from
|
||||
# `open-webui:8080` → `anubis-owui:8923`.
|
||||
# ---------------------------------------------------------------------------
|
||||
anubis-owui:
|
||||
image: ghcr.io/techarohq/anubis:latest
|
||||
container_name: anubis-owui
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
BIND: ":8923"
|
||||
TARGET: "http://open-webui:8080"
|
||||
DIFFICULTY: "4" # SHA-256 leading zeros; 4 = ~1s client work
|
||||
COOKIE_DOMAIN: "chat.example.com"
|
||||
METRICS_BIND: ":9090"
|
||||
ED25519_PRIVATE_KEY_HEX: "${ANUBIS_OWUI_KEY}"
|
||||
Reference in new issue
Block a user