- 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.
6.4 KiB
Azure and Cloudflare Environment Setup Guide
Last Updated: 2025-01-27
Status: Active
Purpose: Azure and Cloudflare environment variable configuration
This guide helps you populate your .env file with values from Azure and Cloudflare.
Related Documentation:
- Network Configuration Guide - For Besu network configuration
- Contract Deployment Environment Setup - For contract deployment environment variables
Quick Start
Option 1: Interactive Script (Recommended)
Run the interactive script that will automatically populate your .env file:
./scripts/deployment/populate-env.sh
This script will:
- ✅ Retrieve Azure Subscription ID and Tenant ID from Azure CLI
- ✅ Get or create Terraform backend storage account
- ✅ Prompt for Cloudflare Zone ID and API Token
- ✅ Update your
.envfile automatically
Option 2: View Values First
If you want to see what values will be populated before updating:
# View all retrievable values
./scripts/deployment/get-env-values.sh
# Or save to a file for review
./scripts/deployment/get-env-values.sh > env-values.txt
cat env-values.txt
Then manually copy the values to your .env file.
Prerequisites
Before running the scripts:
-
Azure CLI installed and logged in:
az login az account show # Verify login -
Cloudflare credentials ready:
- Zone ID: Found in Cloudflare Dashboard > Your Domain > Overview > Zone ID
- API Token: Create in Cloudflare Dashboard > My Profile > API Tokens
Examples
Example: Complete .env File
# Azure Configuration
AZURE_SUBSCRIPTION_ID=12345678-1234-1234-1234-123456789012
AZURE_TENANT_ID=87654321-4321-4321-4321-210987654321
AZURE_RESOURCE_GROUP=az-p-wst-rg-comp-001
AZURE_LOCATION=westeurope
# Terraform Backend
TF_STATE_STORAGE_ACCOUNT=azpwesttfstate001
TF_STATE_RESOURCE_GROUP=az-p-wst-rg-tfstate-001
TF_STATE_CONTAINER=tfstate
# Cloudflare
CLOUDFLARE_ZONE_ID=abc123def456ghi789
CLOUDFLARE_API_TOKEN=your-api-token-here
# RPC Configuration
RPC_URL=https://rpc.d-bis.org
CHAIN_ID=138
Example: Retrieving Values
# Get Azure subscription ID
az account show --query id -o tsv
# Get Cloudflare zone ID
# Found in Cloudflare Dashboard > Your Domain > Overview > Zone ID
Environment Variables
Azure Configuration (Auto-retrieved)
These are automatically retrieved from Azure CLI:
AZURE_SUBSCRIPTION_ID- Your Azure subscription IDAZURE_TENANT_ID- Your Azure tenant IDAZURE_RESOURCE_GROUP- Resource group name (default:defi-oracle-mainnet-rg)AZURE_LOCATION- Azure region (default:eastus)
Terraform Backend (Auto-created or retrieved)
ARM_RESOURCE_GROUP_NAME- Resource group for Terraform state (default:tfstate-rg)ARM_STORAGE_ACCOUNT_NAME- Storage account name (auto-generated or existing)ARM_CONTAINER_NAME- Container name (default:tfstate)ARM_ACCESS_KEY- Storage account access key
Cloudflare Configuration (Manual input required)
CLOUDFLARE_ZONE_ID- Your Cloudflare Zone IDCLOUDFLARE_API_TOKEN- Your Cloudflare API Token
Optional Variables
These can be set later:
AZURE_CLIENT_ID- Service principal app ID (for CI/CD)AZURE_CLIENT_SECRET- Service principal secret (for CI/CD)RPC_URL- RPC endpoint URL (set after deployment)EXPLORER_URL- Explorer URL (set after deployment)PRIVATE_KEY- Private key for contract deployment
Manual Setup
If you prefer to set values manually:
1. Get Azure Values
# Subscription ID
az account show --query id -o tsv
# Tenant ID
az account show --query tenantId -o tsv
# Current location
az account show --query location -o tsv
2. Create Terraform Backend Storage
# Set variables
RESOURCE_GROUP="tfstate-rg"
STORAGE_ACCOUNT="tfstate$(openssl rand -hex 4)"
LOCATION="eastus"
# Create resource group
az group create --name $RESOURCE_GROUP --location $LOCATION
# Create storage account
az storage account create \
--resource-group $RESOURCE_GROUP \
--name $STORAGE_ACCOUNT \
--sku Standard_LRS \
--kind StorageV2 \
--location $LOCATION
# Create container
az storage container create \
--name "tfstate" \
--account-name $STORAGE_ACCOUNT
# Get access key
az storage account keys list \
--resource-group $RESOURCE_GROUP \
--account-name $STORAGE_ACCOUNT \
--query "[0].value" -o tsv
3. Get Cloudflare Values
-
Zone ID:
- Go to Cloudflare Dashboard
- Select your domain
- Overview page shows Zone ID
-
API Token:
- Go to Cloudflare Dashboard > My Profile > API Tokens
- Click "Create Token"
- Use "Edit zone DNS" template or create custom token with:
- Zone: DNS:Edit
- Zone: Zone:Read
Verify Setup
After populating your .env file, verify the values:
# Check Azure authentication
az account show
# Verify resource group exists (if already created)
az group show --name defi-oracle-mainnet-rg
# Test Cloudflare API (if token is set)
curl -X GET "https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONE_ID}" \
-H "Authorization: Bearer ${CLOUDFLARE_API_TOKEN}" \
-H "Content-Type: application/json"
Troubleshooting
Azure CLI Not Found
# Install Azure CLI
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
# Or on macOS
brew install azure-cli
Not Logged In to Azure
# Login interactively
az login
# Or use the helper script
./scripts/deployment/azure-login.sh
Storage Account Creation Fails
- Check you have permissions to create resources
- Verify subscription has available quota
- Try a different storage account name (must be globally unique)
Cloudflare API Token Issues
- Ensure token has correct permissions (Zone:Read, DNS:Edit)
- Verify token hasn't expired
- Check Zone ID is correct for your domain
Next Steps
After setting up your .env file:
-
Deploy Infrastructure:
cd terraform terraform init terraform plan terraform apply -
Configure DNS:
./scripts/deployment/cloudflare-dns.sh \ --zone-id $CLOUDFLARE_ZONE_ID \ --api-token $CLOUDFLARE_API_TOKEN \ --ip $(./scripts/deployment/get-app-gateway-ip.sh) -
Deploy Kubernetes Resources:
./scripts/deployment/deploy-all.sh