Commit Graph
125 Commits
Author SHA1 Message Date
kevinveenbirkenbachandClaude Opus 4.7 951f6d36d2 chore(lint): unify autoformat/galaxy parallelism into one PARALLEL env var
* scripts/lint/autoformat.sh: rename AUTOFORMAT_PARALLEL to PARALLEL,
  declare it at file start with default `true`; still env-overridable.
  Reword the worker comment so the literal `# shellcheck` token no
  longer appears at start-of-line and trips SC1072/SC1073.
* scripts/lint/galaxy.sh: drop the GALAXY_FATAL / GALAXY_NAMESPACE /
  GALAXY_PARALLEL env vars (over-engineered for a single repo). Failure
  is always fatal. NAMESPACE is an internal constant. Add the same
  PARALLEL env var (default `true`, env-overridable); falsy demotes the
  xargs fan-out to one worker.
* docs/contributing/environment/variables.md: collapse the four
  AUTOFORMAT_*/GALAXY_* rows into one `PARALLEL` row covering both
  consumers.
* docs/contributing/tools/make.md: refer to `PARALLEL=0` everywhere;
  add the lint-galaxy parallelism note.

Plus working-tree drift across roles/, group_vars/, inventories/, and
tasks/ that accumulated from the make-test setup phase regenerating
generated artefacts during recent test runs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 00:59:24 +02:00
kevinveenbirkenbachandClaude Opus 4.7 b99b2299ef test(docker): restore raw-docker guard with cache and skip marker
Reintroduce the no_raw_docker integration test that was lost in the
flat-to-clustered tests/integration reorg, scoped to .yml/.yaml/.j2/.sh
and powered by utils.cache.files.iter_non_ignored_files plus read_text
so file enumeration respects .gitignore and content reads are
lru-cached. Catch two argv-/inline-form blind spots that the original
single-line regex missed (argv: - docker / shell: "docker exec ...")
and add a `no-raw-docker: skip` header marker for files where the
container wrapper is genuinely unavailable.

Apply the marker to the 6 GitHub-hosted-runner workflows that cannot
reach the wrapper, and rewrite the 7 role-task argv invocations
(BigBlueButton, Discourse, Matomo, Joomla 03/04/06) onto
'container' so the engine stays swappable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 12:50:36 +02:00
kevinveenbirkenbachandClaude Opus 4.7 6c568e38cf fix(web-app-matomo): patch DB credentials before wait-for-healthy
Multi-round / re-deploy scenarios that change MariaDB credentials
between deploys (matrix-deploy round 2 against the same persistent
volume; rotated vault) deadlocked the matomo install at
"Wait for Matomo container to be healthy". The persistent
`config.ini.php` still carries the previous round's credentials,
matomo loops on `Could not connect to the database: Database access
denied`, the healthcheck never goes green, and the play aborts
before `04_patch_database.yml` can run.

Reorder `roles/web-app-matomo/tasks/01_core.yml`:

- Replace the early wait-for-healthy with a lightweight
  wait-for-running (`Running: true`) so subsequent tasks have a
  container they can `docker exec` into without depending on a DB
  connection.
- Bootstrap (first install) and `04_patch_database.yml`
  (re-deploy) run as before, in the same mutually-exclusive shape
  driven by `matomo_config_exists`.
- Move wait-for-healthy AFTER the post-patch `flush_handlers`,
  so the API-config phase (`06_config.yml`) is gated by an
  explicit healthcheck on the patched container — strictly
  better than the previous flow, where the API phase implicitly
  relied on the initial healthcheck "lasting" through the
  patch-driven restart.

