2026-05-09 18:06:18 +02:00
|
|
|
variable "service_name" {
|
|
|
|
|
description = "Service name for consistent naming"
|
|
|
|
|
type = string
|
|
|
|
|
default = "devops-dash"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
variable "image_tag" {
|
|
|
|
|
description = "Docker image tag to deploy"
|
|
|
|
|
type = string
|
|
|
|
|
default = "latest"
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-09 16:36:18 +02:00
|
|
|
job "devops-dash" {
|
|
|
|
|
datacenters = ["dc1"]
|
|
|
|
|
type = "service"
|
|
|
|
|
|
2026-05-09 18:06:18 +02:00
|
|
|
meta {
|
|
|
|
|
uuid = uuidv4()
|
|
|
|
|
service_name = var.service_name
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
update {
|
|
|
|
|
stagger = "30s"
|
|
|
|
|
max_parallel = 1
|
|
|
|
|
auto_revert = true
|
|
|
|
|
progress_deadline = "15m"
|
2026-05-09 16:36:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
group "devops-dash" {
|
|
|
|
|
count = 1
|
|
|
|
|
|
2026-05-09 18:06:18 +02:00
|
|
|
constraint {
|
|
|
|
|
attribute = "${node.unique.name}"
|
|
|
|
|
value = "autobox.i80.dk"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
update {
|
|
|
|
|
canary = 1
|
|
|
|
|
auto_promote = true
|
|
|
|
|
min_healthy_time = "15s"
|
|
|
|
|
healthy_deadline = "10m"
|
|
|
|
|
progress_deadline = "15m"
|
|
|
|
|
auto_revert = true
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-09 16:36:18 +02:00
|
|
|
network {
|
|
|
|
|
port "http" {}
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-09 18:06:18 +02:00
|
|
|
reschedule {
|
|
|
|
|
attempts = 5
|
|
|
|
|
interval = "10m"
|
|
|
|
|
delay = "30s"
|
|
|
|
|
delay_function = "exponential"
|
|
|
|
|
max_delay = "120s"
|
|
|
|
|
unlimited = false
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-09 16:48:06 +02:00
|
|
|
# host volume disabled until autobox is configured.
|
|
|
|
|
# To enable: add to /etc/nomad.d/client.hcl on autobox:
|
|
|
|
|
# host_volume "devops-mcp-data" {
|
|
|
|
|
# path = "/opt/devops-mcp/data"
|
|
|
|
|
# read_only = false
|
|
|
|
|
# }
|
|
|
|
|
# Then: mkdir -p /opt/devops-mcp/data && systemctl restart nomad
|
|
|
|
|
#
|
|
|
|
|
# volume "devops-mcp-data" {
|
|
|
|
|
# type = "host"
|
|
|
|
|
# read_only = true
|
|
|
|
|
# source = "devops-mcp-data"
|
|
|
|
|
# }
|
2026-05-09 16:36:18 +02:00
|
|
|
|
2026-05-09 18:06:18 +02:00
|
|
|
service {
|
|
|
|
|
provider = "consul"
|
|
|
|
|
name = var.service_name
|
|
|
|
|
port = "http"
|
|
|
|
|
|
|
|
|
|
tags = [
|
|
|
|
|
"traefik.enable=true",
|
|
|
|
|
"traefik.http.routers.${var.service_name}.rule=Host(`dash.i80.dk`)",
|
|
|
|
|
"traefik.http.routers.${var.service_name}.tls=true",
|
|
|
|
|
"traefik.http.middlewares.${var.service_name}-limit.ratelimit.burst=20",
|
|
|
|
|
"traefik.http.middlewares.${var.service_name}-limit.ratelimit.period=1m",
|
|
|
|
|
"traefik.http.routers.${var.service_name}.middlewares=${var.service_name}-limit"
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
check {
|
|
|
|
|
name = "http_health_check"
|
|
|
|
|
type = "http"
|
|
|
|
|
port = "http"
|
|
|
|
|
path = "/health"
|
|
|
|
|
interval = "10s"
|
|
|
|
|
timeout = "5s"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-09 16:36:18 +02:00
|
|
|
task "devops-dash" {
|
|
|
|
|
driver = "docker"
|
|
|
|
|
|
2026-05-09 16:48:06 +02:00
|
|
|
# volume_mount {
|
|
|
|
|
# volume = "devops-mcp-data"
|
|
|
|
|
# destination = "/data"
|
|
|
|
|
# read_only = true
|
|
|
|
|
# }
|
2026-05-09 16:36:18 +02:00
|
|
|
|
|
|
|
|
config {
|
2026-05-09 18:06:18 +02:00
|
|
|
image = "registry.i80.dk/gitea/devops-dash:${var.image_tag}"
|
2026-05-09 16:48:06 +02:00
|
|
|
ports = ["http"]
|
|
|
|
|
force_pull = true
|
2026-05-09 16:36:18 +02:00
|
|
|
|
|
|
|
|
auth {
|
2026-05-09 16:48:06 +02:00
|
|
|
username = "robot$gitserver"
|
|
|
|
|
password = "${HARBOR_ROBOT_TOKEN}"
|
2026-05-09 16:36:18 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template {
|
2026-05-09 16:48:06 +02:00
|
|
|
data = <<EOH
|
|
|
|
|
HARBOR_ROBOT_TOKEN="{{ key "harbor/robot/token" }}"
|
|
|
|
|
EOH
|
|
|
|
|
destination = "secrets/registry.env"
|
2026-05-09 16:36:18 +02:00
|
|
|
env = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
env {
|
2026-05-09 18:06:18 +02:00
|
|
|
PORT = "${NOMAD_PORT_http}"
|
|
|
|
|
HOST = "0.0.0.0"
|
|
|
|
|
REDIS_URL = "redis://192.168.15.124:6379"
|
|
|
|
|
DEVOPS_MCP_URL = "https://devops-mcp.i80.dk"
|
|
|
|
|
DATA_DIR = "/data"
|
2026-05-09 16:48:06 +02:00
|
|
|
PYTHONUNBUFFERED = "1"
|
2026-05-09 16:36:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resources {
|
2026-05-09 16:48:06 +02:00
|
|
|
cpu = 200
|
|
|
|
|
memory = 256
|
2026-05-09 16:36:18 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|