Files
AzerothAI/deploy/playable/preflight.sh
T
Richard Clark 5f0fc86cf9
Core tests / core (push) Successful in 9m57s
Full verification / application (push) Failing after 5m16s
Full verification / local-brain (push) Failing after 6m15s
Realm simulation / simulated-live-world (push) Failing after 5m32s
WoW integration lab / real-worldserver (push) Canceled after 17m23s
Import verified AzerothAI snapshot from GitHub
Source branch: feature/ai-brain-router
Source commit: c2a09e0460465201a58aaab56c71424e9a96405e
2026-09-22 13:12:54 -04:00

67 lines
2.8 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
find_lab_root(){
if [[ -n "${AZEROTHAI_PLAYABLE_ROOT:-}" && -d "$AZEROTHAI_PLAYABLE_ROOT/azerothcore" ]]; then
printf '%s' "$AZEROTHAI_PLAYABLE_ROOT"; return
fi
for root in "$HOME/azerothai-pc-lab" "$HOME/azerothai-playable"; do
if [[ -d "$root/azerothcore" ]]; then printf '%s' "$root"; return; fi
done
}
LAB_ROOT="$(find_lab_root || true)"
[[ -n "$LAB_ROOT" ]] || { echo "Preflight: playable lab not found." >&2; exit 2; }
ACORE_ROOT="$LAB_ROOT/azerothcore"
RUNTIME_ENV="$LAB_ROOT/runtime.env"
for cmd in bash node docker pnpm curl jq python3; do
command -v "$cmd" >/dev/null 2>&1 || { echo "Preflight: missing $cmd" >&2; exit 3; }
done
echo "==> Preflight: shell syntax"
for script in "$REPO_ROOT/deploy/playable/enable-autonomous-world.sh" "$REPO_ROOT/deploy/playable/install-autonomy-service.sh" "$REPO_ROOT/deploy/playable/install-ale-relay-service.sh" "$REPO_ROOT/deploy/playable/status.sh" "$REPO_ROOT/deploy/playable/stop.sh"; do
bash -n "$script"
done
echo "==> Preflight: Node syntax"
node --check "$REPO_ROOT/scripts/autonomy-worker.mjs" >/dev/null
node --check "$REPO_ROOT/scripts/ale-db-relay.mjs" >/dev/null
echo "==> Preflight: durable bridge source"
grep -q 'AuthDBQuery("SELECT id,source FROM azerothai_command_inbox' "$REPO_ROOT/ale/azerothai_bridge.lua" || {
echo "Preflight: durable DB command poll is missing from ALE bridge." >&2; exit 4;
}
if grep -q 'HttpRequest(' "$REPO_ROOT/ale/azerothai_bridge.lua"; then
echo "Preflight: ALE bridge still contains outbound HttpRequest transport." >&2
exit 4
fi
echo "==> Preflight: AzerothCore compose"
(cd "$ACORE_ROOT" && docker compose config -q)
[[ -f "$RUNTIME_ENV" ]] || { echo "Preflight: missing $RUNTIME_ENV" >&2; exit 5; }
# shellcheck disable=SC1090
source "$RUNTIME_ENV"
: "${ALE_BRIDGE_TOKEN:?Preflight: ALE_BRIDGE_TOKEN missing}"
: "${ALE_OPERATOR_TOKEN:?Preflight: ALE_OPERATOR_TOKEN missing}"
: "${DOCKER_DB_ROOT_PASSWORD:?Preflight: DOCKER_DB_ROOT_PASSWORD missing}"
echo "==> Preflight: database connectivity"
docker inspect ac-database >/dev/null 2>&1 || { echo "Preflight: ac-database container is missing." >&2; exit 6; }
docker exec ac-database mysqladmin ping -uroot -p"$DOCKER_DB_ROOT_PASSWORD" --silent >/dev/null
if [[ -f "$ACORE_ROOT/modules/mod-ale/src/LuaEngine/methods/GlobalMethods.h" ]]; then
echo "==> Preflight: installed ALE database API"
grep -q 'int AuthDBQuery' "$ACORE_ROOT/modules/mod-ale/src/LuaEngine/methods/GlobalMethods.h" || {
echo "Preflight: installed mod-ale lacks AuthDBQuery." >&2; exit 7;
}
grep -q 'int AuthDBExecute' "$ACORE_ROOT/modules/mod-ale/src/LuaEngine/methods/GlobalMethods.h" || {
echo "Preflight: installed mod-ale lacks AuthDBExecute." >&2; exit 7;
}
fi
echo "Preflight passed."