Some checks are pending
Check Python Version Consistency / Check Python Version (push) Waiting to run
49 lines
1.4 KiB
Bash
Executable File
49 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# ============================================================
|
|
# OPAX-MCP v3.6.0 Deployment Script
|
|
# Bypasses VPC Service Controls by building/pushing locally
|
|
# ============================================================
|
|
|
|
PROJECT="propane-will-491900-m5"
|
|
REGION="us-central1"
|
|
REPO="osvauco-repo"
|
|
IMAGE="opax-mcp"
|
|
TAG="v3.6.0"
|
|
FULL_IMAGE="${REGION}-docker.pkg.dev/${PROJECT}/${REPO}/${IMAGE}:${TAG}"
|
|
SERVICE_NAME="opax-mcp"
|
|
|
|
echo "=== 1. Configure Docker auth for Artifact Registry ==="
|
|
gcloud auth configure-docker ${REGION}-docker.pkg.dev --quiet
|
|
|
|
echo "=== 2. Build image locally ==="
|
|
cd opax-mcp
|
|
docker build -t "${FULL_IMAGE}" .
|
|
|
|
echo "=== 3. Push image to Artifact Registry ==="
|
|
docker push "${FULL_IMAGE}"
|
|
|
|
echo "=== 4. Deploy to Cloud Run ==="
|
|
cd ..
|
|
gcloud run services replace opax-mcp.yaml --region="${REGION}" --quiet
|
|
|
|
echo "=== 5. Verify deployment ==="
|
|
SVC_URL=$(gcloud run services describe "${SERVICE_NAME}" --region="${REGION}" --format='value(status.url)')
|
|
echo "Service URL: ${SVC_URL}"
|
|
|
|
echo "=== 6. Health check ==="
|
|
for i in {1..10}; do
|
|
if curl -sf "${SVC_URL}/health" | grep -q '"status":"ok"'; then
|
|
echo "✅ Deployment successful! Service is healthy."
|
|
curl -s "${SVC_URL}/health" | jq .
|
|
exit 0
|
|
fi
|
|
echo "Waiting for service... (${i}/10)"
|
|
sleep 5
|
|
done
|
|
|
|
echo "❌ Health check failed after 10 attempts"
|
|
curl -s "${SVC_URL}/health" || true
|
|
exit 1
|