refactor(nomad): Centralize DNS configuration for AI frontends
Moves DNS server and search domain configuration from task `config` blocks to the job/group `network` blocks for `ai-frontend` (OpenWebUI) and `lobechat`. This refactoring centralizes DNS settings for all tasks within a Nomad job or group, ensuring consistent DNS resolution and aligning with recommended Nomad configuration patterns.
This commit is contained in:
@@ -9,23 +9,30 @@ job "ai-frontend" {
|
|||||||
|
|
||||||
constraint {
|
constraint {
|
||||||
attribute = "${attr.unique.hostname}"
|
attribute = "${attr.unique.hostname}"
|
||||||
value = "hp1-home"
|
value = "hp1-home"
|
||||||
}
|
}
|
||||||
|
|
||||||
network {
|
network {
|
||||||
port "http" {
|
port "http" {
|
||||||
static = 8080
|
static = 8080
|
||||||
to = 8080
|
to = 8080
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ✅ DNS Moved Here
|
||||||
|
dns {
|
||||||
|
servers = ["192.168.1.133"]
|
||||||
|
searches = ["service.consul"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
service {
|
service {
|
||||||
name = "openwebui"
|
name = "openwebui"
|
||||||
port = "http"
|
port = "http"
|
||||||
tags = ["traefik.enable=true"]
|
tags = ["traefik.enable=true"]
|
||||||
|
|
||||||
check {
|
check {
|
||||||
type = "http"
|
type = "http"
|
||||||
path = "/health" # OpenWebUI actually HAS this endpoint
|
path = "/health"
|
||||||
interval = "20s"
|
interval = "20s"
|
||||||
timeout = "2s"
|
timeout = "2s"
|
||||||
}
|
}
|
||||||
@@ -33,7 +40,7 @@ job "ai-frontend" {
|
|||||||
|
|
||||||
task "server" {
|
task "server" {
|
||||||
driver = "podman"
|
driver = "podman"
|
||||||
|
|
||||||
env {
|
env {
|
||||||
OLLAMA_BASE_URL = "http://ollama.service.consul:11434"
|
OLLAMA_BASE_URL = "http://ollama.service.consul:11434"
|
||||||
}
|
}
|
||||||
@@ -44,15 +51,12 @@ job "ai-frontend" {
|
|||||||
volumes = [
|
volumes = [
|
||||||
"/mnt/local-ssd/nomad/stacks/ai/ai-frontend/openwebui:/app/backend/data"
|
"/mnt/local-ssd/nomad/stacks/ai/ai-frontend/openwebui:/app/backend/data"
|
||||||
]
|
]
|
||||||
|
# Removed invalid dns_servers/dns_search from here
|
||||||
# DNS Fix
|
|
||||||
dns_servers = ["192.168.1.133"]
|
|
||||||
dns_search = ["service.consul"]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resources {
|
resources {
|
||||||
cpu = 1000
|
cpu = 1000
|
||||||
memory = 1024
|
memory = 1024
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,29 +64,33 @@ job "ai-frontend" {
|
|||||||
# --- LobeChat ---
|
# --- LobeChat ---
|
||||||
group "lobechat" {
|
group "lobechat" {
|
||||||
count = 1
|
count = 1
|
||||||
|
|
||||||
constraint {
|
constraint {
|
||||||
attribute = "${attr.unique.hostname}"
|
attribute = "${attr.unique.hostname}"
|
||||||
value = "hp1-home"
|
value = "hp1-home"
|
||||||
}
|
}
|
||||||
|
|
||||||
network {
|
network {
|
||||||
port "http" {
|
port "http" {
|
||||||
static = 3210
|
static = 3210
|
||||||
to = 3210
|
to = 3210
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ✅ DNS Moved Here
|
||||||
|
dns {
|
||||||
|
servers = ["192.168.1.133"]
|
||||||
|
searches = ["service.consul"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
service {
|
service {
|
||||||
name = "lobechat"
|
name = "lobechat"
|
||||||
port = "http"
|
port = "http"
|
||||||
tags = ["traefik.enable=true"]
|
tags = ["traefik.enable=true"]
|
||||||
|
|
||||||
# --- THE FIX ---
|
|
||||||
# Changed from /api/health to / (Root)
|
|
||||||
check {
|
check {
|
||||||
type = "http"
|
type = "http"
|
||||||
path = "/"
|
path = "/"
|
||||||
interval = "20s"
|
interval = "20s"
|
||||||
timeout = "2s"
|
timeout = "2s"
|
||||||
}
|
}
|
||||||
@@ -90,7 +98,7 @@ job "ai-frontend" {
|
|||||||
|
|
||||||
task "server" {
|
task "server" {
|
||||||
driver = "podman"
|
driver = "podman"
|
||||||
|
|
||||||
env {
|
env {
|
||||||
OLLAMA_PROXY_URL = "http://ollama.service.consul:11434"
|
OLLAMA_PROXY_URL = "http://ollama.service.consul:11434"
|
||||||
ACCESS_CODE = "securepassword123"
|
ACCESS_CODE = "securepassword123"
|
||||||
@@ -99,15 +107,12 @@ job "ai-frontend" {
|
|||||||
config {
|
config {
|
||||||
image = "docker.io/lobehub/lobe-chat:v1.143.0"
|
image = "docker.io/lobehub/lobe-chat:v1.143.0"
|
||||||
ports = ["http"]
|
ports = ["http"]
|
||||||
|
# Removed invalid dns_servers/dns_search from here
|
||||||
# DNS Fix
|
|
||||||
dns_servers = ["192.168.1.133"]
|
|
||||||
dns_search = ["service.consul"]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resources {
|
resources {
|
||||||
cpu = 500
|
cpu = 500
|
||||||
memory = 1024
|
memory = 1024
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user