feat: volume-based catalog refresh with hot-reload
Some checks failed
Build and Deploy iLSP / test (push) Successful in 18s
Build and Deploy iLSP / build-and-deploy (push) Failing after 12m14s

- 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
This commit is contained in:
Henrik Jess Nielsen
2026-05-10 13:51:01 +02:00
parent 6b38cbd70c
commit 0527df717c
5 changed files with 112 additions and 6 deletions

View File

@@ -6,8 +6,8 @@ PYTHON_PORT := 2087
BICEP_PORT := 2088
HEALTH_PORT := 2089
# External services (used at container startup for catalog fetching)
DEVOPS_MCP_URL ?= https://devops-mcp.i80.dk
# DevOpsMCP repo — source of fresh catalog JSON files
DEVOPS_MCP_REPO ?= $(HOME)/Projects/DevOpsMCP
.PHONY: build run stop restart logs shell test smoke clean help
@@ -43,12 +43,24 @@ run-quick: ## Start container without rebuilding image
-p $(PYTHON_PORT):$(PYTHON_PORT) \
-p $(BICEP_PORT):$(BICEP_PORT) \
-p $(HEALTH_PORT):$(HEALTH_PORT) \
-e DEVOPS_MCP_URL=$(DEVOPS_MCP_URL) \
-e PYTHONUNBUFFERED=1 \
$(IMAGE):$(TAG)
@sleep 5
@$(MAKE) health
run-with-data: ## Start container with local data dir mounted (test volume path)
$(MAKE) stop
docker run -d \
--name $(CONTAINER) \
-p $(PYTHON_PORT):$(PYTHON_PORT) \
-p $(BICEP_PORT):$(BICEP_PORT) \
-p $(HEALTH_PORT):$(HEALTH_PORT) \
-e PYTHONUNBUFFERED=1 \
-v "$(DEVOPS_MCP_REPO):/data:ro" \
$(IMAGE):$(TAG)
@sleep 5
@$(MAKE) health
stop: ## Stop and remove container (if running)
-docker stop $(CONTAINER) 2>/dev/null
-docker rm $(CONTAINER) 2>/dev/null
@@ -66,10 +78,17 @@ shell: ## Open bash inside running container
## ── Health & Testing ─────────────────────────────────────────────────────────
health: ## Check health endpoint
health: ## Check health endpoint (local container)
@curl -sf http://localhost:$(HEALTH_PORT)/health | python3 -m json.tool \
|| echo " ✗ Health endpoint not reachable — is the container running? (make run)"
health-prod: ## Check health endpoint (production lsp.i80.dk)
@curl -sf https://lsp.i80.dk/health | python3 -m json.tool \
|| echo " ✗ lsp.i80.dk not reachable"
push-catalogs: ## Push fresh Bicep catalogs to autobox + hot-reload iLSP
bash scripts/push_catalogs.sh
smoke: ## Run end-to-end smoke test against local container
bash scripts/smoke_test.sh localhost