Files
gemma3-vllm-stack/scripts/test_ui.sh
2026-04-19 09:42:52 +05:30

28 lines
874 B
Bash
Executable File

#!/usr/bin/env bash
# Tests whether the chat UI is reachable on localhost frontend port.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
ENV_FILE="${REPO_ROOT}/.env"
if [[ -f "${ENV_FILE}" ]]; then
set -a
# shellcheck disable=SC1090
source "${ENV_FILE}"
set +a
fi
FRONTEND_PORT="${FRONTEND_PORT:-3000}"
UI_URL="http://localhost:${FRONTEND_PORT}"
http_status="$(curl -sS -o /dev/null -w '%{http_code}' "${UI_URL}")"
if [[ "${http_status}" != "200" && "${http_status}" != "301" && "${http_status}" != "302" ]]; then
echo "[test_ui][error] UI check failed with HTTP status ${http_status} at ${UI_URL}" >&2
echo "[test_ui][hint] See docs/TROUBLESHOOTING.md#ui-loads-but-cannot-reach-vllm-backend" >&2
exit 1
fi
echo "[test_ui] Chat UI is reachable at ${UI_URL} (HTTP ${http_status})."