refactor: single HTTP port, WebSocket proxy for LSP endpoints
- Remove static ports 2087/2088/2089 from Nomad; use one dynamic port - pylsp and Bicep LS stay on localhost inside container (not exposed) - aiohttp adds /python and /bicep WebSocket routes bridging to localhost LSPs - Nomad env: HTTP_PORT=$NOMAD_PORT_http, internal ports fixed at 2087/2088 - Editors connect via ws://ilsp.i80.dk/python and ws://ilsp.i80.dk/bicep - Traefik routes ilsp.i80.dk → single dynamic HTTP port
This commit is contained in:
22
ilsp.nomad
22
ilsp.nomad
@@ -44,13 +44,11 @@ job "ilsp" {
|
||||
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
|
||||
# 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.
|
||||
network {
|
||||
port "python_lsp" { static = 2087 }
|
||||
port "bicep_lsp" { static = 2088 }
|
||||
port "health" { static = 2089 }
|
||||
port "http" {}
|
||||
}
|
||||
|
||||
reschedule {
|
||||
@@ -66,7 +64,7 @@ job "ilsp" {
|
||||
service {
|
||||
provider = "consul"
|
||||
name = var.service_name
|
||||
port = "health"
|
||||
port = "http"
|
||||
|
||||
tags = [
|
||||
"traefik.enable=true",
|
||||
@@ -77,7 +75,7 @@ job "ilsp" {
|
||||
check {
|
||||
name = "health_http"
|
||||
type = "http"
|
||||
port = "health"
|
||||
port = "http"
|
||||
path = "/health"
|
||||
interval = "15s"
|
||||
timeout = "5s"
|
||||
@@ -89,7 +87,7 @@ job "ilsp" {
|
||||
|
||||
config {
|
||||
image = "registry.i80.dk/gitea/ilsp:${var.image_tag}"
|
||||
ports = ["python_lsp", "bicep_lsp", "health"]
|
||||
ports = ["http"]
|
||||
force_pull = true
|
||||
auth {
|
||||
username = "robot$gitserver"
|
||||
@@ -105,9 +103,9 @@ job "ilsp" {
|
||||
}
|
||||
|
||||
env {
|
||||
PYTHON_LSP_PORT = "${NOMAD_PORT_python_lsp}"
|
||||
BICEP_LSP_PORT = "${NOMAD_PORT_bicep_lsp}"
|
||||
HEALTH_PORT = "${NOMAD_PORT_health}"
|
||||
HTTP_PORT = "${NOMAD_PORT_http}"
|
||||
PYTHON_LSP_PORT = "2087"
|
||||
BICEP_LSP_PORT = "2088"
|
||||
DEVOPS_MCP_URL = "https://devops-mcp.i80.dk"
|
||||
PYTHONUNBUFFERED = "1"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user