#!/bin/sh # Manual fallback for tenants where the tuio installer's "run updater" step can't be # used. Creates/recreates app-dono-updater: a poll loop (docker:cli, no third-party # updater) that pulls app-dono-cliente's :latest image every 5 minutes and recreates the # container when the image changes. Mirrors tuio's RunUpdaterDockerContainer / # appClienteRunArgs (internal/tui/docker.go) -- keep the two in sync if either changes. # # Run this ON the tenant host, with app-dono-cliente already running. All of its run # args (port, uid:gid, mounts, network, seccomp) are read live from the running # container -- both now and every time the updater recreates it -- so nothing needs # hand-editing per tenant and nothing baked-in goes stale if the container is ever # changed by hand later (e.g. a manually remapped host port survives an auto-update). set -e APP_IMAGE="hub.davinti.com.br:443/app-dono/app-cliente:latest" APP_NAME="app-dono-cliente" UPDATER_NAME="app-dono-updater" UPDATER_IMAGE="docker:cli" POLL_INTERVAL="${POLL_INTERVAL:-300}" DOCKER_CONFIG_HOST="${DOCKER_CONFIG_HOST:-$HOME/.docker/config.json}" if ! docker inspect "$APP_NAME" >/dev/null 2>&1; then echo "error: $APP_NAME is not running here -- start it first" >&2 exit 1 fi if [ ! -f "$DOCKER_CONFIG_HOST" ]; then echo "error: $DOCKER_CONFIG_HOST not found -- run 'docker login' for the registry first" >&2 exit 1 fi docker rm -f "$UPDATER_NAME" >/dev/null 2>&1 || true docker pull "$UPDATER_IMAGE" >/dev/null # The container is inspected again inside the poll loop on every recreate (not just # here), so this whole block runs live in the updater container, not just once now. POLL_SCRIPT=$(cat <