61 lines
2.2 KiB
Bash
Executable File
61 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
project_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "${project_dir}"
|
|
|
|
project_name="k1412-agent-e2e"
|
|
web_port="${E2E_WEB_PORT:-3000}"
|
|
compose=(docker compose -p "${project_name}" -f compose.yaml -f compose.e2e.yaml)
|
|
|
|
export WEB_PORT="${web_port}"
|
|
export WEBUI_URL="http://127.0.0.1:${web_port}"
|
|
export CORS_ALLOW_ORIGIN="${WEBUI_URL}"
|
|
export WEBUI_SECRET_KEY="e2e-webui-secret-at-least-32-bytes"
|
|
export WEBUI_ADMIN_EMAIL="admin-e2e@example.invalid"
|
|
export WEBUI_ADMIN_PASSWORD="e2e-admin-password"
|
|
export OPENWEBUI_FORWARD_JWT_SECRET="e2e-forward-jwt-secret-at-least-32-bytes"
|
|
export INTERNAL_PROVIDER_KEY="e2e-provider-secret-at-least-32-bytes"
|
|
export INTERNAL_GATEWAY_KEY="e2e-gateway-secret-at-least-32-bytes"
|
|
export MODEL_API_KEY="e2e-model-key"
|
|
export DEEPSEEK_API_KEY="e2e-deepseek-key"
|
|
export POSTGRES_PASSWORD="e2e-postgres-password"
|
|
export WEB_IMAGE="k1412-agent-web:e2e"
|
|
export RUNTIME_IMAGE="k1412-agent-runtime:e2e"
|
|
export GATEWAY_IMAGE="k1412-agent-gateway:e2e"
|
|
export WORKSPACE_IMAGE="k1412-agent-workspace:e2e"
|
|
export E2E_BASE_URL="${WEBUI_URL}"
|
|
export E2E_ADMIN_EMAIL="${WEBUI_ADMIN_EMAIL}"
|
|
export E2E_ADMIN_PASSWORD="${WEBUI_ADMIN_PASSWORD}"
|
|
export E2E_FORWARD_JWT_SECRET="${OPENWEBUI_FORWARD_JWT_SECRET}"
|
|
export E2E_INTERNAL_PROVIDER_KEY="${INTERNAL_PROVIDER_KEY}"
|
|
|
|
cleanup() {
|
|
if [[ "${E2E_KEEP_STACK:-0}" != "1" ]]; then
|
|
"${compose[@]}" down --volumes --remove-orphans
|
|
fi
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
"${compose[@]}" down --volumes --remove-orphans
|
|
"${compose[@]}" --profile build-only build workspace-image
|
|
"${compose[@]}" up --detach --build
|
|
|
|
for _ in $(seq 1 120); do
|
|
web_health="$("${compose[@]}" ps --format json web 2>/dev/null || true)"
|
|
bootstrap_state="$("${compose[@]}" ps --all --format json bootstrap 2>/dev/null || true)"
|
|
if [[ "${web_health}" == *'"Health":"healthy"'* \
|
|
&& "${bootstrap_state}" == *'"State":"exited"'* \
|
|
&& "${bootstrap_state}" == *'"ExitCode":0'* ]]; then
|
|
break
|
|
fi
|
|
sleep 2
|
|
done
|
|
|
|
"${compose[@]}" ps
|
|
bootstrap_state="$("${compose[@]}" ps --all --format json bootstrap)"
|
|
[[ "${bootstrap_state}" == *'"State":"exited"'* ]]
|
|
[[ "${bootstrap_state}" == *'"ExitCode":0'* ]]
|
|
curl --silent --show-error --fail "${WEBUI_URL}/health" >/dev/null
|
|
.venv/bin/python e2e/verify_stack.py
|