fix(web-svc-mirror): register the vhost with lua-resty-prometheus

A role that overrides templates/proxy.conf.j2 replaces the shared flavour
wholesale, and the monitoring block lives inside the file being replaced.
Both flavours carry it, so every vhost rendered from them reports metrics
labelled with its app; this one wrote its own file in May and has reported
nothing since. The scrape check noticed because the role declares
services.prometheus and is therefore expected to answer for itself:
"/metricz must contain metrics labeled app=web-svc-mirror".

The lookup offers scrape: false for exactly this complaint, and it would
be the wrong answer here. That opt-out belongs to redirect-only and static
vhosts that never serve a request through lua-resty-prometheus. The mirror
proxies the third-party assets of every deployed application, so it serves
real traffic and belongs in the scrape set. web-app-openbao and
web-app-postmarks include the same snippet in their own overrides.

Unlike those two the mirror runs no container of its own, so the block
renders an empty container name. The health check reads that as "no
container known" and falls back to the HTTP probe, which is the intended
path rather than an accident. The three healthz locations are exact
matches and cannot shadow the prefix locations this vhost already
defines, and the metrics collector is a server-level log_by_lua_block
that adds no location at all.

Nine other roles override the vhost while declaring services.prometheus.
Some are the containers' own nginx configs, where this block does not
belong, so they want reading one at a time rather than the same edit. The
lint that should have caught all of them skips any override whose role
does not serve MCP, which is why none of this was reported.

Not yet rendered: the deploy that would prove the template resolves and
openresty accepts it has not run.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5 committed 2026-09-27 23:59:10 +02:00
1 parent 78b2772679
commit b64e4a0558
1 file changed
+2
@@ -39,4 +39,6 @@ server
{
return 404;
}
{% include 'roles/web-app-prometheus/templates/nginx/locations.conf.j2' %}
}