Files
iLSP/ilsp.nomad
Henrik Jess Nielsen 0527df717c
Some checks failed
Build and Deploy iLSP / test (push) Successful in 18s
Build and Deploy iLSP / build-and-deploy (push) Failing after 12m14s
feat: volume-based catalog refresh with hot-reload
- modules.py: check /data/ volume first, then baked-in /bicep_modules_catalog.json
- server.py: add POST /reload endpoint — reloads catalogs without restart
- ilsp.nomad: add 'ilsp-data' host volume mounted at /data
- Makefile: add push-catalogs, health-prod, run-with-data targets; DEVOPS_MCP_REPO var
- scripts/push_catalogs.sh: SCP both catalogs to autobox + call /reload

Workflow: sync scripts on Mac → make push-catalogs → completions live in <5s
2026-05-10 13:51:01 +02:00

145 lines
3.3 KiB
HCL

variable "service_name" {
description = "Service name"
type = string
default = "ilsp"
}
variable "image_tag" {
description = "Docker image tag — override in CI: -var=\"image_tag=$SHA\""
type = string
default = "latest"
}
job "ilsp" {
region = "global"
datacenters = ["dc1"]
type = "service"
meta {
uuid = uuidv4()
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"
progress_deadline = "25m"
auto_revert = true
}
# 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
network {
port "python_lsp" { static = 2087 }
port "bicep_lsp" { static = 2088 }
port "health" { static = 2089 }
}
reschedule {
attempts = 5
interval = "10m"
delay = "30s"
delay_function = "exponential"
max_delay = "120s"
unlimited = false
}
volume "ilsp-data" {
type = "host"
source = "ilsp-data"
read_only = false
}
# Health check only — Traefik not used for LSP TCP traffic
service {
provider = "consul"
name = var.service_name
port = "health"
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"
type = "http"
port = "health"
path = "/health"
interval = "15s"
timeout = "5s"
}
}
task "ilsp-task" {
driver = "docker"
config {
image = "registry.i80.dk/gitea/ilsp:${var.image_tag}"
ports = ["python_lsp", "bicep_lsp", "health"]
force_pull = true
auth {
username = "robot$gitserver"
password = "${HARBOR_ROBOT_TOKEN}"
}
}
restart {
attempts = 5
interval = "10m"
delay = "30s"
mode = "fail"
}
env {
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"
PYTHONUNBUFFERED = "1"
}
# Secrets from Consul KV
template {
data = <<EOH
HARBOR_ROBOT_TOKEN="{{ key "harbor/robot/token" }}"
EOH
destination = "secrets/registry.env"
env = true
}
resources {
# dotnet runtime (Bicep LS) + pylsp both in one container
cpu = 1000 # MHz
memory = 1536 # MB — dotnet needs headroom
memory_max = 2560 # MB burst
}
volume_mount {
volume = "ilsp-data"
destination = "/data"
read_only = false
}
}
}
}