From 7a82a92e8437c6e11e67d172b2159ad196c7d258 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sat, 24 Oct 2026 11:44:14 +0200 Subject: [PATCH 1/6] fix(web-app-prometheus): probe only the domains an app serves itself #1180 gave web-app-matrix a canonical `jitsi` domain for its own Jitsi and listed it under `services.jitsi.domains`. When Jitsi is shared or disabled nothing serves that domain, and the blackbox healthz job of web-app-prometheus probed every canonical domain, so the probe of https://jitsi.matrix./healthz/ready failed with "tls: unrecognized name" and `prometheus scrape: every consumer role reports up=1 and passes its probe` went red (main run 40017166046: Matrix#2, Nextcloud#12). web_health_expectations already skipped such keys. The rule now lives in utils/domains/unserved.py: a key claimed by a service entity that is disabled, or enabled but shared, is not served by that app. The health filter uses it unchanged, and prometheus.yml.j2 filters its targets through the new `served_domains` filter, which also drops the `_onion` mirror of a skipped key. Co-Authored-By: Claude Opus 5.5 (1M context) --- plugins/filter/served_domains.py | 6 ++ .../filter_plugins/web_health_expectations.py | 15 ++--- .../templates/configuration/prometheus.yml.j2 | 3 +- .../test_blackbox_targets.py | 52 ++++++++++++++-- utils/domains/unserved.py | 60 +++++++++++++++++++ 5 files changed, 119 insertions(+), 17 deletions(-) create mode 100644 plugins/filter/served_domains.py create mode 100644 utils/domains/unserved.py diff --git a/plugins/filter/served_domains.py b/plugins/filter/served_domains.py new file mode 100644 index 0000000000..66ec49996a --- /dev/null +++ b/plugins/filter/served_domains.py @@ -0,0 +1,6 @@ +from utils.domains.unserved import served_domains + + +class FilterModule: + def filters(self): + return {"served_domains": served_domains} diff --git a/roles/sys-ctl-hlth-webserver/filter_plugins/web_health_expectations.py b/roles/sys-ctl-hlth-webserver/filter_plugins/web_health_expectations.py index 08e6dd2eb1..e30ce87a0c 100644 --- a/roles/sys-ctl-hlth-webserver/filter_plugins/web_health_expectations.py +++ b/roles/sys-ctl-hlth-webserver/filter_plugins/web_health_expectations.py @@ -2,6 +2,7 @@ import sys from collections.abc import Mapping from pathlib import Path +from utils.domains.unserved import unserved_canonical_keys from utils.roles.applications.config import get from utils.roles.applications.status_codes import DEFAULT_OK, codes_by_key @@ -164,17 +165,9 @@ def web_health_expectations( get(applications, app_id, "server.status_codes", strict=False, default={}) ) - suppressed = set() - services_raw = get(applications, app_id, "services", strict=False, default={}) - if isinstance(services_raw, Mapping): - for svc in services_raw.values(): - if not isinstance(svc, Mapping) or "domains" not in svc: - continue - if svc.get("enabled") and not svc.get("shared"): - continue - for key in _to_list(svc.get("domains"), allow_mapping=False): - if key: - suppressed.add(str(key)) + suppressed = unserved_canonical_keys( + get(applications, app_id, "services", strict=False, default={}) + ) app_exp = {} if isinstance(canonical_raw, Mapping) and canonical_raw: diff --git a/roles/web-app-prometheus/templates/configuration/prometheus.yml.j2 b/roles/web-app-prometheus/templates/configuration/prometheus.yml.j2 index 3292b05829..208ed95072 100644 --- a/roles/web-app-prometheus/templates/configuration/prometheus.yml.j2 +++ b/roles/web-app-prometheus/templates/configuration/prometheus.yml.j2 @@ -51,8 +51,7 @@ scrape_configs: static_configs: {% for _application_id in CURRENT_PLAY_APPLICATIONS | list | sort %} {% if _application_id in probed_roles %} -{% set domains_raw = canonical_map.get(_application_id, []) %} -{% set canonical_probe_domains = (domains_raw.values() | list) if (domains_raw is mapping) else domains_raw %} +{% set canonical_probe_domains = canonical_map.get(_application_id, []) | served_domains(lookup('config', _application_id, 'services')) %} {% if canonical_probe_domains | length > 0 %} - targets: {% for domain in canonical_probe_domains %} diff --git a/tests/unit/python/roles/web-app-prometheus/test_blackbox_targets.py b/tests/unit/python/roles/web-app-prometheus/test_blackbox_targets.py index 94cf72434a..dc88ec9884 100644 --- a/tests/unit/python/roles/web-app-prometheus/test_blackbox_targets.py +++ b/tests/unit/python/roles/web-app-prometheus/test_blackbox_targets.py @@ -6,6 +6,7 @@ from jinja2 import Environment, FileSystemLoader, StrictUndefined, select_autoes from utils.cache.files import PROJECT_ROOT from utils.cache.yaml import load_yaml_str +from utils.domains.unserved import served_domains TEMPLATE_DIR = PROJECT_ROOT / "roles/web-app-prometheus/templates/configuration" ONION = "a" * 56 + ".onion" @@ -14,7 +15,11 @@ DOMAINS = { "web-app-prometheus": [f"prometheus.{ONION}"], "web-app-nextcloud": {"nextcloud": f"next.cloud.{ONION}"}, "web-app-gitea": ["git.infinito.test"], - "web-app-matrix": ["matrix.infinito.test"], + "web-app-matrix": { + "synapse": "matrix.infinito.test", + "jitsi": "jitsi.matrix.infinito.test", + "jitsi_onion": f"jitsi.matrix.{ONION}", + }, "web-svc-cdn": ["cdn.infinito.test"], "svc-db-postgres": ["postgres.infinito.test"], } @@ -28,12 +33,23 @@ ROLES_WITH_THE_PROMETHEUS_SERVICE = [ "web-app-gitea", "web-app-matrix", ] +SHARED_JITSI = {"jitsi": {"enabled": True, "shared": True, "domains": ["jitsi"]}} -def probed_groups(*, ca_injected: bool) -> dict[str, dict]: +def probed_groups( + *, ca_injected: bool, matrix_services: dict | None = None +) -> dict[str, dict]: + services = { + "web-app-matrix": SHARED_JITSI if matrix_services is None else matrix_services + } + def lookup(name, *terms, **_kwargs): if name == "domains": return DOMAINS + if name == "config": + app, key = terms + assert key == "services" + return services.get(app, {}) if name == "roles_with_service": return [{"id": role} for role in ROLES_WITH_THE_PROMETHEUS_SERVICE] if name == "ca_injected": @@ -62,6 +78,7 @@ def probed_groups(*, ca_injected: bool) -> dict[str, dict]: autoescape=select_autoescape(), ) env.filters["bool"] = bool + env.filters["served_domains"] = served_domains rendered = env.get_template("prometheus.yml.j2").render( lookup=lookup, application_id="web-app-prometheus", @@ -76,9 +93,12 @@ def probed_groups(*, ca_injected: bool) -> dict[str, dict]: } -def probed_targets() -> dict[str, list[str]]: +def probed_targets(matrix_services: dict | None = None) -> dict[str, list[str]]: return { - app: group["targets"] for app, group in probed_groups(ca_injected=True).items() + app: group["targets"] + for app, group in probed_groups( + ca_injected=True, matrix_services=matrix_services + ).items() } @@ -95,6 +115,30 @@ class TestBlackboxTargets(unittest.TestCase): ["https://git.infinito.test/healthz/ready"], ) + def test_a_shared_service_domain_and_its_onion_mirror_are_not_probed(self): + self.assertEqual( + probed_targets()["web-app-matrix"], + ["https://matrix.infinito.test/healthz/ready"], + ) + + def test_a_disabled_service_domain_is_not_probed(self): + disabled = {"jitsi": {"enabled": False, "shared": False, "domains": ["jitsi"]}} + self.assertEqual( + probed_targets(disabled)["web-app-matrix"], + ["https://matrix.infinito.test/healthz/ready"], + ) + + def test_an_own_service_domain_is_probed(self): + own = {"jitsi": {"enabled": True, "shared": False, "domains": ["jitsi"]}} + self.assertEqual( + probed_targets(own)["web-app-matrix"], + [ + "https://matrix.infinito.test/healthz/ready", + "https://jitsi.matrix.infinito.test/healthz/ready", + f"http://jitsi.matrix.{ONION}/healthz/ready", + ], + ) + def test_only_the_roles_the_service_lookup_names_are_probed(self): self.assertEqual(set(probed_targets()), set(ROLES_WITH_THE_PROMETHEUS_SERVICE)) diff --git a/utils/domains/unserved.py b/utils/domains/unserved.py new file mode 100644 index 0000000000..a88f618dc2 --- /dev/null +++ b/utils/domains/unserved.py @@ -0,0 +1,60 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any + +ONION_SUFFIX = "_onion" + + +def unserved_canonical_keys(services: Any) -> set[str]: + """Return the canonical domain keys an application does not serve. + + Args: + services: the application's ``services`` mapping. An entity that lists + ``domains`` claims those canonical keys. + + Returns: + The keys of every claiming entity that is disabled, or enabled but + shared, because its provider serves that surface instead. + """ + keys: set[str] = set() + if not isinstance(services, Mapping): + return keys + for entity in services.values(): + if not isinstance(entity, Mapping) or "domains" not in entity: + continue + if entity.get("enabled") and not entity.get("shared"): + continue + claimed = entity.get("domains") + if isinstance(claimed, str): + claimed = [claimed] + if not isinstance(claimed, (list, tuple)): + continue + keys.update(str(key) for key in claimed if key) + return keys + + +def served_domains(domains: Any, services: Any) -> list[str]: + """Return the domains of one application that it serves itself. + + Args: + domains: the application's entry of the resolved domains map, a list, + or a mapping of canonical key to domain where onion mirrors sit + under ``_onion``. + services: the application's ``services`` mapping. + + Returns: + The domain values without those of the keys + ``unserved_canonical_keys`` names and without their onion mirrors. + """ + if not isinstance(domains, Mapping): + return [str(domain) for domain in (domains or [])] + skipped = unserved_canonical_keys(services) + served: list[str] = [] + for key, domain in domains.items(): + name = str(key) + base = name.removesuffix(ONION_SUFFIX) + if name in skipped or base in skipped: + continue + served.append(str(domain)) + return served From 045ef095f2e98b3591c3bcce76ce900c3ef40c62 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sat, 24 Oct 2026 11:44:14 +0200 Subject: [PATCH 2/6] fix(web-app-matrix): serve the federation delegation on the server name The LiveKit JWT service checks each OpenID token over federation against the user's homeserver. Server discovery found no delegation: https:///.well-known/matrix/server hit the redirect vhost of web-opt-rdr-domains, which answered 301 to the dashboard and then 404, so the lookup fell back to :8448. In compose OpenResty runs in the host network and answers there; in swarm it publishes 80 and 443 only, the dial was refused and Element Call's token exchange returned 401 M_UNAUTHORIZED (main run 40017166046, Nextcloud#12). The role also wrote the delegation to `/matrixserver`, because the file path joined the directory and `server` without a separator. The file now lands at `/matrix/server`, and the redirect vhost serves `/.well-known/matrix/` from the shared well-known directory, so discovery delegates to the Synapse domain on 443 in both modes. Both flavors share tasks/utils/well_known.yml, which also includes web-opt-rdr-domains for the server name when no play-wide redirect claims it, so the delegation has a vhost there too. Co-Authored-By: Claude Opus 5.5 (1M context) --- roles/web-app-matrix/README.md | 2 +- .../tasks/flavor/ansible/05_proxy_wiring.yml | 12 ++--------- .../tasks/flavor/compose/04_webserver.yml | 12 ++--------- .../web-app-matrix/tasks/utils/well_known.yml | 20 +++++++++++++++++++ roles/web-app-matrix/vars/main.yml | 2 +- .../templates/redirect-domain.conf.j2 | 4 ++++ 6 files changed, 30 insertions(+), 22 deletions(-) create mode 100644 roles/web-app-matrix/tasks/utils/well_known.yml diff --git a/roles/web-app-matrix/README.md b/roles/web-app-matrix/README.md index 5cd3320e22..0f562d7ce5 100644 --- a/roles/web-app-matrix/README.md +++ b/roles/web-app-matrix/README.md @@ -152,7 +152,7 @@ MDAD knobs are rendered from `templates/flavor/ansible/vars.yml.j2`. Central-ser A `mount --make-rshared /` runs once in the deploy container before the runner starts, because MDAD's systemd units bind-mount `/matrix/synapse/storage` with `bind-propagation=slave`, which requires shared/slave propagation on the source. -**Federation.** Synapse serves the `client` and `federation` resources on one listener. OpenResty serves the Synapse domain on 443 and, as `default_server`, on `services.synapse.ports.public.federation`, and the role writes `/.well-known/matrix/server` as the compose flavor does. A server-name lookup that falls back to `:8448` therefore lands on Synapse as well. +**Federation.** Synapse serves the `client` and `federation` resources on one listener. OpenResty serves the Synapse domain on 443 and, as `default_server`, on `services.synapse.ports.public.federation`, and the role writes `/.well-known/matrix/server`, which the redirect vhost of the server name (`web-opt-rdr-domains`) serves, so server discovery delegates to the Synapse domain on 443. The `:8448` fallback only answers where OpenResty runs in the host network (compose); in swarm OpenResty publishes 80 and 443 only. **Registry proxy.** When the stack's docker daemon pulls through a registry proxy (the local registry cache), the runner's nested daemon uses the same proxy via a `docker.service` drop-in and, when the outer daemon trusts the cache's CA, fetches that CA from the proxy before it starts. diff --git a/roles/web-app-matrix/tasks/flavor/ansible/05_proxy_wiring.yml b/roles/web-app-matrix/tasks/flavor/ansible/05_proxy_wiring.yml index 937813ce29..7b1ce8ee18 100644 --- a/roles/web-app-matrix/tasks/flavor/ansible/05_proxy_wiring.yml +++ b/roles/web-app-matrix/tasks/flavor/ansible/05_proxy_wiring.yml @@ -153,16 +153,8 @@ proxy_internal_port: "{{ MATRIX_SYNAPSE_CONTAINER_PORT }}" notify: restart-openresty -- name: "📁 front-proxy: create {{ MATRIX_WELL_KNOWN_DIRECTORY }}" - ansible.builtin.file: - path: "{{ MATRIX_WELL_KNOWN_DIRECTORY }}" - state: directory - mode: "0755" - -- name: "📁 front-proxy: create {{ MATRIX_WELL_KNOWN_FILE }}" - stack_host_template: - src: "well-known.j2" - dest: "{{ MATRIX_WELL_KNOWN_FILE }}" +- name: "🔀 front-proxy: federation delegation" + ansible.builtin.include_tasks: "{{ role_path }}/tasks/utils/well_known.yml" - name: "🔀 front-proxy: Jitsi web" ansible.builtin.include_role: diff --git a/roles/web-app-matrix/tasks/flavor/compose/04_webserver.yml b/roles/web-app-matrix/tasks/flavor/compose/04_webserver.yml index d63e255708..c387f0e519 100644 --- a/roles/web-app-matrix/tasks/flavor/compose/04_webserver.yml +++ b/roles/web-app-matrix/tasks/flavor/compose/04_webserver.yml @@ -1,15 +1,7 @@ --- # include-gated: when: DEPLOYMENT_MODE == "compose" -- name: 📁 create {{ MATRIX_WELL_KNOWN_DIRECTORY }} - ansible.builtin.file: - path: "{{ MATRIX_WELL_KNOWN_DIRECTORY }}" - state: directory - mode: "0755" - -- name: 📁 create {{ MATRIX_WELL_KNOWN_FILE }} - stack_host_template: - src: "well-known.j2" - dest: "{{ MATRIX_WELL_KNOWN_FILE }}" +- name: "🔀 federation delegation" + ansible.builtin.include_tasks: "{{ role_path }}/tasks/utils/well_known.yml" - name: "📂 include role sys-stk-front-proxy for {{ MATRIX_ELEMENT_DOMAIN }}" ansible.builtin.include_role: diff --git a/roles/web-app-matrix/tasks/utils/well_known.yml b/roles/web-app-matrix/tasks/utils/well_known.yml new file mode 100644 index 0000000000..eee6555705 --- /dev/null +++ b/roles/web-app-matrix/tasks/utils/well_known.yml @@ -0,0 +1,20 @@ +--- +- name: "📁 create {{ MATRIX_WELL_KNOWN_DIRECTORY }}" + ansible.builtin.file: + path: "{{ MATRIX_WELL_KNOWN_DIRECTORY }}" + state: directory + mode: "0755" + +- name: "📁 create {{ MATRIX_WELL_KNOWN_FILE }}" + stack_host_template: + src: "well-known.j2" + dest: "{{ MATRIX_WELL_KNOWN_FILE }}" + +- name: "🔀 serve the federation delegation on {{ MATRIX_SERVER_NAME }}" + ansible.builtin.include_role: + name: web-opt-rdr-domains + vars: + redirect_domain_mappings: + - source: "{{ MATRIX_SERVER_NAME }}" + target: "{{ MATRIX_ELEMENT_DOMAIN }}" + when: MATRIX_SERVER_NAME not in (CURRENT_PLAY_REDIRECT_DOMAINS | map(attribute='source') | list) diff --git a/roles/web-app-matrix/vars/main.yml b/roles/web-app-matrix/vars/main.yml index 040161198f..663064061c 100644 --- a/roles/web-app-matrix/vars/main.yml +++ b/roles/web-app-matrix/vars/main.yml @@ -11,7 +11,7 @@ MATRIX_SERVER_NAME: "{{ MATRIX_ONION_NODE if (MATRIX_ONION_NODE and lookup('doma MATRIX_ADMINISTRATOR_USERNAME: "{{ lookup('users', 'administrator').username }}" MATRIX_ADMINISTRATOR_PASSWORD: "{{ lookup('users', 'administrator').password }}" MATRIX_WELL_KNOWN_DIRECTORY: "{{ [ lookup('nginx','directories.data.well_known'), 'matrix' ] | path_join }}" -MATRIX_WELL_KNOWN_FILE: "{{ MATRIX_WELL_KNOWN_DIRECTORY }}server" +MATRIX_WELL_KNOWN_FILE: "{{ [ MATRIX_WELL_KNOWN_DIRECTORY, 'server' ] | path_join }}" MATRIX_REGISTRATION_FILE_FOLDER: "/registrations/" MATRIX_BRIDGE_SOURCE_DIR: "{{ [ lookup('container', application_id, 'directories.config'), 'mautrix' ] | path_join }}" MATRIX_BRIDGE_CONFIG_TARGET: "/config/config.yaml" diff --git a/roles/web-opt-rdr-domains/templates/redirect-domain.conf.j2 b/roles/web-opt-rdr-domains/templates/redirect-domain.conf.j2 index 509eb90c54..a618287e80 100644 --- a/roles/web-opt-rdr-domains/templates/redirect-domain.conf.j2 +++ b/roles/web-opt-rdr-domains/templates/redirect-domain.conf.j2 @@ -7,6 +7,10 @@ server { {% if web_opt_rdr_domains_logout_enabled | bool %} {% include 'roles/web-svc-logout/templates/logout-proxy.conf.j2' %} {% endif %} + location ^~ /.well-known/matrix/ { + alias {{ [ lookup('nginx', 'directories.data.well_known'), 'matrix' ] | path_join }}/; + default_type application/json; + } location / { return 301 {{ lookup('tls', application_id, 'protocols.web') }}://{{ target }}$request_uri; } From 7e241c6557843c8fdc309c18c8c0a299fff82014 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sat, 24 Oct 2026 11:44:15 +0200 Subject: [PATCH 3/6] fix(web-app-seaweedfs): point the homepage at seaweedfs.com https://seaweedfs.org/ answers 404, which fails test-external (tests/external/repository/test_urls_reachable.py) on README.md:167. The upstream repository declares https://seaweedfs.com as its homepage. Co-Authored-By: Claude Opus 5.5 (1M context) --- README.md | 2 +- roles/web-app-seaweedfs/meta/info.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a1c30b6a98..b977b8e596 100644 --- a/README.md +++ b/README.md @@ -164,7 +164,7 @@ Every invokable role in the tested lifecycle envelope, with its upstream homepag | [Redirector](roles/web-opt-rdr-domains/) | beta | NGINX glue role for 301 redirects from source to target domains with automatic SSL for the source hosts | [🛠️](roles/web-opt-rdr-domains/README.md#quick-setup) | | | [Redis](roles/svc-db-redis/) | beta | In-memory key-value cache and store, shared centrally with per-consumer ACL isolation or embedded as a sidecar | [🌐](https://redis.io/) [🛠️](roles/svc-db-redis/README.md#quick-setup) | [Tor Onion Service](roles/svc-net-tor/) | | [Roulette Wheel](roles/web-app-roulette-wheel/) | alpha | Browser-based spinning wheel app for decision making, random selection, and gamification | [🌐](https://github.com/p-wojt/roulette-wheel) [🛠️](roles/web-app-roulette-wheel/README.md#quick-setup) | [Corporate Design](roles/web-svc-css/), [Dashboard](roles/web-app-dashboard/), [Matomo](roles/web-app-matomo/), [Prometheus](roles/web-app-prometheus/), [Tor Onion Service](roles/svc-net-tor/) | -| [SeaweedFS](roles/web-app-seaweedfs/) | beta | Distributed S3-compatible object store for shared, per-consumer bucket provisioning across web-app roles | [🌐](https://seaweedfs.org/) [🛠️](roles/web-app-seaweedfs/README.md#quick-setup) | [Backup Docker Volumes](roles/svc-bkp-volume-2-local/), [Dashboard](roles/web-app-dashboard/), [Keycloak](roles/web-app-keycloak/), [Prometheus](roles/web-app-prometheus/), [Universal Logout](roles/web-svc-logout/) | +| [SeaweedFS](roles/web-app-seaweedfs/) | beta | Distributed S3-compatible object store for shared, per-consumer bucket provisioning across web-app roles | [🌐](https://seaweedfs.com/) [🛠️](roles/web-app-seaweedfs/README.md#quick-setup) | [Backup Docker Volumes](roles/svc-bkp-volume-2-local/), [Dashboard](roles/web-app-dashboard/), [Keycloak](roles/web-app-keycloak/), [Prometheus](roles/web-app-prometheus/), [Universal Logout](roles/web-svc-logout/) | | [Self-Hosted Runner](roles/svc-runner/) | beta | Self-hosted CI runner infrastructure for executing GitHub Actions workflow jobs in ephemeral Docker containers | [🌐](https://github.com/actions/runner) [🛠️](roles/svc-runner/README.md#quick-setup) | | | [Semaphore UI](roles/web-app-semaphore/) | beta | Web UI and API for running Ansible, Terraform/OpenTofu, and shell automation on a schedule or on demand | [🌐](https://semaphoreui.com/) [🎬](https://www.youtube.com/watch?v=nzR4yDuZQMU) [🛠️](roles/web-app-semaphore/README.md#quick-setup) | [Backup Docker Volumes](roles/svc-bkp-volume-2-local/), [Corporate Design](roles/web-svc-css/), [Dashboard](roles/web-app-dashboard/), [Keycloak](roles/web-app-keycloak/), [Matomo](roles/web-app-matomo/), [OpenLDAP](roles/svc-db-openldap/), [PostgreSQL](roles/svc-db-postgres/), [Prometheus](roles/web-app-prometheus/), [Stalwart Mail Server](roles/web-app-stalwart/), [Tor Onion Service](roles/svc-net-tor/), [Universal Logout](roles/web-svc-logout/) | | [Shopware](roles/web-app-shopware/) | beta | Open-source ecommerce platform built on Symfony and Vue.js for building and scaling online storefronts | [🌐](https://www.shopware.com/en/) [🎬](https://www.youtube.com/watch?v=bG57TZPYsyw) [🛠️](roles/web-app-shopware/README.md#quick-setup) | [Backup Docker Volumes](roles/svc-bkp-volume-2-local/), [Corporate Design](roles/web-svc-css/), [Dashboard](roles/web-app-dashboard/), [Keycloak](roles/web-app-keycloak/), [MariaDB](roles/svc-db-mariadb/), [Matomo](roles/web-app-matomo/), [OpenLDAP](roles/svc-db-openldap/), [Prometheus](roles/web-app-prometheus/), [Redis](roles/svc-db-redis/), [SeaweedFS](roles/web-app-seaweedfs/), [Stalwart Mail Server](roles/web-app-stalwart/), [Tor Onion Service](roles/svc-net-tor/), [Universal Logout](roles/web-svc-logout/) | diff --git a/roles/web-app-seaweedfs/meta/info.yml b/roles/web-app-seaweedfs/meta/info.yml index 676f200ccc..1af7a7f891 100644 --- a/roles/web-app-seaweedfs/meta/info.yml +++ b/roles/web-app-seaweedfs/meta/info.yml @@ -2,4 +2,4 @@ # nocheck: info-media no official demo video logo: class: fa-solid fa-hard-drive -homepage: https://seaweedfs.org/ +homepage: https://seaweedfs.com/ From ce9490d317ba4f78058d13302da777ed673c6f67 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sat, 24 Oct 2026 12:59:22 +0200 Subject: [PATCH 4/6] refactor(web-opt-rdr-domains): serve a per-domain well-known directory, not a Matrix path 045ef095f2 taught the generic redirect vhost a Matrix location and let web-app-matrix include web-opt-rdr-domains for its server name on its own. The first put one app's contract into a shared role and made every redirect source (www, aliases, asset, css) advertise the Matrix delegation; the second bypassed current_play_redirect_domains and could overwrite a vhost the server name already had, such as the Synapse one. Every redirect vhost now serves `/.well-known/` from `//` and hands a missing file or the bare directory to `location /` via `error_page 403 404 = /`, so it still answers 301 with the original request URI. web-app-matrix only writes its delegation file into the directory of its server name. Co-Authored-By: Claude Opus 5.5 (1M context) --- roles/web-app-matrix/README.md | 2 +- roles/web-app-matrix/tasks/utils/well_known.yml | 9 --------- roles/web-app-matrix/vars/main.yml | 2 +- roles/web-opt-rdr-domains/README.md | 1 + .../templates/redirect-domain.conf.j2 | 5 +++-- 5 files changed, 6 insertions(+), 13 deletions(-) diff --git a/roles/web-app-matrix/README.md b/roles/web-app-matrix/README.md index 0f562d7ce5..bcc88cf1c5 100644 --- a/roles/web-app-matrix/README.md +++ b/roles/web-app-matrix/README.md @@ -152,7 +152,7 @@ MDAD knobs are rendered from `templates/flavor/ansible/vars.yml.j2`. Central-ser A `mount --make-rshared /` runs once in the deploy container before the runner starts, because MDAD's systemd units bind-mount `/matrix/synapse/storage` with `bind-propagation=slave`, which requires shared/slave propagation on the source. -**Federation.** Synapse serves the `client` and `federation` resources on one listener. OpenResty serves the Synapse domain on 443 and, as `default_server`, on `services.synapse.ports.public.federation`, and the role writes `/.well-known/matrix/server`, which the redirect vhost of the server name (`web-opt-rdr-domains`) serves, so server discovery delegates to the Synapse domain on 443. The `:8448` fallback only answers where OpenResty runs in the host network (compose); in swarm OpenResty publishes 80 and 443 only. +**Federation.** Synapse serves the `client` and `federation` resources on one listener. OpenResty serves the Synapse domain on 443 and, as `default_server`, on `services.synapse.ports.public.federation`, and the role writes `/.well-known/matrix/server` into the well-known directory of its server name, which the redirect vhost of that domain (`web-opt-rdr-domains`) serves, so server discovery delegates to the Synapse domain on 443. The `:8448` fallback only answers where OpenResty runs in the host network (compose); in swarm OpenResty publishes 80 and 443 only. **Registry proxy.** When the stack's docker daemon pulls through a registry proxy (the local registry cache), the runner's nested daemon uses the same proxy via a `docker.service` drop-in and, when the outer daemon trusts the cache's CA, fetches that CA from the proxy before it starts. diff --git a/roles/web-app-matrix/tasks/utils/well_known.yml b/roles/web-app-matrix/tasks/utils/well_known.yml index eee6555705..d8f64c4abf 100644 --- a/roles/web-app-matrix/tasks/utils/well_known.yml +++ b/roles/web-app-matrix/tasks/utils/well_known.yml @@ -9,12 +9,3 @@ stack_host_template: src: "well-known.j2" dest: "{{ MATRIX_WELL_KNOWN_FILE }}" - -- name: "🔀 serve the federation delegation on {{ MATRIX_SERVER_NAME }}" - ansible.builtin.include_role: - name: web-opt-rdr-domains - vars: - redirect_domain_mappings: - - source: "{{ MATRIX_SERVER_NAME }}" - target: "{{ MATRIX_ELEMENT_DOMAIN }}" - when: MATRIX_SERVER_NAME not in (CURRENT_PLAY_REDIRECT_DOMAINS | map(attribute='source') | list) diff --git a/roles/web-app-matrix/vars/main.yml b/roles/web-app-matrix/vars/main.yml index 663064061c..76a12de101 100644 --- a/roles/web-app-matrix/vars/main.yml +++ b/roles/web-app-matrix/vars/main.yml @@ -10,7 +10,7 @@ MATRIX_SERVER_NAME: "{{ MATRIX_ONION_NODE if (MATRIX_ONION_NODE and lookup('doma 'services.matrix.server_name') }}" MATRIX_ADMINISTRATOR_USERNAME: "{{ lookup('users', 'administrator').username }}" MATRIX_ADMINISTRATOR_PASSWORD: "{{ lookup('users', 'administrator').password }}" -MATRIX_WELL_KNOWN_DIRECTORY: "{{ [ lookup('nginx','directories.data.well_known'), 'matrix' ] | path_join }}" +MATRIX_WELL_KNOWN_DIRECTORY: "{{ [ lookup('nginx','directories.data.well_known'), MATRIX_SERVER_NAME, 'matrix' ] | path_join }}" MATRIX_WELL_KNOWN_FILE: "{{ [ MATRIX_WELL_KNOWN_DIRECTORY, 'server' ] | path_join }}" MATRIX_REGISTRATION_FILE_FOLDER: "/registrations/" MATRIX_BRIDGE_SOURCE_DIR: "{{ [ lookup('container', application_id, 'directories.config'), 'mautrix' ] | path_join }}" diff --git a/roles/web-opt-rdr-domains/README.md b/roles/web-opt-rdr-domains/README.md index 107bf09eba..9588c377ed 100644 --- a/roles/web-opt-rdr-domains/README.md +++ b/roles/web-opt-rdr-domains/README.md @@ -24,6 +24,7 @@ Solid `1:1` edges are fixed relationships; dashed `0..1` edges are conditional ( ## Features - **Automated provisioning:** Configured by Ansible without manual steps. +- **Well-known passthrough:** every source domain serves the files of its own subdirectory `/` of the shared well-known directory (`lookup('nginx', 'directories.data.well_known')`) under `/.well-known/`; any other request, a missing well-known file included, gets the 301. ## Quick Setup diff --git a/roles/web-opt-rdr-domains/templates/redirect-domain.conf.j2 b/roles/web-opt-rdr-domains/templates/redirect-domain.conf.j2 index a618287e80..0496464137 100644 --- a/roles/web-opt-rdr-domains/templates/redirect-domain.conf.j2 +++ b/roles/web-opt-rdr-domains/templates/redirect-domain.conf.j2 @@ -7,9 +7,10 @@ server { {% if web_opt_rdr_domains_logout_enabled | bool %} {% include 'roles/web-svc-logout/templates/logout-proxy.conf.j2' %} {% endif %} - location ^~ /.well-known/matrix/ { - alias {{ [ lookup('nginx', 'directories.data.well_known'), 'matrix' ] | path_join }}/; + location ^~ /.well-known/ { + alias {{ [ lookup('nginx', 'directories.data.well_known'), domain ] | path_join }}/; default_type application/json; + error_page 403 404 = /; } location / { return 301 {{ lookup('tls', application_id, 'protocols.web') }}://{{ target }}$request_uri; From bfd6f7c9b8d77e76993f3d1dd0f1da284a23ce97 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sat, 24 Oct 2026 12:59:42 +0200 Subject: [PATCH 5/6] fix(install-lint): give chrome-headless-shell a font on dnf, yum and pacman On a fresh Fedora dev container lint-mermaid failed most files with ConnectionClosedError: the browser aborted with `FATAL:third_party/skia/src/ports/SkFontMgr_FontConfigInterface.cpp:163] Not implemented.` in its font fallback, because the host had no font at all. install-lint provisions the browser's libraries by soname on dnf, yum and pacman, and a font is not a soname; apt-get gets fonts through puppeteer's --install-deps. It looked load-dependent because lint-packages installs rpmlint in the same parallel phase, which pulls fontconfig and Noto Sans: renders crashed until that transaction landed, and every later run was green. With every font removed, lint-mermaid alone fails 274 of 289 files the same way. ensure() now installs the distribution's font provide when /usr/share/fonts holds no file (`font(:lang=en)` on dnf and yum, `ttf-font` on pacman), and browser_installed() counts the font, so the install-lint stamp is not fresh on a font-less host. Closes #1154 Co-Authored-By: Claude Opus 5.5 (1M context) --- .../utils/install/lint/test_mermaid_cli.py | 78 +++++++++++++++++++ utils/install/lint/mermaid_cli.py | 47 ++++++++++- 2 files changed, 122 insertions(+), 3 deletions(-) diff --git a/tests/unit/python/utils/install/lint/test_mermaid_cli.py b/tests/unit/python/utils/install/lint/test_mermaid_cli.py index 7a2f226d28..b125c0afb9 100644 --- a/tests/unit/python/utils/install/lint/test_mermaid_cli.py +++ b/tests/unit/python/utils/install/lint/test_mermaid_cli.py @@ -99,6 +99,7 @@ def _environment( mock.patch.object(mermaid_cli, "which", return_value=True), mock.patch.object(mermaid_cli.shutil, "which", return_value=str(mmdc)), mock.patch.object(mermaid_cli, "missing_libraries", return_value=[]), + mock.patch.object(mermaid_cli, "fonts_installed", return_value=True), ): yield Path(prefix), Path(cache) @@ -348,7 +349,84 @@ class TestBrowserLibraries(unittest.TestCase): ) +class TestBrowserFonts(unittest.TestCase): + def ensure_fonts(self, *, manager: str, present: list[bool]) -> mock.Mock: + """Run the font step with a stubbed font check and package manager. + + Args: + manager: the package manager the host reports. + present: successive ``fonts_installed`` results. + + Returns: + The stubbed ``run_privileged``. + """ + with ( + mock.patch.object(mermaid_cli, "fonts_installed", side_effect=present), + mock.patch.object( + mermaid_cli, "detect_package_manager", return_value=manager + ), + mock.patch.object(mermaid_cli, "run_privileged") as privileged, + ): + mermaid_cli._ensure_fonts() + return privileged + + def test_a_host_with_a_font_installs_nothing(self) -> None: + privileged = self.ensure_fonts(manager="dnf", present=[True]) + privileged.assert_not_called() + + def test_the_redhat_family_installs_the_english_font_provide(self) -> None: + for manager in ("dnf", "yum"): + with self.subTest(manager=manager): + privileged = self.ensure_fonts(manager=manager, present=[False, True]) + privileged.assert_called_once_with( + [manager, "-y", "install", "font(:lang=en)"] + ) + + def test_arch_installs_the_ttf_font_provide(self) -> None: + privileged = self.ensure_fonts(manager="pacman", present=[False, True]) + privileged.assert_called_once_with( + ["pacman", "-Syu", "--noconfirm", "--needed", "ttf-font"] + ) + + def test_apt_without_a_font_fails_without_installing(self) -> None: + with ( + mock.patch.object(mermaid_cli, "fonts_installed", return_value=False), + mock.patch.object( + mermaid_cli, "detect_package_manager", return_value="apt-get" + ), + mock.patch.object(mermaid_cli, "run_privileged") as privileged, + self.assertRaisesRegex(RuntimeError, "--install-deps"), + ): + mermaid_cli._ensure_fonts() + privileged.assert_not_called() + + def test_no_font_after_the_install_raises(self) -> None: + with self.assertRaisesRegex(RuntimeError, "still finds no font"): + self.ensure_fonts(manager="dnf", present=[False, False]) + + def test_only_a_file_under_the_font_directory_counts(self) -> None: + with TemporaryDirectory() as fonts: + directory = Path(fonts) + with mock.patch.object(mermaid_cli, "FONT_DIRECTORY", directory): + (directory / "google-noto-vf").mkdir() + self.assertFalse(mermaid_cli.fonts_installed()) + (directory / "google-noto-vf" / "NotoSans[wght].ttf").write_bytes(b"") + self.assertTrue(mermaid_cli.fonts_installed()) + + def test_a_missing_font_directory_counts_as_no_font(self) -> None: + with mock.patch.object( + mermaid_cli, "FONT_DIRECTORY", Path("/nonexistent/fonts") + ): + self.assertFalse(mermaid_cli.fonts_installed()) + + class TestBrowserInstalled(unittest.TestCase): + def test_a_browser_without_any_font_is_not_installed(self) -> None: + with _environment() as (_, cache): + _install_browser(cache, REVISION) + with mock.patch.object(mermaid_cli, "fonts_installed", return_value=False): + self.assertFalse(mermaid_cli.browser_installed()) + def test_only_the_pinned_revision_counts(self) -> None: with _environment() as (_, cache): _install_browser(cache, "155.0.8059.79") diff --git a/utils/install/lint/mermaid_cli.py b/utils/install/lint/mermaid_cli.py index 7e08f66216..1bc2e9e3c4 100644 --- a/utils/install/lint/mermaid_cli.py +++ b/utils/install/lint/mermaid_cli.py @@ -5,8 +5,10 @@ provisioned afterwards through the puppeteer that npm installed next to mmdc, at the revision its puppeteer-core pins. ``unzip`` is ensured first because puppeteer extracts the browser with it. Puppeteer installs the browser's shared libraries only through apt-get (``--install-deps``); on dnf, yum and -pacman the libraries ``ldd`` reports missing are installed by soname. Every -failure aborts ``install-lint``. +pacman the libraries ``ldd`` reports missing are installed by soname, and a +font by the distribution's font provide, because the browser aborts in its +font fallback (``SkFontMgr_FontConfigInterface ... Not implemented``) on a +host without any font. Every failure aborts ``install-lint``. """ from __future__ import annotations @@ -25,12 +27,20 @@ from utils.install.system_pkg import detect_package_manager, install_command_via BROWSER = "chrome-headless-shell" PROVISION_TIMEOUT_S = 900 +FONT_DIRECTORY = Path("/usr/share/fonts") + _INSTALL_ARGV = { "dnf": ["dnf", "-y", "install"], "yum": ["yum", "-y", "install"], "pacman": ["pacman", "-Syu", "--noconfirm", "--needed"], } +_FONT_PROVIDES = { + "dnf": "font(:lang=en)", + "yum": "font(:lang=en)", + "pacman": "ttf-font", +} + def _ensure_unzip() -> None: if not which("unzip"): @@ -110,9 +120,19 @@ def missing_libraries(executable: Path) -> list[str]: ) +def fonts_installed() -> bool: + return FONT_DIRECTORY.is_dir() and any( + path.is_file() for path in FONT_DIRECTORY.rglob("*") + ) + + def browser_installed() -> bool: executable = browser_executable() - return executable is not None and not missing_libraries(executable) + return ( + executable is not None + and not missing_libraries(executable) + and fonts_installed() + ) def _provision_browser(puppeteer: Path) -> subprocess.CompletedProcess[str]: @@ -206,6 +226,26 @@ def _ensure_browser_libraries(executable: Path) -> None: ) +def _ensure_fonts() -> None: + if fonts_installed(): + return + manager = detect_package_manager() + provide = _FONT_PROVIDES.get(manager) + if provide is None: + raise RuntimeError( + f"{BROWSER} finds no font under {FONT_DIRECTORY} and {manager} has " + f"no font provide; on apt-get the fonts come from --install-deps, " + f"which needs root." + ) + log(f"Installing a font for {BROWSER} via {manager}: {provide}") + run_privileged([*_INSTALL_ARGV[manager], provide]) + if not fonts_installed(): + raise RuntimeError( + f"{BROWSER} still finds no font under {FONT_DIRECTORY} after " + f"installing {provide} via {manager}." + ) + + def _ensure_browser() -> None: executable = browser_executable() if executable is None: @@ -214,6 +254,7 @@ def _ensure_browser() -> None: if executable is None: raise RuntimeError(f"{BROWSER} is still missing after provisioning.") _ensure_browser_libraries(executable) + _ensure_fonts() def ensure() -> None: From bed4581faacc8db58fa3344c55a74db6e2e08720 Mon Sep 17 00:00:00 2001 From: "infinito-nexus-updater[bot]" <286144613+infinito-nexus-updater[bot]@users.noreply.github.com> Date: Sat, 24 Oct 2026 11:02:40 +0000 Subject: [PATCH 6/6] update(images): update Docker image versions (web-app-socialhome) --- roles/web-app-socialhome/meta/services.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/web-app-socialhome/meta/services.yml b/roles/web-app-socialhome/meta/services.yml index 70dc854023..bf86e05e13 100644 --- a/roles/web-app-socialhome/meta/services.yml +++ b/roles/web-app-socialhome/meta/services.yml @@ -13,7 +13,7 @@ socialhome: # nocheck: default-placement-manager embedded sqlite in a node-local volume; no clustered storage placement: manager image: ghcr.io/social-home-io/socialhome - version: "2026.10.22" + version: "2026.10.24" ports: local: http: 8089