Verified end-to-end via `deploy-fresh-purged-apps APPS="…" FULL_CYCLE=true`
matrix run with both rounds and both PASS 1/PASS 2 cycles green
(`failed=0 rescued=0` per round/pass) including round 2 / variant 1
(multisite WordPress) which exercises the cred-sync-after-restart
path that previously deadlocked.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 10:58:37 +02:00
kevinveenbirkenbach a533cba874 fix(web-app-matomo): inline domain lookup in trusted_hosts argv
Task-local `domain:` override does NOT shield against eager evaluation
of the role-layer `domain = lookup('domain', application_id)` template
when application_id is polluted in the role-vars layer by nested
include_role chains. Reverting to inline literal lookup in the shell
arg; task-local `application_id` pin stays (still needed for lazy
MATOMO_* var resolution).
2026-04-19 14:35:25 +02:00
kevinveenbirkenbach 3a553c0731 fix(web-app-matomo): pin application_id + domain task-locally for trusted_hosts
Nested include_role chains (sys-stk-front-base → web-opt-rdr-domains /
svc-prx-openresty) pollute the role-vars layer and make {{ domain }} /
{{ MATOMO_* }} resolve against the wrong application_id. Task-level
vars take precedence over role vars, so pinning them here shields the
lookups from pollution.
2026-04-19 13:43:05 +02:00
kevinveenbirkenbachandClaude Opus 4.6 b70a783423 refactor(lookups): migrate to runtime applications/users lookups
Replaces inline `applications`/`users` merging with dedicated lookup
plugins and runtime hydration. Introduces `add_csp_hash` filter,
integrates sort into `find_dock_val_by_bkp_entr`, splits the Keycloak
one-shot realm import into `05a_realm_import_run.yml`, and fixes the
Mastodon administrator task YAML. Removes obsolete `csp_hashes` filter,
`sys-token-store` Jinja filter, and empty CLI setup modules.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-15 23:44:19 +02:00
kevinveenbirkenbachandClaude Sonnet 4.6 a2d844e798 refactor: move frontend service loading out of sys-front-inj-all into global stage
Extracts the shared frontend service loader from sys-front-inj-all into
tasks/utils/load_services.yml and tasks/utils/_load_frontend_service.yml,
called once from tasks/stages/02_server.yml before web-svc and web-app
roles. This decouples service loading from per-app injection and makes
load order explicit via SERVICE_REGISTRY entry order. Updates docs,
comments, and adds an integration test enforcing the new SPOT.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 03:30:19 +02:00
kevinveenbirkenbachandClaude Sonnet 4.6 96649d8c9b refactor(services): centralize frontend service loading with generic lookup plugin
Introduces a SPOT for all frontend service loading in sys-front-inj-all/tasks/01_services.yml,
driven by a new generic `service` lookup plugin that resolves services by key or role name
and returns {id, role, enabled, shared, needed}. Needed = enabled AND shared (direct or
transitive). The canonical key→role mapping moves to group_vars/all/20_services.yml
(previously scattered hardcoded rules). Removes per-role service loads from bigbluebutton,
nextcloud, and dashboard. Renames 01_dependencies.yml→01_services.yml and
08_services.yml→08_daemons.yml. Adds flush_handlers after each service load.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 08:27:21 +02:00
kevinveenbirkenbach c6f5fdea15 refactor plugins layout and migrate uri calls to uri_retry 2026-03-19 01:41:07 +01:00
kevinveenbirkenbach 436a8a5fc9 Add deeper Matomo bootstrap failure diagnostics 2026-03-16 16:53:28 +01:00
kevinveenbirkenbach 757e20fffa web-app-matomo: fail fast on bootstrap root cause 2026-02-24 12:13:15 +01:00
kevinveenbirkenbach 13571f83f4 Optimized whitespacing 2026-02-16 23:50:57 +01:00
kevinveenbirkenbach 548c8d8f5f web-app-matomo: refactor bootstrap into separate run and debug tasks 2026-02-16 23:48:42 +01:00
kevinveenbirkenbach f57d62f9da Removed when guard 2026-02-16 23:22:44 +01:00
kevinveenbirkenbach afc099f975 web-app-matomo: retry bootstrap and extend failure diagnostics 2026-02-16 20:37:27 +01:00
kevinveenbirkenbach e540495ad0 refactor(web-app-matomo): wait for container health instead of running + port check
Replace running and HTTP wait logic with direct health status check via container inspect and remove redundant wait_for step

