Files
computer-playbook/roles/svc-db-qdrant/templates/compose.yml.j2
kevinveenbirkenbachandClaude Opus 5 d0a8608bfa perf(healthcheck): give every probe the start cadence 42ebd9ea71 added
42ebd9ea71 gave the healthcheck SPOT start_interval, the cadence docker uses
while start_period is still running. A block a template writes out itself
bypasses the SPOT and never gained it. Measured across the repository: 46 such
blocks, 40 of them already carrying start_period, not one carrying
start_interval.

Without it a probe fires only every interval, so a service ready after two
seconds is reported healthy at the next tick and a stack converges no faster
than its coarsest quantisation. That lands in sys-svc-compose's swarm converge
wait, 1551.7s per CI job over 38 stack deploys.

Twenty five of the blocks move into meta/services.yml and render through
container_healthcheck. Each keeps an explicit test rather than picking a flavor:
a flavor would replace the command instead of carrying it across.

The move is lossless by construction. probes.py block() writes
overrides.get(key, default) for interval, timeout, retries, start_period and
start_interval, so a declaration repeating the literal values renders the same
block plus the missing cadence. Checked per block against the old values: the
only difference is start_interval 5s, nothing changed, nothing lost.

Twenty one stay literal. Seventeen interpolate a template variable, whose value
resolves in a scope meta/services.yml does not share, so moving them would be a
rewrite rather than a transcription. Four interpolate nothing and still cannot
move: svc-db-memcached and svc-db-redis probe every second in their swarm
service partial, where a 5s start cadence would report healthy later than the
block already does, and the sys-svc-rdbms and keycloak sso_proxy partials render
for the consuming role's application_id, so their declaration has no single
meta/services.yml to live in. Each carries a nocheck naming its reason.

All twenty one gain start_interval. Three also gain start_period, without which
the key does nothing at all, since it only applies while the start period runs.
That widens their failure tolerance rather than narrowing it: bluesky from 90 to
120 seconds, magento from 50 to 80, the mariadb partial from 180 to 210.

pixelfed spelled its probe as a bare string and now spells it CMD-SHELL. Docker
reads both as a shell command; only the YAML shape changes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-09 20:31:07 +02:00

47 lines
2.0 KiB
Django/Jinja

{% include 'roles/sys-svc-compose/templates/base.yml.j2' %}
{% set service_name = 'qdrant' %}
{{ service_name }}:
{{ lookup('compose_only', 'container_name', QDRANT_CONTAINER) }}
{{ lookup('container_image', application_id, 'qdrant') }}
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
{% if QDRANT_EXPOSE_LOCAL %}
{{ lookup('container_ports', ['qdrant', 'qdrant', DOCKER_BIND_HOST]) | indent(4) }}
{% endif %}
{{ lookup('container_volumes', service_name) | indent(4) }}
{{ lookup('container_networks') | indent(4) }}
{{ lookup('container_healthcheck', service_name) | indent(4) }}
{% if QDRANT_MCP_ENABLED | bool %}
{% set service_name = QDRANT_MCP_SERVICE_KEY %}
{{ service_name }}:
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
{{ lookup('container_image', application_id, 'qdrantmcp') }}
build:
context: {{ QDRANT_MCP_INSTANCE_DIR }}
dockerfile: Dockerfile
args:
MCP_ADAPTER_BASE_IMAGE: {{ lookup('config', application_id, 'services.qdrantmcp.image') }}
MCP_ADAPTER_BASE_VERSION: "{{ lookup('config', application_id, 'services.qdrantmcp.version') }}"
{{ lookup('compose_only', 'container_name', QDRANT_MCP_CONTAINER) }}
read_only: true
cap_drop:
- ALL
security_opt:
- no-new-privileges:true
environment:
ADAPTER_CONTRACT: {{ QDRANT_MCP_CONTRACT | to_json | to_json | replace('$', '$$') }}
ADAPTER_BEARER: {{ QDRANT_MCP_BEARER | to_json }}
ADAPTER_PORT: "{{ QDRANT_MCP_PORT }}"
ADAPTER_UPSTREAM_AUTH_FORMAT: "{key}"
ADAPTER_UPSTREAM_AUTH_HEADER: api-key
ADAPTER_UPSTREAM_KEY: {{ QDRANT_MCP_UPSTREAM_KEY | to_json }}
expose:
- "{{ QDRANT_MCP_PORT }}"
{{ lookup('container_networks', own_network_only=True, provider_self_alias=False) | indent(4) }}
{{ lookup('depends_on', {'qdrant': 'service_healthy'}) }}
{% endif %}
{{ lookup('compose_volumes') }}
{{ lookup('compose_networks') }}