autobox has ~580 MHz free; cpu=1000 could not be placed during rolling replacement. CPU reservation is a scheduling floor (procs still burst on idle cores), so 500 is enough for the batch scoring work. Memory stays at 1024.
129 lines
2.9 KiB
HCL
129 lines
2.9 KiB
HCL
job "blaaai" {
|
|
region = "global"
|
|
datacenters = ["dc1"]
|
|
type = "service"
|
|
|
|
meta {
|
|
uuid = uuidv4()
|
|
}
|
|
|
|
update {
|
|
stagger = "30s"
|
|
max_parallel = 1
|
|
auto_revert = true
|
|
progress_deadline = "25m"
|
|
}
|
|
|
|
group "blaaai-group" {
|
|
count = 1
|
|
|
|
constraint {
|
|
attribute = "${node.unique.name}"
|
|
value = "autobox.i80.dk"
|
|
}
|
|
|
|
update {
|
|
canary = 1
|
|
auto_promote = true
|
|
min_healthy_time = "15s"
|
|
healthy_deadline = "20m"
|
|
progress_deadline = "25m"
|
|
auto_revert = true
|
|
}
|
|
|
|
network {
|
|
port "http" {}
|
|
}
|
|
|
|
reschedule {
|
|
attempts = 5
|
|
interval = "10m"
|
|
delay = "30s"
|
|
delay_function = "exponential"
|
|
max_delay = "120s"
|
|
unlimited = false
|
|
}
|
|
|
|
volume "blaaai-data" {
|
|
type = "host"
|
|
source = "blaaai-data"
|
|
read_only = false
|
|
}
|
|
|
|
service {
|
|
provider = "consul"
|
|
name = "blaaai"
|
|
port = "http"
|
|
|
|
tags = [
|
|
"traefik.enable=true",
|
|
"traefik.http.routers.blaaai.rule=Host(`blaaai.i80.dk`)",
|
|
"traefik.http.routers.blaaai.tls=true",
|
|
]
|
|
|
|
canary_tags = [
|
|
"traefik.enable=false",
|
|
]
|
|
|
|
check {
|
|
name = "http_health_check"
|
|
type = "http"
|
|
port = "http"
|
|
path = "/health"
|
|
interval = "10s"
|
|
timeout = "5s"
|
|
}
|
|
}
|
|
|
|
task "blaaai-task" {
|
|
driver = "docker"
|
|
|
|
config {
|
|
image = "registry.i80.dk/gitea/blaaai:latest"
|
|
ports = ["http"]
|
|
force_pull = true
|
|
auth {
|
|
username = "robot$gitserver"
|
|
password = "${HARBOR_ROBOT_TOKEN}"
|
|
}
|
|
}
|
|
|
|
volume_mount {
|
|
volume = "blaaai-data"
|
|
destination = "/app/data"
|
|
read_only = false
|
|
}
|
|
|
|
restart {
|
|
attempts = 10
|
|
interval = "10m"
|
|
delay = "15s"
|
|
mode = "fail"
|
|
}
|
|
|
|
env {
|
|
PORT = "${NOMAD_PORT_http}"
|
|
BLAAAI_BACKEND = "cli" # score via the claude CLI (subscription), not API billing
|
|
BLAAAI_MAX_WORKERS = "2" # heavy Node procs — keep low within the memory budget
|
|
}
|
|
|
|
template {
|
|
data = <<EOT
|
|
# Subscription auth for the claude CLI (generate with `claude setup-token`)
|
|
CLAUDE_CODE_OAUTH_TOKEN={{ key "blaaai/claude_auth_token" }}
|
|
# Kept for BLAAAI_BACKEND=api fallback
|
|
ANTHROPIC_API_KEY={{ key "blaaai/anthropic_api_key" }}
|
|
HARBOR_ROBOT_TOKEN={{ key "blaaai/harbor_robot_token" }}
|
|
EOT
|
|
destination = "secrets/app.env"
|
|
env = true
|
|
}
|
|
|
|
resources {
|
|
cpu = 500 # autobox CPU is nearly full; reservation is a floor, procs still burst
|
|
memory = 1024 # claude CLI (Node) + chromium need more headroom than the API client
|
|
}
|
|
}
|
|
}
|
|
}
|