From 57ef5a13b1d8afe16f78547a368b5ef19c3ba3ac Mon Sep 17 00:00:00 2001 From: Preston Hunter Date: Sat, 27 Dec 2025 12:43:54 -0500 Subject: [PATCH] Add AI stack --- stacks/ai/ai-backend.hcl | 0 stacks/ai/ai-backend.nomad | 65 +++++++++++++++++++++++++++++++++++++ stacks/ai/ai-frontend.hcl | 0 stacks/ai/ai-frontend.nomad | 53 ++++++++++++++++++++++++++++++ 4 files changed, 118 insertions(+) delete mode 100644 stacks/ai/ai-backend.hcl create mode 100644 stacks/ai/ai-backend.nomad delete mode 100644 stacks/ai/ai-frontend.hcl create mode 100644 stacks/ai/ai-frontend.nomad diff --git a/stacks/ai/ai-backend.hcl b/stacks/ai/ai-backend.hcl deleted file mode 100644 index e69de29..0000000 diff --git a/stacks/ai/ai-backend.nomad b/stacks/ai/ai-backend.nomad new file mode 100644 index 0000000..e489b57 --- /dev/null +++ b/stacks/ai/ai-backend.nomad @@ -0,0 +1,65 @@ +job "ai-backend" { + datacenters = ["Homelab-PTECH-DC"] + region = "home" + type = "service" + + group "ollama-group" { + count = 1 + + # Pin to P52 Laptop (eGPU Host) + constraint { + attribute = "${meta.device}" + value = "p52-laptop" + } + + network { + port "api" { static = 11434 } + } + + task "ollama" { + driver = "podman" + + env { + OLLAMA_HOST = "0.0.0.0" + OLLAMA_ORIGINS = "*" + + # CRITICAL FOR 6900XT: + # This tells ROCm to treat the card like a supported Pro workstation card + HSA_OVERRIDE_GFX_VERSION = "10.3.0" + } + + config { + # Standard image (contains ROCm libraries) + image = "docker.io/ollama/ollama:latest" + ports = ["api"] + + # Required for hardware access + privileged = true + + # Pass the graphics hardware to the container + volumes = [ + "/opt/homelab/ollama:/root/.ollama", + "/dev/kfd:/dev/kfd", + "/dev/dri:/dev/dri" + ] + } + + service { + name = "ollama" + port = "api" + + check { + type = "http" + path = "/" + interval = "20s" + timeout = "2s" + } + } + + resources { + cpu = 2000 + memory = 8192 # 8GB System RAM (The GPU has its own VRAM) + } + } + } +} \ No newline at end of file diff --git a/stacks/ai/ai-frontend.hcl b/stacks/ai/ai-frontend.hcl deleted file mode 100644 index e69de29..0000000 diff --git a/stacks/ai/ai-frontend.nomad b/stacks/ai/ai-frontend.nomad new file mode 100644 index 0000000..5ec6d71 --- /dev/null +++ b/stacks/ai/ai-frontend.nomad @@ -0,0 +1,53 @@ +job "ai-frontend" { + datacenters = ["Homelab-PTECH-DC"] + region = "home" + type = "service" + + group "openwebui" { + count = 1 + network { + port "http" { to = 8080 } + } + service { + name = "openwebui" + port = "http" + tags = ["traefik.enable=true"] + } + task "server" { + driver = "podman" + env { + OLLAMA_BASE_URL = "http://ollama.service.consul:11434" + } + config { + image = "ghcr.io/open-webui/open-webui:main" + ports = ["http"] + volumes = ["/opt/homelab/openwebui:/app/backend/data"] + } + resources { cpu = 1000; memory = 1024 } + } + } + + group "lobechat" { + count = 1 + network { + port "http" { to = 3210 } + } + service { + name = "lobechat" + port = "http" + tags = ["traefik.enable=true"] + } + task "server" { + driver = "podman" + env { + OLLAMA_PROXY_URL = "http://ollama.service.consul:11434" + ACCESS_CODE = "securepassword123" + } + config { + image = "docker.io/lobehub/lobe-chat" + ports = ["http"] + } + resources { cpu = 500; memory = 512 } + } + } +} \ No newline at end of file