Files
computer-playbook/scripts/tests/deploy/swarm/_context.sh
T
kevinveenbirkenbachandClaude Opus 4.7 6dbc635105 fix(swarm-pilot): raise systemd-ready timeout 60s -> 180s with diagnostics
The previous 60s window flaked on GHA matrix runs because jrei/systemd-ubuntu:24.04 cold-starts D-Bus + targets slowly under parallel load. 03_start_swarm_nodes.sh additionally let downstream steps run against a non-ready node instead of failing.

Both scripts now exit non-zero with journalctl + State diagnostics on timeout. Override via SWARM_PILOT_SYSTEMD_TIMEOUT for local debug.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-02 20:21:04 +02:00

58 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
: "${APP_ID:?APP_ID required}"
ENTITY="${APP_ID#web-app-}"
ENTITY="${ENTITY#web-svc-}"
ENTITY="${ENTITY#svc-db-}"
ENTITY="${ENTITY#svc-ai-}"
ENTITY="${ENTITY#svc-opt-}"
ENTITY="${ENTITY#svc-prx-}"
ENTITY="${ENTITY#svc-bkp-}"
ENTITY="${ENTITY#svc-storage-}"
ENTITY="${ENTITY#svc-docker-}"
ENTITY="${ENTITY#svc-net-}"
ENTITY="${ENTITY#svc-}"
STACK_NAME="${ENTITY}"
SERVICE_NAME="${STACK_NAME}_${ENTITY}"
CUSTOM_IMAGE_REPO="${ENTITY}_custom"
ROLE_DIR="$(git rev-parse --show-toplevel 2>/dev/null || echo .)/roles/${APP_ID}"
DB_DEP=none
if [ -f "${ROLE_DIR}/meta/services.yml" ]; then
if grep -qE '^mariadb:' "${ROLE_DIR}/meta/services.yml"; then
DB_DEP=mariadb
elif grep -qE '^postgres:' "${ROLE_DIR}/meta/services.yml"; then
DB_DEP=postgres
fi
fi
NFS_VOLUMES=""
if [ -f "${ROLE_DIR}/meta/volumes.yml" ]; then
NFS_VOLUMES="$(python3 -c "
import sys, yaml
with open('${ROLE_DIR}/meta/volumes.yml') as f:
data = yaml.safe_load(f) or {}
for v in data.values():
if isinstance(v, dict) and v.get('nfs') is not None and isinstance(v.get('name'), str):
print(v['name'])
")"
fi
PRIMARY_NFS_VOLUME="$(printf '%s\n' "${NFS_VOLUMES}" | head -n1)"
export APP_ID ENTITY STACK_NAME SERVICE_NAME CUSTOM_IMAGE_REPO DB_DEP NFS_VOLUMES PRIMARY_NFS_VOLUME
if [ "${SWARM_NFS_PILOT_VERBOSE:-0}" = "1" ]; then
echo "==> APP_ID=${APP_ID}"
echo " ENTITY=${ENTITY}"
echo " STACK_NAME=${STACK_NAME}"
echo " SERVICE_NAME=${SERVICE_NAME}"
echo " CUSTOM_IMAGE_REPO=${CUSTOM_IMAGE_REPO}"
echo " DB_DEP=${DB_DEP}"
echo " PRIMARY_NFS_VOLUME=${PRIMARY_NFS_VOLUME}"
fi