https://chatgpt.com/share/698d1e2f-1f40-800f-92bc-10a736358b40
2026-02-12 01:37:39 +01:00
kevinveenbirkenbach d47c88a4d7 fix(web-app-matomo): replace curl healthcheck with PHP-based check and increase start_period for CI stability
Switch Matomo container healthcheck from curl to an internal PHP get_headers() check to avoid dependency on curl in the official image.
Accept HTTP 200 and 302 as healthy responses and increase start_period to 60s to prevent premature unhealthy states in slower CI environments.

https://chatgpt.com/share/698c5823-aa44-800f-978a-df9765e7f93d
2026-02-11 11:21:19 +01:00
kevinveenbirkenbach 785904e9e0 Replaced docker exec by container exec 2026-02-11 08:36:58 +01:00
kevinveenbirkenbach 32a6f5ac3d fix(web-app-matomo): retry bootstrap via compose and add structured debug on failure
Add retry logic with delay for the one-shot Matomo bootstrap, ensure change
is only reported on success, and provide a detailed but safe debug dump
(stdout/stderr lengths, effective compose config, env and compose files)
when the bootstrap ultimately fails.

https://chatgpt.com/share/698bc6e7-230c-800f-bd9a-b50494514db9
2026-02-11 01:01:30 +01:00
kevinveenbirkenbach a55c99ef62 refactor(compose): replace docker lookup with container and unify compose paths
- Rename lookup plugin from `docker` to `container`
- Switch all lookups from `lookup('docker', ...)` to `lookup('container', ...)`
- Normalize compose file keys:
  - docker_compose → compose
  - docker_compose_override → compose_override
  - docker_compose_ca_override → compose_ca_override
- Centralize compose path resolution via docker_paths_utils
- Update compose_file_args to always derive paths from DIR_COMPOSITIONS
- Align all roles, templates, and vars with container/compose naming
- Update and rename unit tests accordingly

This prepares the codebase for engine-agnostic container backends
(e.g. Docker ↔ Podman) and removes legacy docker-specific assumptions.

https://chatgpt.com/share/6987a7cc-d374-800f-99ad-bb4c8f92c59e
2026-02-07 21:59:39 +01:00
kevinveenbirkenbach 9fa9692d7d refactor(compose): replace docker compose calls with compose wrapper
- Switch all docker compose invocations to the compose wrapper
- Update comments, task names, and log messages accordingly
- Simplify handlers and tasks to rely on wrapper-managed flags and env files
- Align tests and documentation with compose-based workflow

https://chatgpt.com/share/69866ede-be2c-800f-94b0-bffcf8fed260
2026-02-06 23:44:39 +01:00
kevinveenbirkenbach 0a7b4efa22 Replaced docker compose pull by compose pull 2026-02-06 23:26:20 +01:00
kevinveenbirkenbach c1d50d78da refactor(container): replace BIN_CONTAINER usages with system-wide container wrapper
https://chatgpt.com/share/698660b7-4c78-800f-b25f-af5408cff034
2026-02-06 23:00:21 +01:00
kevinveenbirkenbach 46238d4c89 refactor: use BIN_CONTAINER wrapper for container exec commands
https://chatgpt.com/share/698657ee-e708-800f-ba5d-4c7c5198a5fe
2026-02-06 22:06:42 +01:00
kevinveenbirkenbach 63926b23b9 chore(container): replace direct docker inspect/run calls with container wrapper
https://chatgpt.com/share/698647e2-7b94-800f-814d-5eb63fe4e537
2026-02-06 20:58:17 +01:00
kevinveenbirkenbach 5e33e70892 refactor(database lookup usage): switch conditionals to enabled flag
Replace indirect type!='' checks with explicit database.enabled lookups
to improve semantics, readability, and alignment with strict lookup API.

