Files
ti/citti.nomad
Henrik Jess Nielsen 06656ffd4f fix(deploy): reuse blaaai Consul key so citti gets a Claude key
Prod container had no ANTHROPIC_API_KEY (refresh returned 0/0 instantly;
homepage showed only the 9 heuristic matches), so offers stayed German.
The template read citti/anthropic_api_key, a path never set. Fall back to
the existing blaaai Consul key via or(), reusing BlaaAi's key with no new
secret to provision.
2026-10-30 11:28:19 +01:00

120 lines
2.5 KiB
HCL

variable "image_tag" {
type = string
default = "latest"
}
job "citti" {
region = "global"
datacenters = ["dc1"]
type = "service"
update {
stagger = "30s"
max_parallel = 1
canary = 1
min_healthy_time = "10s"
healthy_deadline = "5m"
auto_revert = true
auto_promote = true
progress_deadline = "10m"
}
group "app" {
count = 1
constraint {
attribute = "${node.unique.name}"
value = "int"
}
network {
port "http" {}
}
reschedule {
attempts = 5
interval = "10m"
delay = "30s"
delay_function = "exponential"
max_delay = "120s"
unlimited = false
}
ephemeral_disk {
size = 500
sticky = true
migrate = true
}
service {
provider = "consul"
name = "citti"
port = "http"
tags = [
"traefik.enable=true",
"traefik.http.routers.citti.rule=Host(`citti.i80.dk`)",
"traefik.http.routers.citti.tls=true",
]
canary_tags = [
"traefik.enable=false",
]
check {
name = "http_health_check"
type = "http"
path = "/health"
interval = "10s"
timeout = "5s"
check_restart {
limit = 3
grace = "10s"
}
}
}
task "web" {
driver = "docker"
config {
image = "registry.i80.dk/gitea/citti:${var.image_tag}"
ports = ["http"]
force_pull = true
}
restart {
attempts = 10
interval = "10m"
delay = "10s"
mode = "fail"
}
env {
DATA_DIR = "${NOMAD_ALLOC_DIR}/data"
PORT = "${NOMAD_PORT_http}"
HOST = "0.0.0.0"
}
# Claude key for DA translation + AI offer matching (same account as
# BlaaAi). Use citti's own Consul key if set, else fall back to the
# existing blaaai/anthropic_api_key. `or` keeps it empty (not a deploy
# failure) if neither exists — offers then stay German with heuristic
# matching.
template {
data = <<EOT
ANTHROPIC_API_KEY={{ or (keyOrDefault "citti/anthropic_api_key" "") (keyOrDefault "blaaai/anthropic_api_key" "") }}
EOT
destination = "secrets/app.env"
env = true
}
resources {
cpu = 200
memory = 256
}
}
}
}