Matrix-deploy variant transitions left per-domain vhost files behind:
when a service dropped out of a round's include set, sys-svc-compose's
docker prune removed its container but the vhost under
<NGINX_DIR>/conf.d/servers/{http,https}/<domain>.conf survived, making
the next round's HTTPS probe see 502 instead of TLS-error 000 (5 failed
test-development jobs on run 25705903504).
The inter-round purge in cli.administration.deploy.development.deploy
already invokes scripts/tests/deploy/local/purge/entity.sh with the
previous round's full include — the missing piece was an entity-keyed
nginx primitive next to db/compose/dir. Add it:
- utils.roles.entity_apps.apps_for_entity: reverse of get_entity_name,
walks roles/*/vars/main.yml to map entity -> [application_id]
- utils.cleanup.nginx_vhosts: resolves entity -> apps -> canonical+alias
domains (via build_applications_from_roles + iter_app_domains so it
stays ansible-free) and removes the matching vhost files
- scripts/container/purge/entity/nginx.sh: thin bash wrapper,
symmetric to db/compose/dir
- scripts/container/purge/apps.sh: drive nginx.sh inside the entity
loop, alongside db/compose/dir
Tests: 14 new unit tests covering the reverse-lookup edge cases and
the purge iterator (existing-only / aliases / multi-entity / no-op CLI).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Cleanup Utilities 🧹
This directory contains helpers that mutate persistent on-host state during purge flows.
Scope 📋
Modules under utils/cleanup/ MUST limit themselves to wiping or normalising state that survives compose and volume purges (for example secrets, token stores, cached registry data) so the surrounding entity-keyed purge primitives stay focused on stack-level cleanup.
Modules under utils/cleanup/ MUST NOT take over responsibilities that belong to the entity-keyed purge primitives in scripts/container/purge/entity/ (database drop, compose down, filesystem removal).
Usage 🛠️
Every module here SHOULD expose a callable function for in-process use and a __main__ shim so the same code path is reachable from shell orchestrators via python -m utils.cleanup.<module>.
The host-side purge flow invokes these modules through the app-keyed orchestrator apps.sh.