Files
iLSP/ilsp.nomad

132 lines
3.0 KiB
Plaintext
Raw Permalink Normal View History

2026-05-10 12:16:38 +02:00
variable "service_name" {
description = "Service name"
2026-05-10 12:16:38 +02:00
type = string
default = "ilsp"
}
variable "image_tag" {
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 {
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 {
canary = 1
auto_promote = true
min_healthy_time = "15s"
healthy_deadline = "20m"
2026-05-10 12:16:38 +02:00
progress_deadline = "25m"
auto_revert = true
2026-05-10 12:16:38 +02:00
}
# Single dynamic port — Traefik routes ilsp.i80.dk → this port.
# Editors connect via WebSocket: ws://ilsp.i80.dk/python ws://ilsp.i80.dk/bicep
# LSP servers (pylsp, Bicep LS) run on localhost inside the container only.
2026-05-10 12:16:38 +02:00
network {
port "http" {}
2026-05-10 12:16:38 +02:00
}
reschedule {
attempts = 5
interval = "10m"
delay = "30s"
delay_function = "exponential"
max_delay = "120s"
unlimited = false
}
# 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
port = "http"
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 {
name = "health_http"
2026-05-10 12:16:38 +02:00
type = "http"
port = "http"
2026-05-10 12:16:38 +02:00
path = "/health"
interval = "15s"
2026-05-10 12:16:38 +02:00
timeout = "5s"
}
}
task "ilsp-task" {
driver = "docker"
config {
image = "registry.i80.dk/gitea/ilsp:${var.image_tag}"
ports = ["http"]
2026-05-10 12:16:38 +02:00
force_pull = true
auth {
username = "robot$gitserver"
password = "${HARBOR_ROBOT_TOKEN}"
}
}
restart {
attempts = 5
2026-05-10 12:16:38 +02:00
interval = "10m"
delay = "30s"
2026-05-10 12:16:38 +02:00
mode = "fail"
}
env {
HTTP_PORT = "${NOMAD_PORT_http}"
PYTHON_LSP_PORT = "2087"
BICEP_LSP_PORT = "2088"
YAML_LSP_PORT = "2090"
DEVOPS_MCP_URL = "https://devops-mcp.i80.dk"
2026-05-10 12:16:38 +02:00
PYTHONUNBUFFERED = "1"
}
# 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"
env = true
2026-05-10 12:16:38 +02:00
}
resources {
# 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
}
}
}
}