Files
computer-playbook/scripts/tests/deploy/local/purge/entity.sh
T
kevinveenbirkenbachandClaude Opus 5.5 b6e995a8de fix(purge): drop purged apps from the round inventories
make compose-entity-purge removed the containers, volumes, databases
and vhosts of an app but left its group in devices.yml. Inventory
provisioning only merges groups, and the webserver health unit builds
its domain list from the groups of the host, so every later full deploy
of another app ended with failed=1: the unit kept probing the purged
domains and the service terminator gave up after 25 retries.

The make target now passes retire to the purge wrapper. With it the
wrapper hands the inventory directory into the container, and the app
orchestrator removes the purged application ids from devices.yml of the
base inventory and of every round inventory next to it.

The deploy flows that purge before they deploy the same apps again
(purge=true, the purge between matrix rounds, the reinstall selection)
call the wrapper without retire and keep the groups, because an update
deploy needs the app in the inventory.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 22:19:12 +02:00

36 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Cleanup one or multiple app entities in the running infinito container.
#
# Expects:
# apps (required)
# Examples:
# apps=web-app-nextcloud
# apps="web-app-nextcloud web-app-keycloak"
# apps="web-app-nextcloud,web-app-keycloak"
#
# INFINITO_CONTAINER (required)
# Example:
# infinito_nexus_arch
#
# retire (optional)
# Non-empty also drops the apps from every round inventory under
# INFINITO_INVENTORY_DIR, which is then required.
: "${apps:?apps is not set (e.g. apps=web-app-nextcloud)}"
: "${INFINITO_CONTAINER:?INFINITO_CONTAINER is not set (e.g. infinito_nexus_arch)}"
echo "=== local cleanup: apps=${apps} container=${INFINITO_CONTAINER} ==="
: "${INFINITO_SRC_DIR:?INFINITO_SRC_DIR is not set; source scripts/meta/env/load.sh}"
exec_env=(-e apps="${apps}")
if [[ -n "${retire:-}" ]]; then
: "${INFINITO_INVENTORY_DIR:?INFINITO_INVENTORY_DIR is not set; source scripts/meta/env/load.sh}"
exec_env+=(-e retire="${retire}" -e INFINITO_INVENTORY_DIR="${INFINITO_INVENTORY_DIR}")
fi
docker exec "${exec_env[@]}" "${INFINITO_CONTAINER}" \
bash "${INFINITO_SRC_DIR}/scripts/container/purge/apps.sh"