mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
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>
70 lines
3.6 KiB
Django/Jinja
70 lines
3.6 KiB
Django/Jinja
{% include 'roles/sys-svc-compose/templates/base.yml.j2' %}
|
|
|
|
{% set service_name = ESPOCRM_SERVICE %}
|
|
{{ service_name }}:
|
|
{{ lookup('template', 'roles/sys-svc-container/templates/build.yml.j2') | indent(4) }}
|
|
args:
|
|
ESPOCRM_IMAGE: "{{ ESPOCRM_IMAGE }}"
|
|
ESPOCRM_VERSION: "{{ ESPOCRM_VERSION }}"
|
|
ESPOCRM_SCRIPT_SEED_HOST_REL: "{{ ESPOCRM_SCRIPT_SEED_HOST_REL }}"
|
|
ESPOCRM_SCRIPT_SEED_DOCKER: "{{ ESPOCRM_SCRIPT_SEED_DOCKER }}"
|
|
ESPOCRM_SCRIPT_SIDECAR_HOST_REL: "{{ ESPOCRM_SCRIPT_SIDECAR_HOST_REL }}"
|
|
ESPOCRM_SCRIPT_SIDECAR_DOCKER: "{{ ESPOCRM_SCRIPT_SIDECAR_DOCKER }}"
|
|
ESPOCRM_ENTRYPOINT_SCRIPT_HOST_REL: "{{ ESPOCRM_ENTRYPOINT_SCRIPT_HOST_REL }}"
|
|
ESPOCRM_ENTRYPOINT_SCRIPT_DOCKER: "{{ ESPOCRM_ENTRYPOINT_SCRIPT_DOCKER }}"
|
|
ESPOCRM_ENTRYPOINT_SCRIPT_ORIGINAL: "{{ ESPOCRM_ENTRYPOINT_SCRIPT_ORIGINAL }}"
|
|
{{ lookup('compose_only', 'container_name', ESPOCRM_CONTAINER) }}
|
|
{{ lookup('container_image', application_id, 'espocrm') }}
|
|
init: true
|
|
stop_signal: SIGTERM
|
|
stop_grace_period: 30s
|
|
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
|
|
{{ lookup('container_extra_hosts') | indent(4) }}
|
|
{{ lookup('container_healthcheck', service_name) | indent(4) }}
|
|
{{ lookup('container_ports', ['espocrm', 'http', DOCKER_BIND_HOST]) | indent(4) }}
|
|
{{ lookup('container_depends_on', application_id) | indent(4) }}
|
|
{{ lookup('container_networks') | indent(4) }}
|
|
{{ lookup('container_volumes', service_name) | indent(4) }}
|
|
|
|
{% set service_name = 'daemon' %}
|
|
{{ service_name }}:
|
|
{{ lookup('container_image', application_id, 'daemon', version=ESPOCRM_VERSION) }}
|
|
{{ lookup('compose_only', 'container_name', ESPOCRM_CONTAINER ~ '_' ~ service_name) }}
|
|
{{ lookup('compose_only', 'pull_policy', 'never') }}
|
|
init: true
|
|
stop_signal: SIGTERM
|
|
stop_grace_period: 30s
|
|
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
|
|
entrypoint: ["{{ ESPOCRM_ENTRYPOINT_SCRIPT_DOCKER }}", "--wait-ready", "{{ ESPOCRM_SCRIPT_SIDECAR_DOCKER }}", "daemon.php"]
|
|
{{ lookup('container_networks') | indent(4) }}
|
|
{{ lookup('container_volumes', service_name) | indent(4) }}
|
|
{{ lookup('container_depends_on', application_id, extra={
|
|
ESPOCRM_SERVICE: {'condition': 'service_healthy'},
|
|
}) | indent(4) }}
|
|
{{ lookup('container_healthcheck', service_name) | indent(4) }}
|
|
|
|
{% set service_name = 'websocket' %}
|
|
{{ service_name }}:
|
|
{{ lookup('container_image', application_id, 'websocket', version=ESPOCRM_VERSION) }}
|
|
{{ lookup('compose_only', 'container_name', ESPOCRM_CONTAINER ~ '_' ~ service_name) }}
|
|
{{ lookup('compose_only', 'pull_policy', 'never') }}
|
|
init: true
|
|
stop_signal: SIGTERM
|
|
stop_grace_period: 30s
|
|
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
|
|
environment:
|
|
- ESPOCRM_CONFIG_USE_WEB_SOCKET=true
|
|
- ESPOCRM_CONFIG_WEB_SOCKET_URL={{ lookup('tls', application_id, 'protocols.websocket') }}://{{ lookup('domain',application_id) }}/ws
|
|
- ESPOCRM_CONFIG_WEB_SOCKET_ZERO_M_Q_SUBSCRIBER_DSN=tcp://*:7777
|
|
- ESPOCRM_CONFIG_WEB_SOCKET_ZERO_M_Q_SUBMISSION_DSN=tcp://websocket:7777
|
|
entrypoint: ["{{ ESPOCRM_ENTRYPOINT_SCRIPT_DOCKER }}", "--wait-ready", "{{ ESPOCRM_SCRIPT_SIDECAR_DOCKER }}", "websocket.php"]
|
|
{{ lookup('container_networks') | indent(4) }}
|
|
{{ lookup('container_volumes', service_name) | indent(4) }}
|
|
{{ lookup('container_ports', ['espocrm', 'websocket', DOCKER_BIND_HOST]) | indent(4) }}
|
|
{{ lookup('container_depends_on', application_id, extra={
|
|
ESPOCRM_SERVICE: {'condition': 'service_healthy'},
|
|
}) | indent(4) }}
|
|
|
|
{{ lookup('compose_volumes') }}
|
|
{{ lookup('compose_networks') }}
|