https://chatgpt.com/share/6985d642-b40c-800f-9cdf-ed54fc484a92
2026-02-06 13:25:37 +01:00
kevinveenbirkenbach e1e1f3eb11 chore(vars): rename PATH_* to DIR_/BIN_/FILE_ conventions
https://chatgpt.com/share/6985cf49-3c74-800f-af97-f68b1969ab01
2026-02-06 12:23:46 +01:00
kevinveenbirkenbach 26a5b159e0 refactor(docker-lookup): replace want= syntax with path-based access
- Replace lookup('docker', ..., want='...') with lookup('docker', ..., 'path')
- Allow both top-level keys (directories/files) and dotted paths
- Simplify docker lookup API and reduce lazy dict propagation
- Update unit tests to reflect new lookup semantics

https://chatgpt.com/share/6984ccea-8290-800f-a6d7-ec0e94df95a0
2026-02-05 18:45:43 +01:00
kevinveenbirkenbach 56aea31667 refactor(docker): replace docker_compose vars with docker lookup across roles
Remove implicit docker_compose variable usage and resolve all docker paths
(files, directories, env) via lookup('docker', application_id).
This prevents scope leakage, centralizes path resolution, and makes docker
context deterministic across roles and handlers.

https://chatgpt.com/share/6984ccea-8290-800f-a6d7-ec0e94df95a0
2026-02-05 18:15:10 +01:00
kevinveenbirkenbach f6f96a11ac Refactor: use database lookup helper everywhere
https://chatgpt.com/share/6983bcf6-85bc-800f-a0fc-5684b9078469
2026-02-04 22:52:08 +01:00
kevinveenbirkenbach 8a81630391 Added newline at file and POSIX compatible 2026-02-04 19:49:56 +01:00
kevinveenbirkenbach 76d09dbc3f refactor: centralize docker wrappers, CA injection paths, and update tests
Unify compose/run wrappers under PATH_* variables, wire CA trust injection
consistently, extend with NSS/Chromium support, and adapt unit tests to the
new run-based execution model.

https://chatgpt.com/share/697e1f92-bc5c-800f-968d-ad43c50afaea
2026-01-31 17:06:09 +01:00
kevinveenbirkenbach 19e01ebb72 web-app-matomo: extract bootstrap token from stdout via regex
- Parse Matomo bootstrap token from mixed stdout output
- Ignore CA trust and installer log noise
- Ensure token assertion only evaluates pure hex token
2026-01-31 12:19:33 +01:00
kevinveenbirkenbach 7124a06fe0 web-app-matomo: use compose-base for bootstrap and harden debug output
- Switch Matomo bootstrap to DOCKER_CMD_BASE wrapper
  - ensures consistent env-file, override and CA handling
  - align compose project name with instance directory basename
- Replace shell-based debug dump with safe debug/command tasks
  - avoid shell quoting issues with stdout/stderr
  - respect MASK_CREDENTIALS_IN_LOGS
- Add explicit effective `docker compose config` debug via wrapper
- Improve failure message clarity

https://chatgpt.com/share/697de13f-0fd0-800f-9b46-d89d22a6737b
2026-01-31 12:02:16 +01:00
kevinveenbirkenbach 3b1032895a feat(security): introduce sed_escape filter and enforce safe sed replacements
- add sed_escape Jinja filter for sed replacement safety
  - escapes \, &, and the active sed delimiter
  - designed explicitly for sed s/// replacement context

