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
This commit is contained in:
@@ -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
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user