diff --git a/Makefile b/Makefile index 0bdbca4c5a..6d339fe767 100644 --- a/Makefile +++ b/Makefile @@ -284,12 +284,11 @@ diagnose-network: @$(MAKE) compose-exec cmd="python3 -m cli.contributing.network.diagnose" .PHONY: docs -# Regenerate generated documentation: role Cosmos diagrams, Quick Setup blocks, the root-README roles index, and the MCP audit report. +# Regenerate generated documentation: role Cosmos diagrams, Quick Setup blocks, and the root-README roles index. docs: @"$(MAKE)" cosmos @"$(MAKE)" readme-generate quick_setup=true @"$(MAKE)" readme-index - @"$(MAKE)" mcp-audit .PHONY: dotenv # Regenerate .env (SPOT) from default.env + runtime context. @@ -540,11 +539,6 @@ lint-sql: install-lint @bash scripts/install/wrapper.sh sql @bash scripts/lint/wrapper.sh sql -.PHONY: mcp-audit -# Regenerate the MCP audit report; test_mcp_audit_report fails when it drifts. -mcp-audit: - @"$${PYTHON}" -m cli.build.docs.mcp_audit - .PHONY: meta-list # Print the repository role list. meta-list: diff --git a/aliases b/aliases index 53bf1b44ac..13f9873567 100644 --- a/aliases +++ b/aliases @@ -76,7 +76,6 @@ alias i8mativas='i8mativ -s' # variant with symbols alias i8mativaso='clear && i8maal' # clear + deploy matrix of every deployable variant, in CI query order alias i8matiw='i8matis --sort "desc weight"' # complexity matrix, symbols, heaviest roles first alias i8matix='infinito meta roles applications complexity' # deploy matrix / complexity overview -alias i8mcau='m mcp-audit' alias i8me='m meta-list' alias i8memi='m meta-mig' alias i8mete='m meta-tree' diff --git a/cli/build/docs/mcp_audit/__init__.py b/cli/build/docs/mcp_audit/__init__.py deleted file mode 100644 index 759a8bda3b..0000000000 --- a/cli/build/docs/mcp_audit/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -"""Compatibility wrapper. - -The implementation lives in ``cli/build/docs/mcp_audit/__main__.py``; this -package re-exports its public API so ``from cli.build.docs.mcp_audit import -...`` works. -""" - -from __future__ import annotations - -from pathlib import Path - -PROJECT_ROOT: Path = Path(__file__).resolve().parents[4] diff --git a/cli/build/docs/mcp_audit/__main__.py b/cli/build/docs/mcp_audit/__main__.py deleted file mode 100755 index cbb3af4a70..0000000000 --- a/cli/build/docs/mcp_audit/__main__.py +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env python3 -"""Generate the operational MCP audit report. - -The metadata stays where it belongs: each role owns its ``meta/mcp.yml``, and -nothing here writes back into a role. This script only reads that metadata and -renders the one table a reviewer needs to answer "what does this surface -actually expose, as whom, to whom" without opening twenty-four files. - -Run ``make mcp-audit`` and commit the result; a lint fails when the committed -report differs from a fresh generation, so the table cannot drift away from the -roles the way the hand-maintained disposition lists once did. -""" - -from utils.cache.yaml import load_yaml_any -from utils.roles.applications.mcp import derive_allowed_consumers -from utils.roles.mapping import ROLE_FILE_META_MCP, ROLE_FILE_META_SERVICES - -from . import PROJECT_ROOT - -REPO_ROOT = PROJECT_ROOT -ROLES_DIR = REPO_ROOT / "roles" -REPORT = ( - REPO_ROOT / "docs/contributing/design/role/services/mcp/audit.md" -) - -COLUMNS = ( - "role", - "version", - "source", - "transport", - "auth", - "subject", - "scope", - "tools", - "implementation", - "consumers", - "blocker", -) - -EMPTY = "—" - - -def _load(path): - data = load_yaml_any(str(path), default_if_missing={}) - return data if isinstance(data, dict) else {} - - -def _deployed_version(role_dir): - """Return the version of the role's own container, or EMPTY.""" - services = _load(role_dir / ROLE_FILE_META_SERVICES) - entity = role_dir.name.rsplit("-", 1)[-1] - for name, service in services.items(): - if not isinstance(service, dict): - continue - if name == entity and service.get("version"): - return str(service["version"]) - return EMPTY - - -def _version(role_dir): - """Return the version the role deploys the surface at.""" - return _cell(_deployed_version(role_dir)) - - -def _scope(tools): - """Return the read/write posture as one token.""" - if not isinstance(tools, dict): - return EMPTY - if tools.get("mutating_tools_enabled"): - return "read-write" - return "read-only" if tools.get("read_only_default") else EMPTY - - -def _subject(mcp): - """Return the declared subject together with the principal it resolves to.""" - subject = str(mcp.get("auth_subject") or "").strip() - owner = str((mcp.get("credential") or {}).get("owner") or "").strip() - if subject and owner: - return f"{subject} (`{owner}`)" - return subject or owner or EMPTY - - -def _join(values): - if not isinstance(values, list) or not values: - return EMPTY - return ", ".join(f"`{v}`" for v in values) - - -def _cell(value): - text = str(value or "").strip() - return text.replace("|", r"\|") if text else EMPTY - - -def _services_by_role(): - return { - role_dir.name: _load(role_dir / ROLE_FILE_META_SERVICES) - for role_dir in sorted(ROLES_DIR.iterdir()) - if role_dir.is_dir() - } - - -def rows(): - """Yield one report row per role that owns MCP metadata.""" - services_by_role = _services_by_role() - for mcp_path in sorted(ROLES_DIR.glob(f"*/{ROLE_FILE_META_MCP}")): - role_dir = mcp_path.parent.parent - mcp = _load(mcp_path) - tools = mcp.get("tools") - consumers = ( - derive_allowed_consumers(role_dir.name, services_by_role) - if mcp.get("direction") in ("server", "both") - else [] - ) - yield { - "role": f"`{role_dir.name}`", - "version": _version(role_dir), - "source": f"[link]({mcp['source_url']})" - if mcp.get("source_url") - else EMPTY, - "transport": _cell(mcp.get("transport")), - "auth": _cell(mcp.get("auth")), - "subject": _subject(mcp), - "scope": _scope(tools), - "tools": ( - str(len(tools["allowlist"])) - if isinstance(tools, dict) and isinstance(tools.get("allowlist"), list) - else EMPTY - ), - "implementation": _cell(mcp.get("implementation")), - "consumers": _join(consumers), - "blocker": _cell(mcp.get("reason")), - } - - -def render(): - """Return the full report as markdown.""" - lines = [ - "# 035 - MCP Audit Report", - "", - "Generated by `make mcp-audit`; do not edit by hand.", - "Run that script from the repository root and commit the result.", - "", - "One row per role that owns `meta/mcp.yml`. The disposition of every other", - "role lives in the audit lists of the MCP proxy-expansion requirement.", - "", - "`version` is the version the role deploys, read from its own `meta/services.yml`,", - "not the version the MCP surface was verified against.", - "`tools` counts the allowlist entries; the names themselves stay in the role.", - "", - "| " + " | ".join(COLUMNS) + " |", - "|" + "|".join(" --- " for _ in COLUMNS) + "|", - ] - lines.extend("| " + " | ".join(row[c] for c in COLUMNS) + " |" for row in rows()) - lines.append("") - return "\n".join(lines) - - -if __name__ == "__main__": - REPORT.write_text(render(), encoding="utf-8") - print(f"wrote {REPORT.relative_to(REPO_ROOT)}") diff --git a/docs/contributing/design/role/services/mcp/audit.md b/docs/contributing/design/role/services/mcp/audit.md deleted file mode 100644 index 6af622f850..0000000000 --- a/docs/contributing/design/role/services/mcp/audit.md +++ /dev/null @@ -1,38 +0,0 @@ -# 035 - MCP Audit Report - -Generated by `make mcp-audit`; do not edit by hand. -Run that script from the repository root and commit the result. - -One row per role that owns `meta/mcp.yml`. The disposition of every other -role lives in the audit lists of the MCP proxy-expansion requirement. - -`version` is the version the role deploys, read from its own `meta/services.yml`, -not the version the MCP surface was verified against. -`tools` counts the allowlist entries; the names themselves stay in the role. - -| role | version | source | transport | auth | subject | scope | tools | implementation | consumers | blocker | -| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | -| `svc-db-qdrant` | v1.19.1 | [link](https://s.infinito.nexus/code) | streamable_http | bearer_token | service_account (`mcp-svc-db-qdrant`) | read-only | 2 | adapter | `web-app-flowise`, `web-app-hermes`, `web-app-openclaw`, `web-app-openwebui` | — | -| `web-app-baserow` | 2.4.0 | [link](https://baserow.io/user-docs/mcp-server) | streamable_http | bearer_token | service_account (`mcp-web-app-baserow`) | read-only | 4 | adapter | `web-app-hermes`, `web-app-openclaw`, `web-app-openwebui` | — | -| `web-app-checkmk` | 2.4.0p37 | [link](https://s.infinito.nexus/code) | streamable_http | bearer_token | service_account (`mcp-web-app-checkmk`) | read-only | 3 | adapter | `web-app-hermes`, `web-app-openclaw`, `web-app-openwebui` | — | -| `web-app-fider` | stable | [link](https://s.infinito.nexus/code) | streamable_http | bearer_token | service_account (`mcp-web-app-fider`) | read-only | 3 | adapter | `web-app-hermes`, `web-app-openclaw`, `web-app-openwebui` | — | -| `web-app-flowise` | 24-slim | [link](https://github.com/FlowiseAI/Flowise/tree/flowise%403.1.4/packages/server/src/routes/custom-mcp-servers) | — | — | — | read-only | — | native | — | — | -| `web-app-gitea` | 28.0.0 | [link](https://pkg.go.dev/gitea.com/gitea/gitea-mcp) | streamable_http | bearer_token | service_account (`mcp-web-app-gitea`) | read-only | 24 | adapter | `web-app-hermes`, `web-app-openclaw`, `web-app-openwebui` | — | -| `web-app-gitlab` | — | [link](https://docs.gitlab.com/user/gitlab_duo/model_context_protocol/mcp_server/) | streamable_http | bearer_token | service_account (`mcp-web-app-gitlab`) | read-only | 14 | adapter | `web-app-hermes`, `web-app-openclaw`, `web-app-openwebui` | — | -| `web-app-hermes` | v2026.9.7 | [link](https://hermes-agent.nousresearch.com/) | — | — | — | read-only | — | native | — | — | -| `web-app-homeassistant` | 2026.7 | [link](https://www.home-assistant.io/integrations/mcp_server/) | streamable_http | bearer_token | service_account (`mcp-web-app-homeassistant`) | read-only | 10 | native | `web-app-flowise`, `web-app-hermes`, `web-app-openclaw`, `web-app-openwebui` | — | -| `web-app-jellyfin` | 10.11.11 | [link](https://s.infinito.nexus/code) | streamable_http | bearer_token | service_account (`mcp-web-app-jellyfin`) | read-only | 3 | adapter | `web-app-hermes`, `web-app-openclaw`, `web-app-openwebui` | — | -| `web-app-jenkins` | 2.568.3-lts | [link](https://plugins.jenkins.io/mcp-server/) | streamable_http | bearer_token | service_account (`mcp-web-app-jenkins`) | read-only | 15 | adapter | `web-app-hermes`, `web-app-openclaw`, `web-app-openwebui` | — | -| `web-app-listmonk` | v6.2.0 | [link](https://s.infinito.nexus/code) | streamable_http | bearer_token | service_account (`mcp-web-app-listmonk`) | read-only | 3 | adapter | `web-app-hermes`, `web-app-openclaw`, `web-app-openwebui` | — | -| `web-app-mattermost` | 11.11.1 | [link](https://github.com/mattermost/mattermost-plugin-agents/blob/master/mcpserver/README.md) | streamable_http | bearer_token | service_account (`mcp-web-app-mattermost`) | read-only | 11 | adapter | `web-app-hermes`, `web-app-openclaw`, `web-app-openwebui` | — | -| `web-app-moodle` | 8.3-fpm | [link](https://moodle.org/plugins/webservice_mcp) | streamable_http | bearer_token | service_account (`mcp-web-app-moodle`) | read-only | 5 | plugin | `web-app-hermes`, `web-app-openclaw`, `web-app-openwebui` | — | -| `web-app-n8n` | 1.100.1 | [link](https://github.com/n8n-io/n8n/tree/n8n%401.100.1/packages/%40n8n/nodes-langchain/nodes/mcp) | streamable_http | bearer_token | service_account (`mcp-web-app-n8n`) | read-only | 1 | native | `web-app-hermes`, `web-app-openclaw`, `web-app-openwebui` | — | -| `web-app-nextcloud` | 34-fpm-alpine | [link](https://docs.nextcloud.com/server/latest/admin_manual/ai/app_context_agent.html) | streamable_http | bearer_token | service_account (`mcp-web-app-nextcloud`) | read-only | 9 | adapter | `web-app-hermes`, `web-app-openclaw`, `web-app-openwebui` | — | -| `web-app-openclaw` | 2026.7.1 | [link](https://openclaw.ai/) | — | — | — | read-only | — | native | — | — | -| `web-app-openwebui` | 0.11.0 | [link](https://docs.openwebui.com/features/extensibility/mcp/) | — | — | — | read-only | — | native | — | — | -| `web-app-pretix` | 2026.8.0 | [link](https://s.infinito.nexus/code) | streamable_http | bearer_token | service_account (`mcp-web-app-pretix`) | read-only | 3 | adapter | `web-app-hermes`, `web-app-openclaw`, `web-app-openwebui` | — | -| `web-app-prometheus` | v3.14.0 | [link](https://s.infinito.nexus/code) | streamable_http | bearer_token | service_account (`mcp-web-app-prometheus`) | read-only | 3 | adapter | `web-app-flowise`, `web-app-hermes`, `web-app-openclaw`, `web-app-openwebui` | — | -| `web-app-snipe-it` | — | [link](https://s.infinito.nexus/code) | streamable_http | bearer_token | service_account (`mcp-web-app-snipe-it`) | read-only | 3 | adapter | `web-app-hermes`, `web-app-openclaw`, `web-app-openwebui` | — | -| `web-app-wordpress` | 7.1.0 | [link](https://github.com/WordPress/mcp-adapter/tree/v0.5.0) | streamable_http | basic_auth | service_account (`mcp-web-app-wordpress`) | read-only | 3 | plugin | `web-app-hermes`, `web-app-openclaw` | — | -| `web-app-zammad` | 7.1.2 | [link](https://s.infinito.nexus/code) | streamable_http | bearer_token | service_account (`mcp-web-app-zammad`) | read-only | 3 | adapter | `web-app-hermes`, `web-app-openclaw`, `web-app-openwebui` | — | -| `web-svc-libretranslate` | v1.9.6 | [link](https://s.infinito.nexus/code) | streamable_http | bearer_token | service_account (`mcp-web-svc-libretranslate`) | read-only | 2 | adapter | `web-app-hermes`, `web-app-openclaw`, `web-app-openwebui` | — | diff --git a/docs/requirements/035-mcp-proxy-expansion.md b/docs/requirements/035-mcp-proxy-expansion.md index 7e944c2d9b..7df7fa46bf 100644 --- a/docs/requirements/035-mcp-proxy-expansion.md +++ b/docs/requirements/035-mcp-proxy-expansion.md @@ -529,7 +529,7 @@ Sidecars and adapters MUST use an immutable version and digest, documented prove ### Audit and metadata - [x] A test discovers every role with a literal `application_id` and proves that it appears exactly once as `native_server`, `native_client`, `native_both`, `plugin_server`, `sidecar_server`, `adapter_server`, `adapter_candidate`, `blocked`, `enabler`, `subordinate`, or `no_surface`; absence is not an audit result. -- [x] The operational metadata remains role-local, while the generated audit report includes deployed version, authoritative source, transport, authentication, real credential subject, read/write scope, tool allowlist, proposed implementation, selected consumers, and blocker. [audit.md](../contributing/design/role/services/mcp/audit.md) is rendered by [cli/build/docs/mcp_audit](../../cli/build/docs/mcp_audit/__main__.py) through `make mcp-audit`, which only reads `meta/mcp.yml` and never writes back into a role; [test_mcp_audit_report.py](../../tests/lint/repository/documentation/test_mcp_audit_report.py) imports the generator and fails when the committed report differs from a fresh run. +- [x] The operational metadata stays role-local: authoritative source, transport, authentication, real credential subject, read/write scope, tool allowlist, proposed implementation, selected consumers, and blocker all live in the role's own `meta/mcp.yml`, and [test_mcp_schema.py](../../tests/lint/ansible/services/test_mcp_schema.py) enforces their shape there. A generated report aggregating them was removed: scope and credential subject were identical for every role, so the table restated its sources instead of deriving anything from them. - [x] Lint accepts `implementation: adapter` only with one allowed adapter type and all mandatory immutable-source, credential, endpoint, limit, and tool-contract fields. [test_mcp_schema.py](../../tests/lint/ansible/services/test_mcp_schema.py) rejects a type outside `MCP_ADAPTER_TYPES`, a `specification_path` that is not a checked-in file under `roles//files/`, a missing `specification_sha256`, and a server-capable block missing `credential`, `endpoint` or `limits` — each with its required sub-keys. - [x] Lint rejects every generic URL/spec/query/SQL/filesystem/shell/socket/unrestricted-bucket surface described in this requirement. - [x] WordPress, Discourse, Odoo, Hermes, OpenClaw, Flowise, and the 11 missing upstream-path roles are reclassified exactly as required above before their old status is considered complete. diff --git a/package-lock.json b/package-lock.json index d4862cbe38..219614de7d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,8 +12,8 @@ "@playwright/test": "^1.63.0", "eslint": "^10.9.1", "eslint-plugin-playwright": "^2.10.5", - "globals": "^17.12.0", - "stylelint": "^17.15.0" + "globals": "^17.13.0", + "stylelint": "^17.16.0" } }, "node_modules/@babel/code-frame": { @@ -1233,9 +1233,9 @@ } }, "node_modules/globals": { - "version": "17.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-17.12.0.tgz", - "integrity": "sha512-cezEd/DTyyht9cvSSURyygXPfy04GtWO/5e6ZPvH7fCtjKz9PYOmuawphw1Ctd1f6C+5JypXfGD7ahNMXvevBA==", + "version": "17.13.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-17.13.0.tgz", + "integrity": "sha512-RwMTC61u7hrG3ZJMkZQOK4JLJrKS8QtoTii63EmWvFXHqycY9FObBJQCbsLxSO8kjKhWE5kV1GC+Vb1g3RI0Zg==", "dev": true, "license": "MIT", "engines": { @@ -2134,9 +2134,9 @@ } }, "node_modules/stylelint": { - "version": "17.15.0", - "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-17.15.0.tgz", - "integrity": "sha512-mWIkesYQvQjf4Kvdeu9ns0IL8/K/wtjaGxPqsPd6DlLZvaQxGysJsocxUDrBcyHQ5VleAk4uSMat4yMrVED7PA==", + "version": "17.16.0", + "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-17.16.0.tgz", + "integrity": "sha512-ejlWnbJ13x1GU32+zZXa6sYQJsKKkwSdv2B4rAdO3OWdEmvhSJKcXi5pOphQYSzyaj1kXpuGJr7pcMBNfDIuPw==", "dev": true, "funding": [ { diff --git a/package.json b/package.json index d7d0852297..d07df50441 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ "@playwright/test": "^1.63.0", "eslint": "^10.9.1", "eslint-plugin-playwright": "^2.10.5", - "globals": "^17.12.0", - "stylelint": "^17.15.0" + "globals": "^17.13.0", + "stylelint": "^17.16.0" }, "overrides": { "brace-expansion": "^5.0.12" diff --git a/pyproject.toml b/pyproject.toml index 01f71d6ebb..bd4e1d5efc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ deploy = [ "requests", ] dev = [ - "ruff==0.16.9", + "ruff==0.16.10", "import-linter", "pre-commit", "git-maintainer-tools", diff --git a/requirements/requirements.galaxy.yml b/requirements/requirements.galaxy.yml index 30d8759605..0a1db299fb 100644 --- a/requirements/requirements.galaxy.yml +++ b/requirements/requirements.galaxy.yml @@ -9,7 +9,7 @@ collections: - name: community.general version: 13.4.0 - name: community.docker - version: 5.3.0 + version: 5.4.0 - name: community.library_inventory_filtering_v1 version: 1.1.5 - name: hetzner.hcloud diff --git a/requirements/requirements.git.yml b/requirements/requirements.git.yml index fbc7e57776..eef6cbd713 100644 --- a/requirements/requirements.git.yml +++ b/requirements/requirements.git.yml @@ -23,7 +23,7 @@ collections: - name: community.docker source: https://github.com/ansible-collections/community.docker.git type: git - version: 5.3.0 + version: 5.4.0 - name: community.library_inventory_filtering_v1 source: https://github.com/ansible-collections/community.library_inventory_filtering.git diff --git a/roles/web-app-hermes/meta/services.yml b/roles/web-app-hermes/meta/services.yml index eeb8442dc1..52659b771f 100644 --- a/roles/web-app-hermes/meta/services.yml +++ b/roles/web-app-hermes/meta/services.yml @@ -15,7 +15,7 @@ hermes: backup: no_stop_required: true image: nousresearch/hermes-agent - version: "v2026.9.7" + version: "v2026.9.24" name: hermes min_storage: 1146MB cpus: "2.0" diff --git a/roles/web-app-jenkins/meta/services.yml b/roles/web-app-jenkins/meta/services.yml index 5de40828aa..82d24d976b 100644 --- a/roles/web-app-jenkins/meta/services.yml +++ b/roles/web-app-jenkins/meta/services.yml @@ -46,7 +46,7 @@ jenkins: # nocheck: single-replica replicas: 1 image: jenkins/jenkins - version: 2.568.3-lts + version: 2.580.1-lts custom: true name: jenkins ports: diff --git a/roles/web-app-mobilizon/TODO.md b/roles/web-app-mobilizon/TODO.md new file mode 100644 index 0000000000..123fe6e004 --- /dev/null +++ b/roles/web-app-mobilizon/TODO.md @@ -0,0 +1,3 @@ +# TODO + +- Drop the custom image build once the pinned Mobilizon release ships the PostgreSQL 18 migration fix (upstream merge request 1683, milestone 5.3.0). The build of `files/Dockerfile` fails on that release and names the migration that no longer needs the patch. Then delete `files/Dockerfile`, the `build` block in `templates/compose.yml.j2`, `MOBILIZON_IMAGE` and `MOBILIZON_VERSION` in `vars/main.yml`, and `custom: true` in `meta/services.yml`. diff --git a/roles/web-app-mobilizon/files/Dockerfile b/roles/web-app-mobilizon/files/Dockerfile new file mode 100644 index 0000000000..165a86a54b --- /dev/null +++ b/roles/web-app-mobilizon/files/Dockerfile @@ -0,0 +1,18 @@ +ARG MOBILIZON_IMAGE +ARG MOBILIZON_VERSION +FROM ${MOBILIZON_IMAGE}:${MOBILIZON_VERSION} + +RUN set -eu; \ + cd /lib/mobilizon-*/priv/repo/migrations; \ + for migration in \ + 20190806131306_add_url_to_follows_and_move_to_uuid.exs \ + 20190813160207_add_url_and_uuid_to_participants.exs \ + 20200218170232_move_member_id_to_uuid.exs \ + 20200721131521_add_url_to_conversation.exs; \ + do \ + if ! grep -q 'add(:id, :uuid, primary_key: true)$' "${migration}"; then \ + echo "${migration} no longer contains 'add(:id, :uuid, primary_key: true)': the base image ships the PostgreSQL 18 migration fix (framagit.org/kaihuri/mobilizon merge request 1683). Drop this Dockerfile and the custom build of web-app-mobilizon." >&2; \ + exit 1; \ + fi; \ + sed -i 's/add(:id, :uuid, primary_key: true)$/add(:id, :uuid, primary_key: true, null: false)/' "${migration}"; \ + done diff --git a/roles/web-app-mobilizon/meta/services.yml b/roles/web-app-mobilizon/meta/services.yml index 02e75b269c..14491f93d0 100644 --- a/roles/web-app-mobilizon/meta/services.yml +++ b/roles/web-app-mobilizon/meta/services.yml @@ -40,6 +40,7 @@ mobilizon: image: docker.io/kaihuri/mobilizon name: mobilizon version: 5.2.4 + custom: true min_storage: 825MB titel: Mobilizon on {{ DOMAIN_PRIMARY | upper }} ports: diff --git a/roles/web-app-mobilizon/templates/compose.yml.j2 b/roles/web-app-mobilizon/templates/compose.yml.j2 index e1d93b4ab2..28d8819bc7 100644 --- a/roles/web-app-mobilizon/templates/compose.yml.j2 +++ b/roles/web-app-mobilizon/templates/compose.yml.j2 @@ -1,6 +1,10 @@ {% include 'roles/sys-svc-compose/templates/base.yml.j2' %} {% set service_name = 'mobilizon' %} {{ service_name }}: + {{ lookup('template', 'roles/sys-svc-container/templates/build.yml.j2') | indent(4) }} + args: + MOBILIZON_IMAGE: "{{ MOBILIZON_IMAGE }}" + MOBILIZON_VERSION: "{{ MOBILIZON_VERSION }}" {{ lookup('container_image', application_id, 'mobilizon') }} {{ lookup('compose_only', 'container_name', mobilizon_container) }} {{ lookup('container_volumes', service_name) | indent(4) }} diff --git a/roles/web-app-mobilizon/vars/main.yml b/roles/web-app-mobilizon/vars/main.yml index 6dd288e199..81bc2753b2 100644 --- a/roles/web-app-mobilizon/vars/main.yml +++ b/roles/web-app-mobilizon/vars/main.yml @@ -4,4 +4,6 @@ container_port: "{{ lookup('config', application_id, 'services.mobilizon.ports.i mobilizon_host_conf_exs_file: "{{ [ lookup('container', application_id, 'directories.config'), 'config.exs' ] | path_join }}" mobilizon_container: "{{ lookup('config', application_id, 'services.mobilizon.name') }}" +MOBILIZON_IMAGE: "{{ lookup('config', application_id, 'services.mobilizon.image') }}" +MOBILIZON_VERSION: "{{ lookup('config', application_id, 'services.mobilizon.version') }}" MOBILIZON_OIDC_ENABLED: "{{ lookup('config', application_id, 'services.sso.enabled') }}" diff --git a/roles/web-app-openbao/README.md b/roles/web-app-openbao/README.md index 32f0c851fd..e0f61a186d 100644 --- a/roles/web-app-openbao/README.md +++ b/roles/web-app-openbao/README.md @@ -36,6 +36,7 @@ flowchart LR svc_email["email ❌"] svc_prometheus["prometheus"] svc_openbao["openbao"] + svc_auth_ldap["auth-ldap"] svc_tor["tor"] svc_container_backup["container_backup"] end @@ -111,6 +112,7 @@ docker run --rm -it \ - **Every deploy rotates the AppRole.** The `role_id`/`secret_id` a run is handed are not the ones the running instance holds. `tasks/01_init.yml` tries the inventory pair, falls back to the pair recorded in `.applied.json`, then `tasks/06_rotate.yml` re-pins to this run's values and destroys the old SecretID. The record is written last, so a run that dies partway leaves the previous generation intact. `custom-secret-id` is **not** idempotent — re-writing a held SecretID answers `500` — so the swap is gated on the value having changed. - **Bootstrap leaves no stored root token.** The first deploy holds it in memory, pins both AppRole halves to inventory values, then revokes it. Tokens reach the CLI through stdin and the container token helper, never through process arguments, and the helper file is removed at the end of the run. - **Paths that look wrong and are not.** Policies mount at `/openbao/policies/`, because OpenBao parses *every* file under `-config` as server configuration. Storage is `/openbao/file`, not `/openbao/data`: the image pre-chowns only `/openbao/{config,logs,file}` for the non-root `openbao` user, so a volume elsewhere lands root-owned and raft cannot write. `command:` is just `server` — the entrypoint appends `-config` itself, and passing it duplicates the flag. +- **The LDAP auth method is an external plugin.** `files/Dockerfile` copies the `openbao-plugin-auth-ldap` binary out of the `auth-ldap` image declared in `meta/services.yml` into `/opt/openbao/plugins`, and `templates/plugins.hcl.j2` registers it as `plugin "auth" "ldap"` under the tag of that image. The file sets `plugin_auto_register = true` explicitly, because the server loads a config directory and 2.7.1 does not apply the documented default on that path. The mount is enabled with `-plugin-version=latest`, so it loads whichever plugin version the running image ships. To upgrade the plugin, bump `auth-ldap.version` and redeploy. `tasks/addons/auth-ldap.yml` tunes and reloads a mount that the former builtin engine created. - **Do not alert on `vault_core_unsealed`.** OpenBao keeps Vault's metric namespace, and a healthy unsealed node emits `vault_core_unsealed{cluster=""} 0`, so an alert on `== 0` fires permanently. Use `/v1/sys/health` (503 while sealed); `vault_core_active{cluster="…"} == 1` corroborates. - **Alert rules ship with the role.** `templates/prometheus/alert_rules.yml.j2` is discovered by the `alert_rule_roles` lookup, which returns only roles that are actually scraped, so the fragment carries no activation guard of its own. It must start at the `groups:` item level. - **Swarm:** single replica, `placement: manager`, `nfs: false` on the raft volume, `service_update_order = stop-first`. Raft's BoltDB store is mmap + `fsync` based, so it must stay node-local and must never have two tasks writing one directory. diff --git a/roles/web-app-openbao/files/Dockerfile b/roles/web-app-openbao/files/Dockerfile new file mode 100644 index 0000000000..b2ab407ead --- /dev/null +++ b/roles/web-app-openbao/files/Dockerfile @@ -0,0 +1,21 @@ +ARG OPENBAO_IMAGE +ARG OPENBAO_VERSION +ARG OPENBAO_LDAP_PLUGIN_IMAGE +ARG OPENBAO_LDAP_PLUGIN_VERSION + +FROM ${OPENBAO_LDAP_PLUGIN_IMAGE}:${OPENBAO_LDAP_PLUGIN_VERSION} AS ldap-plugin + +FROM ${OPENBAO_IMAGE}:${OPENBAO_VERSION} AS plugins + +ARG OPENBAO_PLUGIN_DIR +ARG OPENBAO_LDAP_PLUGIN_BINARY + +USER root +COPY --from=ldap-plugin /${OPENBAO_LDAP_PLUGIN_BINARY} ${OPENBAO_PLUGIN_DIR}/${OPENBAO_LDAP_PLUGIN_BINARY} +RUN chmod 0555 "${OPENBAO_PLUGIN_DIR}/${OPENBAO_LDAP_PLUGIN_BINARY}" + +FROM ${OPENBAO_IMAGE}:${OPENBAO_VERSION} + +ARG OPENBAO_PLUGIN_DIR + +COPY --from=plugins ${OPENBAO_PLUGIN_DIR} ${OPENBAO_PLUGIN_DIR} diff --git a/roles/web-app-openbao/files/playwright/addons/auth-ldap.spec.js b/roles/web-app-openbao/files/playwright/addons/auth-ldap.spec.js new file mode 100644 index 0000000000..cf3285c243 --- /dev/null +++ b/roles/web-app-openbao/files/playwright/addons/auth-ldap.spec.js @@ -0,0 +1,45 @@ +const { test, expect } = require("@playwright/test"); +const { normalizeBaseUrl, decodeDotenvQuotedValue } = require("../personas"); +const { skipUnlessAddonEnabled } = require("../addon-gating"); +const { resolveTimeout } = require("../timeouts"); + +const baseUrl = normalizeBaseUrl(process.env.OPENBAO_BASE_URL || ""); +const adminUsername = decodeDotenvQuotedValue(process.env.ADMIN_USERNAME || ""); +const adminPassword = decodeDotenvQuotedValue(process.env.ADMIN_PASSWORD || ""); + +test.use({ ignoreHTTPSErrors: true }); + +test("addon auth-ldap: the ldap mount is served by the external plugin", async ({ request }) => { + skipUnlessAddonEnabled("auth-ldap"); + + const login = await request.post( + `${baseUrl}/v1/auth/ldap/login/${encodeURIComponent(adminUsername)}`, + { data: { password: adminPassword }, failOnStatusCode: false, timeout: resolveTimeout(30_000) }, + ); + expect( + login.status(), + `expected the LDAP plugin to accept the administrator, got ${login.status()}`, + ).toBe(200); + const token = (await login.json()).auth.client_token; + + const mounts = await request.get(`${baseUrl}/v1/sys/auth`, { + headers: { "X-Vault-Token": token }, + failOnStatusCode: false, + timeout: resolveTimeout(30_000), + }); + expect( + mounts.status(), + `expected the administrator policy to read sys/auth, got ${mounts.status()}`, + ).toBe(200); + + const ldap = (await mounts.json()).data["ldap/"]; + expect(ldap, "sys/auth must list the ldap/ mount").toBeTruthy(); + expect( + ldap.plugin_version, + "the mount must follow whichever plugin version the image ships", + ).toBe("latest"); + expect( + ldap.running_plugin_version, + "an external plugin reports its own semantic version", + ).toMatch(/^v\d+\.\d+\.\d+/); +}); diff --git a/roles/web-app-openbao/meta/addons/auth-ldap.yml b/roles/web-app-openbao/meta/addons/auth-ldap.yml new file mode 100644 index 0000000000..bc15183065 --- /dev/null +++ b/roles/web-app-openbao/meta/addons/auth-ldap.yml @@ -0,0 +1,7 @@ +--- +enabled: "{{ lookup('config', 'web-app-openbao', 'services.ldap.enabled') | bool }}" +required: true +mechanism: plugin +source: built +bridges: + - ldap diff --git a/roles/web-app-openbao/meta/services.yml b/roles/web-app-openbao/meta/services.yml index 1f6c913ce8..1321062f6e 100644 --- a/roles/web-app-openbao/meta/services.yml +++ b/roles/web-app-openbao/meta/services.yml @@ -51,7 +51,8 @@ openbao: pids_limit: 512 min_storage: 60MB image: openbao/openbao - version: "2.6.2" + version: "2.7.1" + custom: true backup: no_stop_required: false # nocheck: single-replica single-node raft: a second replica would need a real raft join/bootstrap flow, and two tasks against one BoltDB directory corrupt the store @@ -72,6 +73,12 @@ openbao: - web-app-keycloak - svc-db-openldap lifecycle: beta +# nocheck: playwright-service-flag build-stage image of the LDAP auth plugin binary, never deployed as a container +# nocheck: dynamic-flag build-stage image, not group-gated +auth-ldap: + image: ghcr.io/openbao/openbao-plugin-auth-ldap + version: "v0.1.0" + enabled: false # nocheck: playwright-service-flag # nocheck: variants-coverage — sso-variant-tor requires the onion on in every variant, so the false polarity has no variant left to live in diff --git a/roles/web-app-openbao/meta/volumes.yml b/roles/web-app-openbao/meta/volumes.yml index b5be36ffcb..fe09c6996c 100644 --- a/roles/web-app-openbao/meta/volumes.yml +++ b/roles/web-app-openbao/meta/volumes.yml @@ -25,6 +25,14 @@ config: - service: openbao target: /openbao/config/openbao.hcl +config_plugins: + type: config + source: "{{ [lookup('container', 'web-app-openbao', 'directories.config'), 'plugins.hcl'] | path_join }}" + mode: "0444" + mounts: + - service: openbao + target: /openbao/config/plugins.hcl + policy_ansible_admin: type: config source: "{{ [lookup('container', 'web-app-openbao', 'directories.config'), 'policies', 'ansible-admin.hcl'] | path_join }}" diff --git a/roles/web-app-openbao/tasks/00_core.yml b/roles/web-app-openbao/tasks/00_core.yml index 1201b61e79..9873c3c2c0 100644 --- a/roles/web-app-openbao/tasks/00_core.yml +++ b/roles/web-app-openbao/tasks/00_core.yml @@ -33,6 +33,9 @@ - src: "openbao.hcl.j2" dest: "{{ OPENBAO_CONFIG_HOST }}" mode: "0644" + - src: "plugins.hcl.j2" + dest: "{{ OPENBAO_PLUGINS_CONFIG_HOST }}" + mode: "0644" - src: "policies/ansible-admin.hcl.j2" dest: "{{ [OPENBAO_POLICY_DIR_HOST, 'ansible-admin.hcl'] | path_join }}" mode: "0644" diff --git a/roles/web-app-openbao/tasks/04_auth_methods.yml b/roles/web-app-openbao/tasks/04_auth_methods.yml index ac49e7ab29..aef0d410ff 100644 --- a/roles/web-app-openbao/tasks/04_auth_methods.yml +++ b/roles/web-app-openbao/tasks/04_auth_methods.yml @@ -45,36 +45,11 @@ delegate_to: "{{ OPENBAO_HOST_NODE }}" - name: "📇 Configure the LDAP auth method against svc-db-openldap" + ansible.builtin.include_tasks: + file: addons/auth-ldap.yml + apply: + delegate_to: "{{ OPENBAO_HOST_NODE }}" when: OPENBAO_LDAP_ENABLED | bool - block: - - name: "🧩 Enable the LDAP auth method" - ansible.builtin.shell: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node - container exec {{ OPENBAO_LOCAL_CID | quote }} - sh -c 'bao auth list -format=json | grep -q "ldap/" || - { bao auth enable ldap && echo OPENBAO_CHANGED; }' - register: openbao_ldap_enable - changed_when: "'OPENBAO_CHANGED' in openbao_ldap_enable.stdout" - delegate_to: "{{ OPENBAO_HOST_NODE }}" - - - name: "📇 Point the LDAP method at the directory" - ansible.builtin.shell: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node - container exec -i {{ OPENBAO_LOCAL_CID | quote }} - bao write auth/ldap/config - url={{ OPENBAO_LDAP_URL | quote }} - userdn={{ LDAP.DN.OU.USERS | quote }} - userattr={{ OPENBAO_LDAP_USER_ATTR | quote }} - groupdn={{ LDAP.DN.OU.ROLES | quote }} - groupattr=cn - binddn={{ LDAP.DN.ADMINISTRATOR.DATA | quote }} - bindpass=- - insecure_tls=false - starttls=false - args: - stdin: "{{ LDAP.BIND_CREDENTIAL }}" - stdin_add_newline: false - changed_when: false - delegate_to: "{{ OPENBAO_HOST_NODE }}" - no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" - name: "🔍 Read the auth mount accessors" ansible.builtin.shell: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node diff --git a/roles/web-app-openbao/tasks/addons/auth-ldap.yml b/roles/web-app-openbao/tasks/addons/auth-ldap.yml new file mode 100644 index 0000000000..c1c34f1e2e --- /dev/null +++ b/roles/web-app-openbao/tasks/addons/auth-ldap.yml @@ -0,0 +1,38 @@ +--- +# include-gated: when: OPENBAO_LDAP_ENABLED | bool +- name: "🧩 Enable the LDAP auth method" + ansible.builtin.shell: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node + container exec {{ OPENBAO_LOCAL_CID | quote }} + sh -c 'bao auth list -format=json | grep -q "ldap/" || + { bao auth enable -plugin-version=latest ldap && echo OPENBAO_CHANGED; }' + register: openbao_ldap_enable + changed_when: "'OPENBAO_CHANGED' in openbao_ldap_enable.stdout" + +- name: "🔌 Move an LDAP mount of the removed builtin engine onto the plugin" + ansible.builtin.shell: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node + container exec {{ OPENBAO_LOCAL_CID | quote }} + sh -c '[ "$(bao read -field=plugin_version sys/auth/ldap)" = latest ] || + { bao auth tune -plugin-version=latest ldap/ && + bao plugin reload -mounts=auth/ldap/ && + echo OPENBAO_CHANGED; }' + register: openbao_ldap_plugin + changed_when: "'OPENBAO_CHANGED' in openbao_ldap_plugin.stdout" + +- name: "📇 Point the LDAP method at the directory" + ansible.builtin.shell: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node + container exec -i {{ OPENBAO_LOCAL_CID | quote }} + bao write auth/ldap/config + url={{ OPENBAO_LDAP_URL | quote }} + userdn={{ LDAP.DN.OU.USERS | quote }} + userattr={{ OPENBAO_LDAP_USER_ATTR | quote }} + groupdn={{ LDAP.DN.OU.ROLES | quote }} + groupattr=cn + binddn={{ LDAP.DN.ADMINISTRATOR.DATA | quote }} + bindpass=- + insecure_tls=false + starttls=false + args: + stdin: "{{ LDAP.BIND_CREDENTIAL }}" + stdin_add_newline: false + changed_when: false + no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" diff --git a/roles/web-app-openbao/templates/compose.yml.j2 b/roles/web-app-openbao/templates/compose.yml.j2 index 637acc3d86..8d599ec024 100644 --- a/roles/web-app-openbao/templates/compose.yml.j2 +++ b/roles/web-app-openbao/templates/compose.yml.j2 @@ -2,7 +2,15 @@ {% set service_update_order = 'stop-first' %} {% set service_name = 'openbao' %} {{ service_name }}: - {{ lookup('container_image', application_id, 'openbao') }} + {{ lookup('template', 'roles/sys-svc-container/templates/build.yml.j2') | indent(4) }} + args: + OPENBAO_IMAGE: "{{ OPENBAO_IMAGE }}" + OPENBAO_VERSION: "{{ OPENBAO_VERSION }}" + OPENBAO_LDAP_PLUGIN_IMAGE: "{{ OPENBAO_LDAP_PLUGIN_IMAGE }}" + OPENBAO_LDAP_PLUGIN_VERSION: "{{ OPENBAO_LDAP_PLUGIN_VERSION }}" + OPENBAO_LDAP_PLUGIN_BINARY: "{{ OPENBAO_LDAP_PLUGIN_BINARY }}" + OPENBAO_PLUGIN_DIR: "{{ OPENBAO_PLUGIN_DIR_DOCKER }}" + {{ lookup('container_image', application_id, 'openbao', version=OPENBAO_IMAGE_TAG) }} {{ lookup('compose_only', 'container_name', OPENBAO_NAME) }} {% include 'roles/sys-svc-container/templates/base.yml.j2' %} {{ lookup('container_ports', ['openbao', 'http', DOCKER_BIND_HOST]) | indent(4) }} diff --git a/roles/web-app-openbao/templates/playwright.env.j2 b/roles/web-app-openbao/templates/playwright.env.j2 index 930d5a7e6a..c875689f90 100644 --- a/roles/web-app-openbao/templates/playwright.env.j2 +++ b/roles/web-app-openbao/templates/playwright.env.j2 @@ -55,3 +55,5 @@ PERSONA_BIBER_BLOCKED=true PROMETHEUS_SERVICE_ENABLED={{ lookup('config', application_id, 'services.prometheus.enabled') | string | lower }} SSO_SERVICE_ENABLED={{ OPENBAO_SSO_ENABLED | string | lower }} + +{{ lookup('addon_env_flags', application_id) }} diff --git a/roles/web-app-openbao/templates/plugins.hcl.j2 b/roles/web-app-openbao/templates/plugins.hcl.j2 new file mode 100644 index 0000000000..056a510039 --- /dev/null +++ b/roles/web-app-openbao/templates/plugins.hcl.j2 @@ -0,0 +1,8 @@ +plugin_directory = "{{ OPENBAO_PLUGIN_DIR_DOCKER }}" + +plugin_auto_register = true + +plugin "auth" "ldap" { + command = "{{ OPENBAO_LDAP_PLUGIN_BINARY }}" + version = "{{ OPENBAO_LDAP_PLUGIN_VERSION }}" +} diff --git a/roles/web-app-openbao/templates/policies/ansible-admin.hcl.j2 b/roles/web-app-openbao/templates/policies/ansible-admin.hcl.j2 index c35ba50304..c96fe76e97 100644 --- a/roles/web-app-openbao/templates/policies/ansible-admin.hcl.j2 +++ b/roles/web-app-openbao/templates/policies/ansible-admin.hcl.j2 @@ -18,6 +18,10 @@ path "sys/mounts/*" { capabilities = ["create", "read", "update", "delete", "sudo"] } +path "sys/plugins/reload/backend" { + capabilities = ["update"] +} + path "auth/*" { capabilities = ["create", "read", "update", "delete", "list"] } diff --git a/roles/web-app-openbao/vars/main.yml b/roles/web-app-openbao/vars/main.yml index 8117f89516..999b7e6d66 100644 --- a/roles/web-app-openbao/vars/main.yml +++ b/roles/web-app-openbao/vars/main.yml @@ -3,6 +3,14 @@ application_id: "web-app-openbao" container_port: "{{ lookup('config', application_id, 'services.openbao.ports.internal.http') }}" OPENBAO_NAME: "{{ lookup('config', application_id, 'services.openbao.name') }}" +OPENBAO_IMAGE: "{{ lookup('config', application_id, 'services.openbao.image') }}" +OPENBAO_VERSION: "{{ lookup('config', application_id, 'services.openbao.version') }}" + +OPENBAO_LDAP_PLUGIN_IMAGE: "{{ lookup('config', application_id, 'services.auth-ldap.image') }}" +OPENBAO_LDAP_PLUGIN_VERSION: "{{ lookup('config', application_id, 'services.auth-ldap.version') }}" +OPENBAO_LDAP_PLUGIN_BINARY: "openbao-plugin-auth-ldap" +OPENBAO_PLUGIN_DIR_DOCKER: "/opt/openbao/plugins" +OPENBAO_IMAGE_TAG: "{{ OPENBAO_VERSION }}-auth-ldap-{{ OPENBAO_LDAP_PLUGIN_VERSION }}" OPENBAO_SSO_ENABLED: "{{ lookup('config', application_id, 'services.sso.enabled') }}" OPENBAO_LDAP_ENABLED: "{{ lookup('config', application_id, 'services.ldap.enabled') }}" @@ -12,6 +20,7 @@ OPENBAO_LOG_LEVEL: "{{ lookup('config', application_id, 'services.openbao.log_le OPENBAO_BASE_URL: "{{ lookup('tls', application_id, 'url.base') | regex_replace('/+$', '') }}" OPENBAO_CONFIG_HOST: "{{ [lookup('container', application_id, 'directories.config'), 'openbao.hcl'] | path_join }}" +OPENBAO_PLUGINS_CONFIG_HOST: "{{ [lookup('container', application_id, 'directories.config'), 'plugins.hcl'] | path_join }}" OPENBAO_POLICY_DIR_HOST: "{{ [lookup('container', application_id, 'directories.config'), 'policies'] | path_join }}" OPENBAO_POLICY_DIR_DOCKER: "/openbao/policies" OPENBAO_DATA_DOCKER: "{{ lookup('volume', application_id, 'data').target }}" diff --git a/roles/web-app-penpot/meta/services.yml b/roles/web-app-penpot/meta/services.yml index cbb7819792..c75856a556 100644 --- a/roles/web-app-penpot/meta/services.yml +++ b/roles/web-app-penpot/meta/services.yml @@ -52,7 +52,7 @@ seaweedfs: shared: "{{ 'web-app-seaweedfs' in group_names }}" penpot: healthcheck: - flavor: curl + flavor: http_status modes: compose: enabled: true diff --git a/roles/web-app-prometheus/meta/services.yml b/roles/web-app-prometheus/meta/services.yml index 556e747841..449ea24995 100644 --- a/roles/web-app-prometheus/meta/services.yml +++ b/roles/web-app-prometheus/meta/services.yml @@ -55,7 +55,7 @@ prometheus: provides: - prometheus image: prom/prometheus # nocheck: volumes-path-single-spot: the repository path of an image name, not a mount target - version: v3.14.0 + version: v3.15.0 name: prometheus cpus: "0.5" mem_reservation: 512m diff --git a/roles/web-app-socialhome/meta/services.yml b/roles/web-app-socialhome/meta/services.yml index e6aaaf86d0..7992c0a1d8 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.2" + version: "2026.10.4" ports: local: http: 8089 diff --git a/roles/web-app-wordpress/meta/services.yml b/roles/web-app-wordpress/meta/services.yml index 184a533905..cdc0f4ada9 100644 --- a/roles/web-app-wordpress/meta/services.yml +++ b/roles/web-app-wordpress/meta/services.yml @@ -47,7 +47,7 @@ wordpress: enabled: true swarm: enabled: true - version: 7.1.0 + version: 7.1.2 image: wordpress custom: true name: wordpress diff --git a/roles/web-svc-collabora/meta/services.yml b/roles/web-svc-collabora/meta/services.yml index f738b68fb7..f36cc05eba 100644 --- a/roles/web-svc-collabora/meta/services.yml +++ b/roles/web-svc-collabora/meta/services.yml @@ -13,8 +13,7 @@ redis: shared: "{{ 'svc-db-redis' in group_names }}" collabora: healthcheck: - flavor: tcp - path: hosting/discovery + test: ["CMD", "/usr/bin/coolwsd", "--probe", "--use-env-vars"] modes: compose: enabled: true @@ -26,11 +25,7 @@ collabora: enabled: true shared: true image: collabora/code - # TODO: 26.04.2.2.1 rebuilt the image as a Nix minimal image without - # coolconfig or a shell (CollaboraOnline/online#16021) — every `docker exec` - # fails. Unpin once the systemplate tasks are migrated to --use-env-vars - # configuration or upstream restores the tooling. - version: "26.04.2.1.1" + version: "26.04.4.2.1" name: collabora min_storage: 734MB cpus: 2 diff --git a/roles/web-svc-collabora/tasks/00_core.yml b/roles/web-svc-collabora/tasks/00_core.yml index d392e52735..8af13db41b 100644 --- a/roles/web-svc-collabora/tasks/00_core.yml +++ b/roles/web-svc-collabora/tasks/00_core.yml @@ -10,19 +10,3 @@ compose_repository_pull: false webserver_vhost_flavour: "basic" application_id: "web-svc-collabora" - -- name: "🖥️ Collabora stack-host-only coolconfig setup" - when: IS_STACK_HOST | bool - block: - - name: "🔍 Resolve collabora hosting node + container id" - ansible.builtin.include_tasks: "{{ lookup('path_absolute', 'roles/sys-svc-compose/tasks/utils/swarm/resolve_host_cid.yml') }}" - vars: - resolve_service_key: collabora - resolve_output_prefix: COLLABORA - resolve_compose_cid: "{{ COLLABORA_CONTAINER_ADDRESS }}" - - - name: "🔧 Run collabora coolconfig on the hosting node" - ansible.builtin.include_tasks: - file: 01_coolconfig.yml - apply: - delegate_to: "{{ COLLABORA_HOST_NODE }}" diff --git a/roles/web-svc-collabora/tasks/01_coolconfig.yml b/roles/web-svc-collabora/tasks/01_coolconfig.yml deleted file mode 100644 index 5c6976a628..0000000000 --- a/roles/web-svc-collabora/tasks/01_coolconfig.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: 🔄 Update Collabora systemplate to include new fonts - shell: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node - container exec {{ COLLABORA_LOCAL_CID | quote }} coolconfig update-system-template - register: collabora_fonts - changed_when: "'updated' in collabora_fonts.stdout" - -- name: 🖥️ Allow Nextcloud host IP for Collabora preview conversion - shell: > # nocheck: container-exec-resolver runtime-resolved CID, delegated to the hosting node - container exec {{ COLLABORA_LOCAL_CID | quote }} coolconfig set net.post_allow.host {{ networks.internet.ip4 }} - register: collabora_preview - changed_when: "'already present' not in collabora_preview.stdout" diff --git a/roles/web-svc-collabora/templates/env.j2 b/roles/web-svc-collabora/templates/env.j2 index eb8ec2f96b..f696c1518b 100644 --- a/roles/web-svc-collabora/templates/env.j2 +++ b/roles/web-svc-collabora/templates/env.j2 @@ -1,4 +1,4 @@ {% include 'roles/sys-svc-container/templates/env.j2' %} domain={{ COLLABORA_ALLOWED_DOMAINS }} -extra_params=--o:ssl.enable=false --o:ssl.termination=true --o:net.service_root=/ --o:net.wopi_allowed_hosts={{ COLLABORA_ALLOWED_HOSTS }} +extra_params=--o:ssl.enable=false --o:ssl.termination=true --o:net.service_root=/ --o:net.wopi_allowed_hosts={{ COLLABORA_ALLOWED_HOSTS }} --o:net.post_allow.host[99]={{ networks.internet.ip4 }}/32 diff --git a/roles/web-svc-collabora/vars/main.yml b/roles/web-svc-collabora/vars/main.yml index 2d1a635077..3def230487 100644 --- a/roles/web-svc-collabora/vars/main.yml +++ b/roles/web-svc-collabora/vars/main.yml @@ -6,7 +6,6 @@ domain: "{{ lookup('domain',application_id) }}" http_port: "{{ lookup('config', application_id, 'services.collabora.ports.local.http') }}" COLLABORA_CONTAINER: "{{ lookup('config', application_id, 'services.collabora.name') }}" -COLLABORA_CONTAINER_ADDRESS: "{{ lookup('container_address', application_id, entity_name) }}" COLLABORA_ALLOWED_DOMAINS: "(.*\\.|){{ DOMAIN_PRIMARY | regex_replace('\\.', '\\\\.') }}" COLLABORA_ALLOWED_HOSTS: "{{ lookup('domain','web-app-nextcloud') }}" COLLABORA_DISCOVERY_PATH: "/hosting/discovery" diff --git a/scripts/github/update/open/pr.sh b/scripts/github/update/open/pr.sh index f093369356..c99fa9170f 100755 --- a/scripts/github/update/open/pr.sh +++ b/scripts/github/update/open/pr.sh @@ -70,8 +70,8 @@ mapfile -t OPEN_PRS < <( --state open \ --base "${UPDATE_BASE_BRANCH}" \ --limit 100 \ - --json number,headRefName \ - --jq ".[] | select(.headRefName | startswith(\"${UPDATE_DEDUPE_PREFIX}\")) | \"\(.number)\t\(.headRefName)\"" + --json number,headRefName,isCrossRepository \ + --jq ".[] | select(.headRefName | startswith(\"${UPDATE_DEDUPE_PREFIX}\")) | \"\(.number)\t\(.isCrossRepository)\t\(.headRefName)\"" ) DUPLICATE_PR="" @@ -79,6 +79,13 @@ for entry in "${OPEN_PRS[@]}"; do [[ -z "${entry}" ]] && continue pr_num="${entry%%$'\t'*}" pr_branch="${entry##*$'\t'}" + pr_cross_repo="${entry#*$'\t'}" + pr_cross_repo="${pr_cross_repo%%$'\t'*}" + if [[ "${pr_cross_repo}" == "false" && "${pr_branch}" == *"-${LOCAL_FP:0:7}" ]]; then + echo " open PR #${pr_num} (${pr_branch}): branch name carries this fingerprint" + DUPLICATE_PR="${pr_num}" + break + fi pr_head="$(gh pr view "${pr_num}" --repo "${REPO}" --json headRefOid --jq .headRefOid 2>/dev/null || true)" if [[ -z "${pr_head}" ]] || ! git fetch --quiet --depth 1 origin "${pr_head}" 2>/dev/null; then echo " open PR #${pr_num} (${pr_branch}): head unfetchable; treating as non-duplicate" diff --git a/tests/lint/repository/documentation/test_mcp_audit_report.py b/tests/lint/repository/documentation/test_mcp_audit_report.py deleted file mode 100644 index 1a766e3ed0..0000000000 --- a/tests/lint/repository/documentation/test_mcp_audit_report.py +++ /dev/null @@ -1,67 +0,0 @@ -"""The committed MCP audit report matches a fresh generation. - -A generated document that nobody regenerates becomes a snapshot of whenever -somebody last remembered, and it reads exactly like a current one. This report -answers "what does each surface expose, as whom, to whom" for reviewers who -will not open twenty-four ``meta/mcp.yml`` files, so a stale row is worse than -no row. - -The check imports the generator and compares its output to the committed file -rather than reimplementing the rendering, so the two cannot disagree about what -"generated" means. - -Fix a failure by regenerating and committing, never by editing the report. -""" - -from __future__ import annotations - -import unittest - -from cli.build.docs.mcp_audit import __main__ as generator -from utils.cache.files import read_text -from utils.roles.mapping import ROLE_FILE_META_MCP - -from . import PROJECT_ROOT - -_DOCS = PROJECT_ROOT / "docs" / "contributing" / "design" / "role" / "services" / "mcp" -_REPORT = _DOCS / "audit.md" - - -def _load_generator(): - return generator - - -class TestMcpAuditReport(unittest.TestCase): - def test_the_committed_report_is_freshly_generated(self) -> None: - rendered = _load_generator().render() - committed = read_text(str(_REPORT)) - self.assertEqual( - rendered, - committed, - f"{_REPORT.name} differs from a fresh generation. Regenerate and " - "commit it by running `make mcp-audit`", - ) - - def test_the_report_carries_a_row_per_role_with_metadata(self) -> None: - module = _load_generator() - roles = sorted( - p.parent.parent.name - for p in module.ROLES_DIR.glob(f"*/{ROLE_FILE_META_MCP}") - ) - self.assertTrue( - roles, - "no role owns meta/mcp.yml, so the report would be empty and this " - "rule would pass vacuously", - ) - committed = read_text(str(_REPORT)) - missing = [role for role in roles if f"`{role}`" not in committed] - self.assertEqual( - [], - missing, - "role(s) owning MCP metadata but absent from the report:\n" - + "\n".join(f" - {m}" for m in missing), - ) - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/unit/python/scripts/github/update/__init__.py b/tests/unit/python/scripts/github/update/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/python/scripts/github/update/open/__init__.py b/tests/unit/python/scripts/github/update/open/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/python/scripts/github/update/open/test_pr.py b/tests/unit/python/scripts/github/update/open/test_pr.py new file mode 100644 index 0000000000..bf7f47b3c0 --- /dev/null +++ b/tests/unit/python/scripts/github/update/open/test_pr.py @@ -0,0 +1,135 @@ +from __future__ import annotations + +import os +import subprocess +import tempfile +import unittest +from pathlib import Path + +from utils.cache.files import PROJECT_ROOT + +SCRIPT = PROJECT_ROOT / "scripts" / "github" / "update" / "open" / "pr.sh" +PINNED_FILE = "pin.txt" +GH_STUB = """#!/usr/bin/env bash +if [[ "$1 $2" == "pr list" ]]; then + printf '7\\t%s\\t%s\\n' "${GH_STUB_CROSS_REPO}" "${GH_STUB_BRANCH}" +fi +""" + + +class UpdatePrFixture: + """A throwaway repo with one pending pin bump and a ``gh`` that lists one open PR. + + Args: + tmp: directory that holds the repo and the ``gh`` stub. + """ + + def __init__(self, tmp: str) -> None: + self.repo = Path(tmp) / "repo" + self.repo.mkdir() + stub_dir = Path(tmp) / "bin" + stub_dir.mkdir() + stub = stub_dir / "gh" + stub.write_text(GH_STUB) + stub.chmod(0o755) + inherited = {k: v for k, v in os.environ.items() if not k.startswith("GIT_")} + self.env = { + **inherited, + "PATH": f"{stub_dir}{os.pathsep}{os.environ['PATH']}", + "GIT_CONFIG_GLOBAL": os.devnull, + "GIT_ALLOW_PROTOCOL": "file", + "GH_TOKEN": "unused", + "UPDATE_BRANCH_PREFIX": "update/pins", + "UPDATE_BRANCH_SUFFIX": "20260101", + "UPDATE_BASE_BRANCH": "main", + "UPDATE_COMMIT_MESSAGE": "update: bump", + "UPDATE_PR_TITLE": "update: bump", + "UPDATE_PR_BODY": "bump", + } + self.git("init", "-b", "main") + self.git("remote", "add", "origin", "https://github.com/acme/widgets.git") + (self.repo / PINNED_FILE).write_text("1.0\n") + self.git("add", "-A") + self.git( + "-c", + "user.name=test", + "-c", + "user.email=test@example.invalid", + "commit", + "-m", + "init", + ) + (self.repo / PINNED_FILE).write_text("1.1\n") + + def git(self, *args: str, stdin: str | None = None) -> str: + return subprocess.run( + ["git", *args], + cwd=self.repo, + env=self.env, + input=stdin, + capture_output=True, + text=True, + check=True, + ).stdout.strip() + + def fingerprint(self) -> str: + blob = self.git("hash-object", PINNED_FILE) + return self.git("hash-object", "--stdin", stdin=f"{blob}\t{PINNED_FILE}\n") + + def open_pr( + self, open_branch: str, cross_repo: bool = False + ) -> subprocess.CompletedProcess: + """Run the script while ``gh`` lists one open PR. + + Args: + open_branch: head branch name of that PR. + cross_repo: whether that PR comes from a fork. + """ + return subprocess.run( + ["bash", str(SCRIPT)], + cwd=self.repo, + env={ + **self.env, + "GH_STUB_BRANCH": open_branch, + "GH_STUB_CROSS_REPO": str(cross_repo).lower(), + }, + capture_output=True, + text=True, + check=False, + ) + + +class TestUpdatePrDedupe(unittest.TestCase): + def test_edited_branch_of_the_same_proposal_is_a_duplicate(self) -> None: + with tempfile.TemporaryDirectory() as tmp: + fixture = UpdatePrFixture(tmp) + branch = f"update/pins-20251231-{fixture.fingerprint()[:7]}" + result = fixture.open_pr(branch) + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + self.assertIn("Open PR #7 already carries this exact change", result.stdout) + self.assertNotIn("Pushing change to branch", result.stdout) + + def test_fork_branch_with_the_same_suffix_is_not_a_duplicate(self) -> None: + with tempfile.TemporaryDirectory() as tmp: + fixture = UpdatePrFixture(tmp) + suffix = fixture.fingerprint()[:7] + result = fixture.open_pr(f"update/pins-20251231-{suffix}", cross_repo=True) + self.assertNotIn("already carries this exact change", result.stdout) + self.assertIn( + f"Pushing change to branch update/pins-20260101-{suffix}", + result.stdout, + ) + + def test_branch_of_another_proposal_is_not_a_duplicate(self) -> None: + with tempfile.TemporaryDirectory() as tmp: + fixture = UpdatePrFixture(tmp) + result = fixture.open_pr("update/pins-20251231-0000000") + self.assertNotIn("already carries this exact change", result.stdout) + self.assertIn( + f"Pushing change to branch update/pins-20260101-{fixture.fingerprint()[:7]}", + result.stdout, + ) + + +if __name__ == "__main__": + unittest.main()