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

@@ -17,8 +17,9 @@ logger = logging.getLogger(__name__)
# Catalog is baked into the image root at /bicep_modules_catalog.json
_CATALOG_PATHS = [
pathlib.Path("/bicep_modules_catalog.json"),
pathlib.Path(__file__).parent.parent.parent / "bicep_modules_catalog.json",
pathlib.Path("/data/bicep_modules_catalog.json"), # volume-mount (freshest)
pathlib.Path("/bicep_modules_catalog.json"), # baked into image (fallback)
pathlib.Path(__file__).parent.parent.parent / "bicep_modules_catalog.json", # dev
]

View File

@@ -49,7 +49,20 @@ async def _health_app() -> web.Application:
"bicep_modules": len(BicepModuleCatalog._modules),
})
async def reload(_: web.Request) -> web.Response:
"""Hot-reload catalogs from /data/ volume without restarting."""
before = len(BicepModuleCatalog._modules)
BicepModuleCatalog.load()
after = len(BicepModuleCatalog._modules)
logger.info("Catalog reloaded: %d%d modules", before, after)
return web.json_response({
"status": "reloaded",
"bicep_modules_before": before,
"bicep_modules_after": after,
})
app.router.add_get("/health", health)
app.router.add_post("/reload", reload)
return app