Files
nomad/stacks/ai/ai-frontend.nomad
Preston Hunter 2958fece21 fix(ai-frontend): Configure Consul DNS for service discovery
This commit addresses service discovery issues by explicitly configuring Consul DNS for the `openwebui` and `lobechat` tasks within the `ai-frontend` job.

Previously, services were unable to reliably resolve `ollama.service.consul`. This is resolved by:

*   Setting `dns_servers` to the Consul server IP (`192.168.1.133`).
*   Setting `dns_search` to `service.consul`.
*   Reverting `OLLAMA_BASE_URL` and `OLLAMA_PROXY_URL` environment variables to use `ollama.service.consul` as intended.
*   The `lobechat` task's image is now pinned to `v1.143.0` for improved stability.
*   Removed outdated comments regarding host pinning.
2025-12-28 00:11:55 -05:00

116 lines
2.3 KiB
HCL

job "ai-frontend" {
datacenters = ["Homelab-PTECH-DC"]
region = "home"
type = "service"
# --- OpenWebUI ---
group "openwebui" {
count = 1
constraint {
attribute = "${attr.unique.hostname}"
value = "hp1-home"
}
network {
port "http" {
static = 8080
to = 8080
}
}
service {
name = "openwebui"
port = "http"
tags = ["traefik.enable=true"]
check {
type = "http"
path = "/health"
interval = "20s"
timeout = "2s"
}
}
task "server" {
driver = "podman"
env {
# REVERTED: Now using Consul DNS again
OLLAMA_BASE_URL = "http://ollama.service.consul:11434"
}
config {
image = "ghcr.io/open-webui/open-webui:main"
ports = ["http"]
volumes = [
"/mnt/local-ssd/nomad/stacks/ai/ai-frontend/openwebui:/app/backend/data"
]
# --- THE FIX: Point DNS to Consul Server ---
dns_servers = ["192.168.1.133"]
dns_search = ["service.consul"]
}
resources {
cpu = 1000
memory = 1024
}
}
}
# --- LobeChat ---
group "lobechat" {
count = 1
constraint {
attribute = "${attr.unique.hostname}"
value = "hp1-home"
}
network {
port "http" {
static = 3210
to = 3210
}
}
service {
name = "lobechat"
port = "http"
tags = ["traefik.enable=true"]
check {
type = "http"
path = "/api/health"
interval = "20s"
timeout = "2s"
}
}
task "server" {
driver = "podman"
env {
# REVERTED: Now using Consul DNS again
OLLAMA_PROXY_URL = "http://ollama.service.consul:11434"
# Kept this in, but Authentik will handle security later as you noted
ACCESS_CODE = "securepassword123"
}
config {
# Pinned version for stability
image = "docker.io/lobehub/lobe-chat:v1.143.0"
ports = ["http"]
# --- THE FIX: Point DNS to Consul Server ---
dns_servers = ["192.168.1.133"]
dns_search = ["service.consul"]
}
resources {
cpu = 500
memory = 1024
}
}
}
}