Files
nomad/stacks/ai/ai-backend.nomad
Preston Hunter 69dd29b3a1 fix(ai-backend): Configure Ollama service with host address mode
The `ollama` service in the `ai-backend` Nomad job has been updated to use `address_mode = "host"`. This ensures the service is registered with the host's IP address in Consul, allowing external proxies like Traefik to correctly route traffic. This change resolves potential connectivity issues by making the service directly accessible via the host network.
2025-12-29 00:48:56 -05:00

68 lines
1.5 KiB
HCL

job "ai-backend" {
datacenters = ["Homelab-PTECH-DC"]
region = "home"
type = "service"
group "ollama-group" {
count = 1
constraint {
attribute = "${meta.device}"
value = "p52-laptop"
}
network {
port "api" { static = 11434 }
}
task "ollama" {
driver = "podman"
env {
OLLAMA_HOST = "0.0.0.0:11434"
OLLAMA_ORIGINS = "*"
OLLAMA_DEBUG = "1"
# --- THE FIX: USE VULKAN INSTEAD OF ROCm ---
OLLAMA_VULKAN = "1"
# We keep this just in case Vulkan falls back to ROCm,
# but Vulkan should take priority.
HSA_OVERRIDE_GFX_VERSION = "10.3.0"
}
config {
image = "docker.io/ollama/ollama:latest"
ports = ["api"]
privileged = true
# --- MOUNT EVERYTHING ---
# Since Vulkan scans all GPUs to pick the best one,
# we give it access to the whole folder.
volumes = [
"/mnt/local-ssd/nomad/stacks/ai/ai-backend/ollama:/root/.ollama",
"/dev/kfd:/dev/kfd",
"/dev/dri:/dev/dri"
]
}
service {
name = "ollama"
port = "api"
tags = ["traefik.enable=true"]
address_mode = "host"
check {
type = "http"
path = "/"
interval = "20s"
timeout = "2s"
}
}
resources {
cpu = 2000
memory = 8192
}
}
}
}