feat: opax-mcp modul-struktur, acceptance-test og preflight-check scripts
This commit is contained in:
parent
449edf37b8
commit
25ee2d495a
0
agents/core-logic/deploy_agent.py
Executable file → Normal file
0
agents/core-logic/deploy_agent.py
Executable file → Normal file
0
agents/eval/run_eval.py
Executable file → Normal file
0
agents/eval/run_eval.py
Executable file → Normal file
0
agents/tests/test_local.sh
Executable file → Normal file
0
agents/tests/test_local.sh
Executable file → Normal file
|
|
@ -7,7 +7,7 @@
|
|||
## NOW
|
||||
|
||||
- [x] **⚠️ HASTER** — Roter OAuth client secret `Vauco OS Web App` i [Google Auth Platform](https://console.cloud.google.com/auth/clients/357036551735-ka7t2fv9ue2jp01bs826hpdctlvispuo.apps.googleusercontent.com?project=propane-will-491900-m5) — eksponert i chat 2026-05-25. (Løst)
|
||||
- [ ] Vurder om `jason.vauger@vauco.no` skal beholde `roles/run.invoker` på `osvauco-agent`.
|
||||
- [x] Vurder om `jason.vauger@vauco.no` skal beholde `roles/run.invoker` på `osvauco-agent`. (Konklusjon: Ja, nødvendig for feedback_loop.py)
|
||||
- [x] Kjør `git update-index --chmod=+x` på alle scripts + commit — hindrer Permission denied etter GitHub web-edit.
|
||||
- [ ] Verifiser første nattlige GDrive backup — kl 03:00 UTC (Actions-logg).
|
||||
|
||||
|
|
|
|||
0
infrastructure/01-setupenv.sh
Executable file → Normal file
0
infrastructure/01-setupenv.sh
Executable file → Normal file
0
infrastructure/02-deploy.sh
Executable file → Normal file
0
infrastructure/02-deploy.sh
Executable file → Normal file
0
infrastructure/03-teardown.sh
Executable file → Normal file
0
infrastructure/03-teardown.sh
Executable file → Normal file
0
infrastructure/04-observability-setup.sh
Executable file → Normal file
0
infrastructure/04-observability-setup.sh
Executable file → Normal file
0
infrastructure/05-cloudrun-deploy.sh
Executable file → Normal file
0
infrastructure/05-cloudrun-deploy.sh
Executable file → Normal file
0
infrastructure/06-cicd-setup.sh
Executable file → Normal file
0
infrastructure/06-cicd-setup.sh
Executable file → Normal file
0
infrastructure/07-rag-setup.sh
Executable file → Normal file
0
infrastructure/07-rag-setup.sh
Executable file → Normal file
0
infrastructure/08-memorybank-setup.sh
Executable file → Normal file
0
infrastructure/08-memorybank-setup.sh
Executable file → Normal file
0
infrastructure/09-cost-check.sh
Executable file → Normal file
0
infrastructure/09-cost-check.sh
Executable file → Normal file
0
infrastructure/10-cost-guard.sh
Executable file → Normal file
0
infrastructure/10-cost-guard.sh
Executable file → Normal file
0
infrastructure/11-billing-iam-hardening.sh
Executable file → Normal file
0
infrastructure/11-billing-iam-hardening.sh
Executable file → Normal file
0
infrastructure/12-rag-integration.sh
Executable file → Normal file
0
infrastructure/12-rag-integration.sh
Executable file → Normal file
0
infrastructure/99-region-guard.sh
Executable file → Normal file
0
infrastructure/99-region-guard.sh
Executable file → Normal file
0
infrastructure/terraform/cost-guard-fn/main.py
Executable file → Normal file
0
infrastructure/terraform/cost-guard-fn/main.py
Executable file → Normal file
1
opax-mcp/README.md
Normal file
1
opax-mcp/README.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
OPAX MCP-modul for OSVauco
|
||||
0
opax-mcp/__init__.py
Normal file
0
opax-mcp/__init__.py
Normal file
8
opax-mcp/pyproject.toml
Normal file
8
opax-mcp/pyproject.toml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[build-system]
|
||||
requires = ["setuptools>=61.0"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "opax-mcp"
|
||||
version = "0.0.1"
|
||||
description = "OPAX MCP module for OSVauco"
|
||||
77
scripts/acceptance-test.sh
Normal file
77
scripts/acceptance-test.sh
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
#!/usr/bin/env bash
|
||||
# acceptance-test.sh — Full boot cycle acceptance test for OSVauco OPAX
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# --- Configuration & Helpers ---
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
|
||||
|
||||
# Default to no cleanup
|
||||
CLEANUP=false
|
||||
|
||||
# Parse command-line arguments
|
||||
for arg in "$@"
|
||||
do
|
||||
case $arg in
|
||||
--cleanup)
|
||||
CLEANUP=true
|
||||
shift # Remove --cleanup from processing
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo_step() {
|
||||
echo ""
|
||||
echo "=================================================================="
|
||||
echo "=> $1"
|
||||
echo "=================================================================="
|
||||
}
|
||||
|
||||
# --- Main Test Flow ---
|
||||
|
||||
# Step 1: Source environment variables if .env file exists
|
||||
echo_step "Loading environment..."
|
||||
if [ -f "$ROOT_DIR/.env" ]; then
|
||||
source "$ROOT_DIR/.env"
|
||||
echo ".env file loaded."
|
||||
else
|
||||
echo "WARNING: .env file not found. Script may fail if required variables are not set."
|
||||
fi
|
||||
|
||||
# Step 2: Run setup scripts
|
||||
echo_step "Phase 1: Infrastructure Setup"
|
||||
bash "$ROOT_DIR/infrastructure/00-authcheck.sh"
|
||||
bash "$ROOT_DIR/infrastructure/01-setupenv.sh"
|
||||
bash "$ROOT_DIR/infrastructure/07-rag-setup.sh"
|
||||
bash "$ROOT_DIR/infrastructure/08-memorybank-setup.sh"
|
||||
bash "$ROOT_DIR/infrastructure/04-observability-setup.sh"
|
||||
bash "$ROOT_DIR/infrastructure/11-billing-iam-hardening.sh"
|
||||
|
||||
# Step 3: Deploy the Cloud Run service
|
||||
# Note: This assumes RAG_CORPUS_NAME and MEMORY_ENGINE_NAME are correctly set in .env
|
||||
echo_step "Phase 2: Cloud Run Deployment"
|
||||
gcloud run deploy osvauco-agent
|
||||
--source . --region europe-west1
|
||||
--project "${GCLOUD_PROJECT_ID?GCLOUD_PROJECT_ID not set}"
|
||||
--set-secrets "RAG_CORPUS=${RAG_CORPUS_NAME?RAG_CORPUS_NAME not set}:latest"
|
||||
--set-env-vars "GOOGLE_GENAI_USE_VERTEXAI=1,GOOGLE_CLOUD_PROJECT=${GCLOUD_PROJECT_ID},GOOGLE_CLOUD_LOCATION=global,MEMORY_ENGINE_NAME=${MEMORY_ENGINE_NAME?MEMORY_ENGINE_NAME not set}"
|
||||
--no-allow-unauthenticated
|
||||
|
||||
# Step 4: Run the smoke test to verify the deployment
|
||||
echo_step "Phase 3: API Smoke Test"
|
||||
bash "$ROOT_DIR/scripts/smoke-test.sh"
|
||||
|
||||
# Step 5: Optional Teardown
|
||||
if [ "$CLEANUP" = true ]; then
|
||||
echo_step "Phase 4: Tearing down Cloud Run service..."
|
||||
bash "$ROOT_DIR/infrastructure/03-teardown.sh"
|
||||
echo "Teardown complete."
|
||||
else
|
||||
echo_step "Skipping teardown. Run 'bash infrastructure/03-teardown.sh' manually to clean up."
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=================================================================="
|
||||
echo "✅✅✅ Acceptance Test Completed Successfully ✅✅✅"
|
||||
echo "=================================================================="
|
||||
0
scripts/bootstrap.sh
Executable file → Normal file
0
scripts/bootstrap.sh
Executable file → Normal file
73
scripts/preflight-check.sh
Normal file
73
scripts/preflight-check.sh
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
#!/usr/bin/env bash
|
||||
# preflight-check.sh — Verifies the local development environment for OSVauco OPAX.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# --- Configuration & Helpers ---
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
|
||||
FAIL_COUNT=0
|
||||
|
||||
step_info() { echo "[INFO] $1"; }
|
||||
step_ok() { echo " ✅ $1"; }
|
||||
step_fail() {
|
||||
echo " ❌ $1"
|
||||
FAIL_COUNT=$((FAIL_COUNT + 1))
|
||||
}
|
||||
|
||||
# --- Preflight Checks ---
|
||||
|
||||
echo "=================================================================="
|
||||
echo "=> Running OSVauco Preflight Checks"
|
||||
echo "=================================================================="
|
||||
|
||||
# Check 1: gcloud authentication and project config
|
||||
step_info "Checking GCP authentication..."
|
||||
if bash "$ROOT_DIR/infrastructure/00-authcheck.sh" &>/dev/null; then
|
||||
step_ok "gcloud is authenticated and project is set."
|
||||
else
|
||||
step_fail "gcloud authentication or project is not configured. Run 'gcloud auth login' and 'gcloud config set project <project_id>'."
|
||||
fi
|
||||
|
||||
# Check 2: .env file existence
|
||||
step_info "Checking for .env file..."
|
||||
if [ -f "$ROOT_DIR/.env" ]; then
|
||||
step_ok ".env file found."
|
||||
# Source it for the next check
|
||||
source "$ROOT_DIR/.env"
|
||||
else
|
||||
step_fail ".env file not found. Please copy .env.example to .env and fill in the required values."
|
||||
fi
|
||||
|
||||
# Check 3: Critical Environment Variables
|
||||
step_info "Checking critical environment variables..."
|
||||
if [ -n "${GCLOUD_PROJECT_ID-}" ] && [ -n "${BILLING_ACCOUNT_ID-}" ]; then
|
||||
step_ok "Required environment variables (GCLOUD_PROJECT_ID, BILLING_ACCOUNT_ID) are set."
|
||||
else
|
||||
step_fail "One or more required variables (GCLOUD_PROJECT_ID, BILLING_ACCOUNT_ID) are not set in your .env file."
|
||||
fi
|
||||
|
||||
# Check 4: Python dependencies hint
|
||||
step_info "Checking for Python dependencies..."
|
||||
if [ -f "$ROOT_DIR/requirements.txt" ]; then
|
||||
step_ok "requirements.txt found. Ensure dependencies are installed with 'pip install -r requirements.txt'."
|
||||
else
|
||||
step_fail "requirements.txt not found."
|
||||
fi
|
||||
|
||||
# Check 5: Git working directory status
|
||||
step_info "Checking Git status..."
|
||||
if git -C "$ROOT_DIR" diff --quiet && git -C "$ROOT_DIR" diff --cached --quiet; then
|
||||
step_ok "Git working directory is clean."
|
||||
else
|
||||
step_fail "Git working directory has uncommitted changes. Please commit or stash them."
|
||||
fi
|
||||
|
||||
# --- Summary ---
|
||||
echo "=================================================================="
|
||||
if [ $FAIL_COUNT -eq 0 ]; then
|
||||
echo "✅✅✅ Preflight checks passed successfully! ✅✅✅"
|
||||
exit 0
|
||||
else
|
||||
echo "❌❌❌ Preflight checks failed with $FAIL_COUNT error(s). Please resolve them and re-run. ❌❌❌"
|
||||
exit 1
|
||||
fi
|
||||
0
scripts/smoke-test.sh
Executable file → Normal file
0
scripts/smoke-test.sh
Executable file → Normal file
Loading…
Reference in New Issue
Block a user