fix(ai-frontend): Prevent LobeChat OOM and update host constraints

This commit addresses several issues and updates in the `ai-frontend.nomad` job configuration:

- **LobeChat OOM Fix**: Increased `lobechat` service memory allocation from 512MB to 1024MB to prevent out-of-memory crashes and improve stability.
- **Node Constraint Update**: Updated the `attr.unique.hostname` constraint for both `openwebui` and `lobechat` groups from `hp1-home` to `hp-mini-1` to reflect the correct node hostname.
- **Static Port Assignment**: Explicitly added `static` port definitions for `http` in both `openwebui` (8080) and `lobechat` (3210) services to ensure consistent port binding.
- **Minor Housekeeping**: Cleaned up comments and formatted resource blocks for better readability.
This commit is contained in:
2025-12-27 23:33:08 -05:00
parent c0f67aef53
commit aab5e07310

View File

@@ -3,25 +3,26 @@ job "ai-frontend" {
region = "home" region = "home"
type = "service" type = "service"
# --- OpenWebUI --- # --- OpenWebUI (Keep as is) ---
group "openwebui" { group "openwebui" {
count = 1 count = 1
# PIN TO HP1 (Change "hp-mini-1" to your actual node name if different)
constraint { constraint {
attribute = "${attr.unique.hostname}" attribute = "${attr.unique.hostname}"
value = "hp1-home" value = "hp-mini-1"
} }
network { network {
port "http" { to = 8080 } port "http" {
static = 8080
to = 8080
}
} }
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" path = "/health"
@@ -34,7 +35,6 @@ job "ai-frontend" {
driver = "podman" driver = "podman"
env { env {
# Magic: Uses Consul to find the P52 automatically
OLLAMA_BASE_URL = "http://ollama.service.consul:11434" OLLAMA_BASE_URL = "http://ollama.service.consul:11434"
} }
@@ -46,32 +46,30 @@ job "ai-frontend" {
] ]
} }
resources { resources { cpu = 1000; memory = 1024 }
cpu = 1000
memory = 1024
}
} }
} }
# --- LobeChat --- # --- LobeChat (UPDATED) ---
group "lobechat" { group "lobechat" {
count = 1 count = 1
# PIN TO HP1
constraint { constraint {
attribute = "${attr.unique.hostname}" attribute = "${attr.unique.hostname}"
value = "hp1-home" value = "hp-mini-1"
} }
network { network {
port "http" { to = 3210 } port "http" {
static = 3210
to = 3210
}
} }
service { service {
name = "lobechat" name = "lobechat"
port = "http" port = "http"
tags = ["traefik.enable=true"] tags = ["traefik.enable=true"]
check { check {
type = "http" type = "http"
path = "/api/health" path = "/api/health"
@@ -95,7 +93,9 @@ job "ai-frontend" {
resources { resources {
cpu = 500 cpu = 500
memory = 512 # --- THE FIX ---
# Increased from 512 to 1024 to prevent OOM crashes
memory = 1024
} }
} }
} }