Files
smom-dbis-138/scripts/azure/wait-and-redeploy.sh
defiQUG 1fb7266469 Add Oracle Aggregator and CCIP Integration
- Introduced Aggregator.sol for Chainlink-compatible oracle functionality, including round-based updates and access control.
- Added OracleWithCCIP.sol to extend Aggregator with CCIP cross-chain messaging capabilities.
- Created .gitmodules to include OpenZeppelin contracts as a submodule.
- Developed a comprehensive deployment guide in NEXT_STEPS_COMPLETE_GUIDE.md for Phase 2 and smart contract deployment.
- Implemented Vite configuration for the orchestration portal, supporting both Vue and React frameworks.
- Added server-side logic for the Multi-Cloud Orchestration Portal, including API endpoints for environment management and monitoring.
- Created scripts for resource import and usage validation across non-US regions.
- Added tests for CCIP error handling and integration to ensure robust functionality.
- Included various new files and directories for the orchestration portal and deployment scripts.
2025-12-12 14:57:48 -08:00

122 lines
4.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Wait for deletions to complete, then redeploy with Terraform
set -e
SUBSCRIPTION_ID="fc08d829-4f14-413d-ab27-ce024425db0b"
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
TERRAFORM_DIR="$PROJECT_ROOT/terraform/well-architected/cloud-sovereignty"
echo "╔════════════════════════════════════════════════════════════════╗"
echo "║ WAIT FOR DELETIONS & REDEPLOY ║"
echo "╚════════════════════════════════════════════════════════════════╝"
echo ""
echo "⏳ Waiting for all cluster deletions to complete..."
echo ""
MAX_WAIT=1800 # 30 minutes max
ELAPSED=0
CHECK_INTERVAL=15
while [ $ELAPSED -lt $MAX_WAIT ]; do
# Count clusters still in deleting or failed/canceled state
DELETING=$(az aks list --subscription "$SUBSCRIPTION_ID" \
--query "[?contains(name, 'az-p-') && (provisioningState == 'Deleting' || provisioningState == 'Failed' || provisioningState == 'Canceled')].name" -o tsv 2>/dev/null | wc -l)
if [ "$DELETING" -eq 0 ]; then
echo ""
echo "✅ All problematic clusters deleted!"
break
fi
MINUTES=$((ELAPSED / 60))
SECONDS=$((ELAPSED % 60))
echo " [${MINUTES}m ${SECONDS}s] Still deleting: $DELETING clusters remaining..."
sleep $CHECK_INTERVAL
ELAPSED=$((ELAPSED + CHECK_INTERVAL))
done
if [ $ELAPSED -ge $MAX_WAIT ]; then
echo ""
echo "⚠️ Timeout waiting for deletions. Proceeding anyway..."
fi
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Step 2: Re-run Terraform Deployment"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
cd "$TERRAFORM_DIR"
echo "Initializing Terraform..."
terraform init -upgrade >/dev/null 2>&1 || true
echo ""
echo "Re-running Terraform deployment..."
echo "This will recreate all deleted clusters with proper configuration"
echo ""
echo "⚠️ This will take 15-30 minutes depending on region availability"
echo ""
# Run Terraform apply with maximum parallelism
terraform apply -parallelism=128 -auto-approve 2>&1 | tee /tmp/terraform-apply-redeploy.log
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Step 3: Verify Deployment"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "Waiting 30 seconds for clusters to stabilize..."
sleep 30
echo ""
echo "Checking cluster status..."
echo ""
READY_COUNT=$(az aks list --subscription "$SUBSCRIPTION_ID" \
--query "[?contains(name, 'az-p-') && provisioningState == 'Succeeded'].name" -o tsv 2>/dev/null | wc -l)
FAILED_COUNT=$(az aks list --subscription "$SUBSCRIPTION_ID" \
--query "[?contains(name, 'az-p-') && provisioningState == 'Failed'].name" -o tsv 2>/dev/null | wc -l)
CREATING_COUNT=$(az aks list --subscription "$SUBSCRIPTION_ID" \
--query "[?contains(name, 'az-p-') && provisioningState == 'Creating'].name" -o tsv 2>/dev/null | wc -l)
echo "📊 Deployment Status:"
echo " ✅ Ready (Succeeded): $READY_COUNT"
echo " ❌ Failed: $FAILED_COUNT"
echo " ⏳ Creating: $CREATING_COUNT"
echo ""
if [ "$CREATING_COUNT" -gt 0 ]; then
echo "⚠️ Some clusters are still creating. Monitor with:"
echo " az aks list --subscription $SUBSCRIPTION_ID --query \"[?contains(name, 'az-p-')].{name:name, state:provisioningState}\" -o table"
fi
if [ "$FAILED_COUNT" -gt 0 ]; then
echo "⚠️ Some clusters failed. Check logs:"
echo " tail -100 /tmp/terraform-apply-redeploy.log"
echo " ./scripts/azure/analyze-deployment-failures.sh"
fi
if [ "$READY_COUNT" -ge 20 ]; then
echo ""
echo "✅ Deployment successful! Most clusters are ready."
echo ""
echo "🎯 Next Steps:"
echo " ./scripts/deployment/wait-and-run-all-next-steps.sh"
fi
echo ""
echo "✅ Redeployment process complete!"
echo ""
echo "📝 Logs:"
echo " • Terraform: /tmp/terraform-apply-redeploy.log"
echo " • This script: Check output above"
echo ""