Import verified AzerothAI snapshot from GitHub
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
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
Source branch: feature/ai-brain-router Source commit: c2a09e0460465201a58aaab56c71424e9a96405e
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
#!/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" ]]; then
|
||||
printf '%s' "$AZEROTHAI_PLAYABLE_ROOT"; return
|
||||
fi
|
||||
for root in "$HOME/azerothai-pc-lab" "$HOME/azerothai-playable"; do
|
||||
if [[ -d "$root" ]]; then printf '%s' "$root"; return; fi
|
||||
done
|
||||
printf '%s' "$HOME/azerothai-pc-lab"
|
||||
}
|
||||
|
||||
LAB_ROOT="$(find_lab_root)"
|
||||
RUNTIME_ENV="$LAB_ROOT/runtime.env"
|
||||
NODE_BIN="$(command -v node)"
|
||||
RUN_USER="$(id -un)"
|
||||
RUN_GROUP="$(id -gn)"
|
||||
SERVICE_NAME="azerothai-ale-relay.service"
|
||||
SERVICE_FILE="/etc/systemd/system/$SERVICE_NAME"
|
||||
|
||||
if [[ ! -f "$RUNTIME_ENV" ]]; then
|
||||
echo "Missing $RUNTIME_ENV" >&2
|
||||
exit 2
|
||||
fi
|
||||
grep -q '^ALE_BRIDGE_TOKEN=' "$RUNTIME_ENV" || { echo "ALE_BRIDGE_TOKEN missing from $RUNTIME_ENV" >&2; exit 3; }
|
||||
grep -q '^DOCKER_DB_ROOT_PASSWORD=' "$RUNTIME_ENV" || { echo "DOCKER_DB_ROOT_PASSWORD missing from $RUNTIME_ENV" >&2; exit 3; }
|
||||
# shellcheck disable=SC1090
|
||||
source "$RUNTIME_ENV"
|
||||
: "${ALE_BRIDGE_TOKEN:?ALE_BRIDGE_TOKEN missing from runtime environment}"
|
||||
: "${DOCKER_DB_ROOT_PASSWORD:?DOCKER_DB_ROOT_PASSWORD missing from runtime environment}"
|
||||
command -v docker >/dev/null 2>&1 || { echo "docker is required" >&2; exit 4; }
|
||||
|
||||
mkdir -p "$LAB_ROOT"
|
||||
touch "$LAB_ROOT/ale-relay.log"
|
||||
chown "$RUN_USER:$RUN_GROUP" "$LAB_ROOT/ale-relay.log"
|
||||
|
||||
echo "==> Installing durable ALE database relay service"
|
||||
sudo tee "$SERVICE_FILE" >/dev/null <<EOF
|
||||
[Unit]
|
||||
Description=AzerothAI durable ALE database relay
|
||||
After=network-online.target docker.service
|
||||
Wants=network-online.target docker.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=$RUN_USER
|
||||
Group=$RUN_GROUP
|
||||
WorkingDirectory=$REPO_ROOT
|
||||
EnvironmentFile=$RUNTIME_ENV
|
||||
Environment=AZEROTHAI_URL=http://127.0.0.1:8787
|
||||
Environment=AZEROTHAI_ALE_RELAY_POLL_MS=250
|
||||
ExecStart=$NODE_BIN $REPO_ROOT/scripts/ale-db-relay.mjs
|
||||
Restart=always
|
||||
RestartSec=2
|
||||
StandardOutput=append:$LAB_ROOT/ale-relay.log
|
||||
StandardError=append:$LAB_ROOT/ale-relay.log
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable "$SERVICE_NAME" >/dev/null
|
||||
sudo systemctl restart "$SERVICE_NAME"
|
||||
|
||||
for _ in {1..20}; do
|
||||
if docker exec ac-database mysql -uroot -p"$DOCKER_DB_ROOT_PASSWORD" -Nse "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='acore_auth' AND table_name IN ('azerothai_command_inbox','azerothai_event_outbox','azerothai_result_outbox')" 2>/dev/null | grep -qx '3'; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
if ! sudo systemctl is-active --quiet "$SERVICE_NAME"; then
|
||||
echo "ALE relay service failed to start." >&2
|
||||
sudo systemctl status "$SERVICE_NAME" --no-pager -l >&2 || true
|
||||
tail -80 "$LAB_ROOT/ale-relay.log" >&2 || true
|
||||
exit 5
|
||||
fi
|
||||
|
||||
TABLE_COUNT="$(docker exec ac-database mysql -uroot -p"$DOCKER_DB_ROOT_PASSWORD" -Nse "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='acore_auth' AND table_name IN ('azerothai_command_inbox','azerothai_event_outbox','azerothai_result_outbox')" 2>/dev/null || echo 0)"
|
||||
if [[ "$TABLE_COUNT" != "3" ]]; then
|
||||
echo "ALE relay is running but durable spool tables were not created." >&2
|
||||
tail -80 "$LAB_ROOT/ale-relay.log" >&2 || true
|
||||
exit 6
|
||||
fi
|
||||
|
||||
PID="$(sudo systemctl show -p MainPID --value "$SERVICE_NAME")"
|
||||
echo "ALE relay service: active (PID $PID)"
|
||||
echo "Durable spool tables: ready"
|
||||
echo "Transport: AzerothAI D1 <-> host relay <-> acore_auth spool <-> ALE"
|
||||
Reference in New Issue
Block a user