mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-12-02 15:57:17 +00:00
- scripts/tests/deploy/swarm: the 09/11 in-container reachability probe hardcoded http://localhost:80, but ollama listens on 11434 and gitea on 3000, so the assert looped 30x against the wrong port. _context.sh now exports PROBE_PORT from the role's meta/services.yml ports.internal.http (default 80), used by 09_seed_content and 11_assert_state. - web-app-espocrm: declare ports.internal {http: 80, websocket: 8080}; the swarm resolve_upstream (utils/networks/proxy.py) hard-fails without it (only ports.local was set). Compose is unaffected (reads ports.local). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
59 lines
1.6 KiB
Bash
Executable File
59 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
# shellcheck disable=SC1091
|
|
source "${SCRIPT_DIR}/_context.sh"
|
|
|
|
skip_if_no_swarm_service
|
|
skip_chaos_if_manager_pinned
|
|
|
|
REPL=""
|
|
for i in $(seq 1 60); do
|
|
REPL=$(docker exec "${MGR}" docker service ls \
|
|
--filter "name=${SERVICE_NAME}" --format '{{.Replicas}}')
|
|
echo "[${i}] ${ENTITY} replicas: ${REPL}"
|
|
if echo "${REPL}" | grep -qE '^([0-9]+)/\1$'; then
|
|
break
|
|
fi
|
|
sleep 2
|
|
done
|
|
echo "${REPL}" | grep -qE '^([0-9]+)/\1$' || {
|
|
echo "Replicas not fully converged: ${REPL}"
|
|
exit 1
|
|
}
|
|
|
|
if [ -n "${PRIMARY_NFS_VOLUME}" ]; then
|
|
docker exec "${NEW_NODE}" sh -c "
|
|
mkdir -p /mnt/nfs-check
|
|
mount -t nfs -o vers=3,nolock ${NFS_IP}:${NFS_EXPORT_BASE} /mnt/nfs-check
|
|
grep -q 'pre-drain marker' /mnt/nfs-check/${PRIMARY_NFS_VOLUME}/.pre-drain
|
|
umount /mnt/nfs-check
|
|
" || {
|
|
echo "FAILURE: marker missing on NFS volume '${PRIMARY_NFS_VOLUME}'"
|
|
exit 1
|
|
}
|
|
else
|
|
echo "No NFS-flagged volume for '${APP_ID}' — skipping NFS marker assertion"
|
|
fi
|
|
|
|
APP_CTR=$(docker exec "${NEW_NODE}" docker ps \
|
|
--filter "name=${SERVICE_NAME}" \
|
|
--format '{{.ID}}' | head -1)
|
|
if [ -z "${APP_CTR}" ]; then
|
|
echo "FAILURE: cannot locate ${ENTITY} container on ${NEW_NODE}"
|
|
exit 1
|
|
fi
|
|
for i in $(seq 1 30); do
|
|
# No -f: many app roots legitimately 404 (UI/API live elsewhere); we only
|
|
# assert the rescheduled HTTP server responds, not that '/' is 2xx.
|
|
if docker exec "${NEW_NODE}" docker exec "${APP_CTR}" \
|
|
curl -sS "http://localhost:${PROBE_PORT}/" >/dev/null 2>&1; then
|
|
echo "${ENTITY} reachable after reschedule"
|
|
exit 0
|
|
fi
|
|
sleep 2
|
|
done
|
|
echo "FAILURE: ${ENTITY} not reachable after reschedule"
|
|
exit 1
|