2026-05-10 12:16:38 +02:00
|
|
|
variable "service_name" {
|
2026-05-10 12:23:05 +02:00
|
|
|
description = "Service name"
|
2026-05-10 12:16:38 +02:00
|
|
|
type = string
|
|
|
|
|
default = "ilsp"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
variable "image_tag" {
|
2026-05-10 12:23:05 +02:00
|
|
|
description = "Docker image tag — override in CI: -var=\"image_tag=$SHA\""
|
2026-05-10 12:16:38 +02:00
|
|
|
type = string
|
|
|
|
|
default = "latest"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
job "ilsp" {
|
|
|
|
|
region = "global"
|
|
|
|
|
datacenters = ["dc1"]
|
|
|
|
|
type = "service"
|
|
|
|
|
|
|
|
|
|
meta {
|
2026-05-10 12:23:05 +02:00
|
|
|
uuid = uuidv4()
|
2026-05-10 12:16:38 +02:00
|
|
|
deployed_at = "[[ timeNowUTC ]]"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
update {
|
|
|
|
|
stagger = "30s"
|
|
|
|
|
max_parallel = 1
|
|
|
|
|
auto_revert = true
|
|
|
|
|
progress_deadline = "25m"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
group "ilsp-group" {
|
|
|
|
|
count = 1
|
|
|
|
|
|
|
|
|
|
constraint {
|
|
|
|
|
attribute = "${node.unique.name}"
|
|
|
|
|
value = "autobox.i80.dk"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
update {
|
2026-05-10 12:23:05 +02:00
|
|
|
canary = 1
|
|
|
|
|
auto_promote = true
|
|
|
|
|
min_healthy_time = "15s"
|
|
|
|
|
healthy_deadline = "20m"
|
2026-05-10 12:16:38 +02:00
|
|
|
progress_deadline = "25m"
|
2026-05-10 12:23:05 +02:00
|
|
|
auto_revert = true
|
2026-05-10 12:16:38 +02:00
|
|
|
}
|
|
|
|
|
|
2026-05-10 12:23:05 +02:00
|
|
|
# Static ports: LSP uses raw TCP — Traefik isn't involved for 2087/2088.
|
|
|
|
|
# DNS: lsp.i80.dk → autobox.i80.dk (A record)
|
|
|
|
|
# Editors connect directly: nc lsp.i80.dk 2087 / nc lsp.i80.dk 2088
|
2026-05-10 12:16:38 +02:00
|
|
|
network {
|
2026-05-10 12:23:05 +02:00
|
|
|
port "python_lsp" { static = 2087 }
|
|
|
|
|
port "bicep_lsp" { static = 2088 }
|
|
|
|
|
port "health" { static = 2089 }
|
2026-05-10 12:16:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reschedule {
|
|
|
|
|
attempts = 5
|
|
|
|
|
interval = "10m"
|
|
|
|
|
delay = "30s"
|
|
|
|
|
delay_function = "exponential"
|
|
|
|
|
max_delay = "120s"
|
|
|
|
|
unlimited = false
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-10 13:51:01 +02:00
|
|
|
volume "ilsp-data" {
|
|
|
|
|
type = "host"
|
|
|
|
|
source = "ilsp-data"
|
|
|
|
|
read_only = false
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-10 12:23:05 +02:00
|
|
|
# Health check only — Traefik not used for LSP TCP traffic
|
2026-05-10 12:16:38 +02:00
|
|
|
service {
|
|
|
|
|
provider = "consul"
|
|
|
|
|
name = var.service_name
|
2026-05-10 12:23:05 +02:00
|
|
|
port = "health"
|
2026-05-10 12:16:38 +02:00
|
|
|
|
|
|
|
|
tags = [
|
|
|
|
|
"traefik.enable=true",
|
|
|
|
|
"traefik.http.routers.${var.service_name}.rule=Host(`${var.service_name}.i80.dk`)",
|
|
|
|
|
"traefik.http.routers.${var.service_name}.tls=true",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
check {
|
2026-05-10 12:23:05 +02:00
|
|
|
name = "health_http"
|
2026-05-10 12:16:38 +02:00
|
|
|
type = "http"
|
2026-05-10 12:23:05 +02:00
|
|
|
port = "health"
|
2026-05-10 12:16:38 +02:00
|
|
|
path = "/health"
|
2026-05-10 12:23:05 +02:00
|
|
|
interval = "15s"
|
2026-05-10 12:16:38 +02:00
|
|
|
timeout = "5s"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
task "ilsp-task" {
|
|
|
|
|
driver = "docker"
|
|
|
|
|
|
|
|
|
|
config {
|
2026-05-10 12:23:05 +02:00
|
|
|
image = "registry.i80.dk/gitea/ilsp:${var.image_tag}"
|
|
|
|
|
ports = ["python_lsp", "bicep_lsp", "health"]
|
2026-05-10 12:16:38 +02:00
|
|
|
force_pull = true
|
|
|
|
|
auth {
|
|
|
|
|
username = "robot$gitserver"
|
|
|
|
|
password = "${HARBOR_ROBOT_TOKEN}"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
restart {
|
2026-05-10 12:23:05 +02:00
|
|
|
attempts = 5
|
2026-05-10 12:16:38 +02:00
|
|
|
interval = "10m"
|
2026-05-10 12:23:05 +02:00
|
|
|
delay = "30s"
|
2026-05-10 12:16:38 +02:00
|
|
|
mode = "fail"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
env {
|
2026-05-10 12:23:05 +02:00
|
|
|
PYTHON_LSP_PORT = "${NOMAD_PORT_python_lsp}"
|
|
|
|
|
BICEP_LSP_PORT = "${NOMAD_PORT_bicep_lsp}"
|
|
|
|
|
HEALTH_PORT = "${NOMAD_PORT_health}"
|
|
|
|
|
DEVOPS_MCP_URL = "https://devops-mcp.i80.dk"
|
2026-05-10 12:16:38 +02:00
|
|
|
PYTHONUNBUFFERED = "1"
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-10 12:23:05 +02:00
|
|
|
# Secrets from Consul KV
|
2026-05-10 12:16:38 +02:00
|
|
|
template {
|
|
|
|
|
data = <<EOH
|
|
|
|
|
HARBOR_ROBOT_TOKEN="{{ key "harbor/robot/token" }}"
|
|
|
|
|
EOH
|
|
|
|
|
destination = "secrets/registry.env"
|
2026-05-10 12:23:05 +02:00
|
|
|
env = true
|
2026-05-10 12:16:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resources {
|
2026-05-10 12:23:05 +02:00
|
|
|
# dotnet runtime (Bicep LS) + pylsp both in one container
|
|
|
|
|
cpu = 1000 # MHz
|
|
|
|
|
memory = 1536 # MB — dotnet needs headroom
|
|
|
|
|
memory_max = 2560 # MB burst
|
2026-05-10 12:16:38 +02:00
|
|
|
}
|
2026-05-10 13:51:01 +02:00
|
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
|
volume = "ilsp-data"
|
|
|
|
|
destination = "/data"
|
|
|
|
|
read_only = false
|
|
|
|
|
}
|
2026-05-10 12:16:38 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|