- patch all sed-based config updates across roles
  - espocrm, friendica, gitea, matomo, moodle, wordpress
  - ensure every Jinja value in sed replacements uses sed_escape
  - use correct delimiter-specific escaping (/, |, #)

- add robust integration test to enforce sed_escape usage
  - scans all roles/*/tasks/**/*.yml
  - detects sed substitutions with Jinja in replacement part
  - ignores delimiters inside {{ ... }} blocks
  - fails CI if sed_escape is missing

- harden repository against sed injection, delimiter breakage,
  and credential corruption in config patching tasks

https://chatgpt.com/share/6974fb45-1ee8-800f-80bd-c71122e4ac02
2026-01-24 18:02:37 +01:00
kevinveenbirkenbach 0495dfcfb0 Optimized logging output 2026-01-19 00:56:28 +01:00
kevinveenbirkenbach 95e3823d2f refactor: centralize token store init and allow Mailu 301 status checks
- move sys-token-store initialization to constructor stage
- remove duplicate token store includes from frontend and app roles
- allow Mailu reachability check to accept configurable status codes (200, 301)
- make Mailu health check consistent with web-app-mailu config
- increase test-local-rapid verbosity for better diagnostics

https://chatgpt.com/share/696c0f49-7888-800f-8175-fb21893c0d67
2026-01-17 23:37:54 +01:00
kevinveenbirkenbach 989c0c0fa2 refactor(stacks): merge stateful/stateless backend+full stacks into sys-stk-backend/sys-stk-full
- Replace sys-stk-back-stateful + sys-stk-back-stateless with unified sys-stk-backend role
- Replace sys-stk-full-stateful + sys-stk-full-stateless with unified sys-stk-full role
- Add reusable task helpers: _load_service.yml (optional deps) and 01_database.yml (DB bootstrap)
- Switch optional dependency loading (OpenLDAP, Ollama) to service_load_enabled (enabled && shared) + run_once guard
- Remove legacy OLLAMA_LOCAL_ENABLED flag; rely on docker.services.ollama.enabled/shared config
- Update all affected app/service roles and web-app template to use new stack role names

https://chatgpt.com/share/69685fb2-cb1c-800f-a9e8-2f5f765a1a53
2026-01-15 04:31:54 +01:00
kevinveenbirkenbach 528e0ad1f8 Fix Matomo bootstrap and token initialization logic
- Ensure Matomo is bootstrapped when API token is missing, even if already installed
- Make Matomo load conditional on reachability and token availability
- Move run-once flag in sys-token-store to ensure proper token hydration
- Improve trusted_hosts patching to include service and Docker reach host
- Clean up redundant conditions and minor task inconsistencies

https://chatgpt.com/share/6957bc5f-ff70-800f-a3bd-c4cf2518a336
2026-01-02 13:38:48 +01:00
kevinveenbirkenbach 93f09ac0a7 feat(token-store): hydrate runtime tokens + unify Matomo token usage
**Body**

* add sys-token-store filter plugin to hydrate users.*.tokens from persisted store (users win if non-empty)
* load token store during sys-token-store core run and inject hydrated tokens into users fact
* remove legacy lookup task and simplify docs + store path naming
* switch Matomo frontend injection to use hydrated users.administrator.tokens[web-app-matomo] directly
* ensure Mailu token handling uses sys-token-store write task and checks token presence via users.*.tokens
* add unittest for token hydration filter plugin with path-based module loading
2025-12-31 13:43:29 +01:00
kevinveenbirkenbach cfceee7dbe Solved integration tests 2025-12-28 15:38:34 +01:00
kevinveenbirkenbach f3714b00e7 feat(users,token-store): add user token defaults and unify token variable naming
- add `tokens` support to generated default_users
- normalize sys-token-store output variable to `sys_token_store_token`
- align Matomo role to new token-store interface
- reorder Matomo task files for clearer execution flow

https://chatgpt.com/share/69513d00-9a7c-800f-8b1f-5c31e0e21b75
2025-12-28 15:21:35 +01:00
kevinveenbirkenbach fadde240d8 refactor(tokens): unify token handling via sys-token-store
- Introduce sys-token-store lookup.yml (users → store → empty)
- Introduce sys-token-store write.yml (persist + inject into runtime users)
- Remove all implicit token generation and legacy token tasks
- Migrate Matomo to users.<user>.tokens[application_id]
- Remove redundant Matomo token.value and credentials schema
- Fix Matomo bootstrap env: use MATOMO_ADMIN_USER consistently
- Harden Matomo site verification error handling
- Align sys-front-inj-matomo with unified token model

https://chatgpt.com/share/694d7d55-28a0-800f-8c91-cd09cb9ded7f
2025-12-25 19:07:08 +01:00
kevinveenbirkenbach 62d1fb6a2f **Fix Matomo trusted hosts + use local API URL**
* Set Matomo `trusted_hosts[]` to include both `{{ domain }}` and `{{ DOCKER_REACH_HOST }}:{{ http_port }}` (idempotent)
* Add `http_port` var for reuse
* Switch `MATOMO_INDEX_PHP_URL` to local reach URL to make API calls reliable on localhost

https://chatgpt.com/share/694c1e06-fcac-800f-9c03-d92a150a4c73
2025-12-24 18:08:12 +01:00
kevinveenbirkenbach 70bcb5ef18 web-app-matomo: add bootstrap failure debug dump for compose and env files
Wrap Matomo bootstrap in block/rescue to capture failures and
dump docker-compose.yml, effective compose config, and env files.
Env files are only shown when MASK_CREDENTIALS_IN_LOGS is false.

https://chatgpt.com/share/694bde08-a72c-800f-9ac3-a8aa9aef3bde
2025-12-24 13:35:14 +01:00
kevinveenbirkenbach 2c4463879a refactor(matomo): replace nix installer with docker-compose bootstrap profile
* add token configuration and bootstrap service to role config
* introduce dedicated bootstrap env file wired via env_file override
* replace nix/playwright-based installer with one-shot compose bootstrap
* determine bootstrap need based on config.ini.php and token presence
* move post-install API configuration into separate task file

https://chatgpt.com/share/694bcac4-1a00-800f-9aff-dbcd9a2003dc
2025-12-24 12:12:32 +01:00
kevinveenbirkenbach 28d9818008 fix(web-app-matomo): keep bootstrap stdout clean and normalize env format
- Remove --debug flag to preserve token-only stdout contract
- Normalize .env formatting by removing whitespace around '='
2025-12-23 17:54:10 +01:00
kevinveenbirkenbach d6e1ff7a0d fix(web-app-matomo): run nix directly and harden Playwright install
Replace bash -lc with direct nix run to avoid .bashrc/TERM issues in CI.
Prevent flake.lock writes via --no-write-lock-file and add retries for
Playwright Chromium installation. Keep localhost base URL for reliable
host-side access.

https://chatgpt.com/share/694ab489-7028-800f-8398-a19a99faffd0
2025-12-23 16:46:52 +01:00
kevinveenbirkenbach cc578e761f fix(matomo): prevent nix from writing flake.lock in CI
Use --no-write-lock-file for nix run calls to avoid failures in
read-only or cached flake environments (e.g. CI containers).

https://chatgpt.com/share/694ab489-7028-800f-8398-a19a99faffd0
2025-12-23 16:25:56 +01:00
kevinveenbirkenbach 1104d4710d Normalize docker service reachability via DOCKER_REACH_HOST
Introduce DOCKER_REACH_HOST as a single source of truth for service
reachability checks (wait_for), decoupled from DOCKER_BIND_HOST.

- Default reach host is 127.0.0.1 for host-based execution
- Automatically override to Docker bridge gateway when running
  inside a container (Docker socket mounted)
- Add custom docker_bridge_gateway module for reliable detection
- Update all wait_for tasks to use DOCKER_REACH_HOST
- Remove ad-hoc debug TCP probing logic

This ensures consistent behavior across host runs and
container-based control nodes without breaking existing setups.

https://chatgpt.com/share/694aaf8b-1fe4-800f-88ac-b5f6e508a2e3
2025-12-23 16:04:36 +01:00