Files
nomad/stacks/ai/ai-backend.nomad
2025-12-27 14:37:33 -05:00

71 lines
1.6 KiB
HCL

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 = "*"
# 1. The Magic Key for the 6900XT
HSA_OVERRIDE_GFX_VERSION = "10.3.0"
# 2. Enable Debugging
OLLAMA_DEBUG = "1"
# 3. CRITICAL: Remove any ROCR_VISIBLE_DEVICES variable here!
# Let Ollama see all cards and pick the one that works.
}
config {
image = "docker.io/ollama/ollama:latest"
ports = ["api"]
# Required to talk to hardware
privileged = true
# --- THE FIX ---
# 1. Map /dev/kfd (Compute Interface)
devices = ["/dev/kfd"]
# 2. Map the ENTIRE graphics folder as a Volume
# This ensures the driver sees card0, card1, renderD128, etc.
volumes = [
"/mnt/local-ssd/nomad/stacks/ai/ai-backend/ollama:/root/.ollama",
"/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)
}
}
}
}