left4me: reuse nginx bundle's auto-monitoring via check_path

bundles/nginx/metadata.py:91-104 already creates a monitoring/services
entry per nginx/vhost using the vhost's check_protocol/check_path. Set
check_path: '/health' on the left4me vhost so the auto-check hits the
Flask health endpoint, drop the explicit monitoring/services/left4me-web
block from this reactor.

Net effect: same curl command lands in monitoring as before, but the
service name is now 'left4.me' (the hostname, per the nginx reactor's
naming convention) instead of 'left4me-web'.
This commit is contained in:
CroneKorkN 2026-05-10 18:31:52 +02:00
parent 758660b131
commit fc66267656
Signed by: cronekorkn
SSH key fingerprint: SHA256:v0410ZKfuO1QHdgKBsdQNF64xmTxOF8osF1LIqwTcVw

View file

@ -6,16 +6,12 @@ assert node.has_bundle('systemd'), (
) )
# Per-node random secret. Convention follows postgresql, mosquitto, etc.
_secret_key = repo.vault.random_bytes_as_base64_for(f'{node.name} left4me secret_key', length=32).value
defaults = { defaults = {
'left4me': { 'left4me': {
# Application-wide defaults; node only overrides if it really needs to. # Application-wide defaults; node only overrides if it really needs to.
'git_url': 'git@git.sublimity.de:cronekorkn/left4me', 'git_url': 'git@git.sublimity.de:cronekorkn/left4me',
'git_branch': 'master', 'git_branch': 'master',
'secret_key': _secret_key, 'secret_key': repo.vault.random_bytes_as_base64_for(f'{node.name} left4me secret_key', length=32).value,
'gunicorn_workers': 1, 'gunicorn_workers': 1,
'gunicorn_threads': 32, 'gunicorn_threads': 32,
'job_worker_threads': 4, 'job_worker_threads': 4,
@ -75,12 +71,14 @@ defaults = {
@metadata_reactor.provides( @metadata_reactor.provides(
'nginx/vhosts', 'nginx/vhosts',
'monitoring/services',
'nftables/input', 'nftables/input',
) )
def derived_from_domain(metadata): def derived_from_domain(metadata):
# letsencrypt/domains is auto-populated from nginx/vhosts.keys() by # letsencrypt/domains is auto-populated from nginx/vhosts.keys() by
# bundles/nginx/metadata.py — don't duplicate it here. # bundles/nginx/metadata.py. monitoring/services for the vhost is also
# auto-populated there using the vhost's check_path/check_protocol —
# we just declare check_path: '/health' below to point the auto-check
# at the Flask health endpoint instead of '/'.
domain = metadata.get('left4me/domain') domain = metadata.get('left4me/domain')
port_start = metadata.get('left4me/port_range_start') port_start = metadata.get('left4me/port_range_start')
port_end = metadata.get('left4me/port_range_end') port_end = metadata.get('left4me/port_range_end')
@ -93,13 +91,7 @@ def derived_from_domain(metadata):
'context': { 'context': {
'target': 'http://127.0.0.1:8000', 'target': 'http://127.0.0.1:8000',
}, },
}, 'check_path': '/health',
},
},
'monitoring': {
'services': {
'left4me-web': {
'vars.command': f'/usr/bin/curl -X GET -L --fail --no-progress-meter -o /dev/null https://{domain}/health',
}, },
}, },
}, },