feat: implement naming convention, deployment automation, and infrastructure updates

- Add comprehensive naming convention (provider-region-resource-env-purpose)
- Implement Terraform locals for centralized naming
- Update all Terraform resources to use new naming convention
- Create deployment automation framework (18 phase scripts)
- Add Azure setup scripts (provider registration, quota checks)
- Update deployment scripts config with naming functions
- Create complete deployment documentation (guide, steps, quick reference)
- Add frontend portal implementations (public and internal)
- Add UI component library (18 components)
- Enhance Entra VerifiedID integration with file utilities
- Add API client package for all services
- Create comprehensive documentation (naming, deployment, next steps)

Infrastructure:
- Resource groups, storage accounts with new naming
- Terraform configuration updates
- Outputs with naming convention examples

Deployment:
- Automated deployment scripts for all 15 phases
- State management and logging
- Error handling and validation

Documentation:
- Naming convention guide and implementation summary
- Complete deployment guide (296 steps)
- Next steps and quick start guides
- Azure prerequisites and setup completion docs

Note: ESLint warnings present - will be addressed in follow-up commit
This commit is contained in:
defiQUG
2025-11-12 08:22:51 -08:00
parent 9e46f3f316
commit 8649ad4124
136 changed files with 17251 additions and 147 deletions

130
infra/scripts/README.md Normal file
View File

@@ -0,0 +1,130 @@
# Azure Setup Scripts
This directory contains scripts for setting up Azure infrastructure prerequisites for The Order.
## Scripts
### 1. `azure-setup.sh` - Complete Azure Setup
Comprehensive setup script that:
- Lists all available Azure Commercial regions (excluding US)
- Sets default region to West Europe
- Checks and registers required resource providers
- Checks quotas for primary regions
- Generates reports
**Usage:**
```bash
./infra/scripts/azure-setup.sh
```
**Output Files:**
- `azure-regions.txt` - List of all non-US regions
- `azure-quotas.txt` - Quota information for primary regions
### 2. `azure-register-providers.sh` - Register Resource Providers
Registers all required Azure Resource Providers for The Order.
**Usage:**
```bash
./infra/scripts/azure-register-providers.sh
```
**What it does:**
- Checks registration status of all required providers
- Registers unregistered providers
- Waits for registration to complete
- Reports final status
### 3. `azure-check-quotas.sh` - Check Quotas for All Regions
Checks quotas for all non-US Azure regions.
**Usage:**
```bash
./infra/scripts/azure-check-quotas.sh
```
**Output:**
- `azure-quotas-all-regions.txt` - Detailed quota information for all regions
## Prerequisites
1. **Azure CLI installed**
```bash
# Check if installed
az --version
# Install if needed
# https://docs.microsoft.com/en-us/cli/azure/install-azure-cli
```
2. **Azure CLI logged in**
```bash
az login
az account show
```
3. **Required permissions**
- Subscription Contributor or Owner role
- Ability to register resource providers
- Ability to check quotas
## Quick Start
1. **Login to Azure**
```bash
az login
```
2. **Run complete setup**
```bash
./infra/scripts/azure-setup.sh
```
3. **Verify providers are registered**
```bash
./infra/scripts/azure-register-providers.sh
```
4. **Check quotas**
```bash
./infra/scripts/azure-check-quotas.sh
```
## Required Resource Providers
See `infra/terraform/AZURE_RESOURCE_PROVIDERS.md` for complete list.
## Default Region
**West Europe (westeurope)** is the default region. US Commercial and Government regions are **not used**.
## Troubleshooting
### Script fails with "not logged in"
```bash
az login
az account set --subscription <subscription-id>
```
### Provider registration fails
- Check subscription permissions
- Verify subscription is active
- Wait 5-10 minutes and retry
### Quota check fails
- Some regions may not support all quota types
- Check individual regions manually if needed
## Output Files
All scripts generate output files in the current directory:
- `azure-regions.txt` - List of available regions
- `azure-quotas.txt` - Quotas for primary regions
- `azure-quotas-all-regions.txt` - Quotas for all regions
Review these files to understand available resources and limits.

View File

@@ -0,0 +1,84 @@
#!/bin/bash
#
# Azure Quota Check Script
# Checks quotas for all non-US Azure regions
#
set -e
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m'
# Check if Azure CLI is installed
if ! command -v az &> /dev/null; then
echo -e "${RED}Error: Azure CLI is not installed.${NC}"
exit 1
fi
# Check if logged in
if ! az account show &> /dev/null; then
echo -e "${YELLOW}Please log in to Azure...${NC}"
az login
fi
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE}Azure Quota Check - All Non-US Regions${NC}"
echo -e "${BLUE}========================================${NC}"
echo ""
# Get all non-US regions
echo -e "${YELLOW}Fetching non-US regions...${NC}"
REGIONS=$(az account list-locations \
--query "[?metadata.regionType=='Physical' && !contains(name, 'us')].name" \
-o tsv)
REGION_COUNT=$(echo "${REGIONS}" | wc -l)
echo -e "${GREEN}Found ${REGION_COUNT} non-US regions${NC}"
echo ""
# Output file
QUOTA_FILE="azure-quotas-all-regions.txt"
> "${QUOTA_FILE}"
echo "Azure Quota Report - All Non-US Regions" >> "${QUOTA_FILE}"
echo "Generated: $(date)" >> "${QUOTA_FILE}"
echo "Subscription: $(az account show --query name -o tsv)" >> "${QUOTA_FILE}"
echo "========================================" >> "${QUOTA_FILE}"
echo "" >> "${QUOTA_FILE}"
# Check quotas for each region
REGION_INDEX=0
for region in ${REGIONS}; do
REGION_INDEX=$((REGION_INDEX + 1))
echo -e "${BLUE}[${REGION_INDEX}/${REGION_COUNT}] Checking ${region}...${NC}"
echo "" >> "${QUOTA_FILE}"
echo "========================================" >> "${QUOTA_FILE}"
echo "Region: ${region}" >> "${QUOTA_FILE}"
echo "========================================" >> "${QUOTA_FILE}"
# VM quotas
echo "VM Family Quotas:" >> "${QUOTA_FILE}"
az vm list-usage --location "${region}" -o table >> "${QUOTA_FILE}" 2>/dev/null || echo " Unable to fetch VM quotas" >> "${QUOTA_FILE}"
echo "" >> "${QUOTA_FILE}"
# Storage quotas
echo "Storage Account Quota:" >> "${QUOTA_FILE}"
az storage account show-usage --location "${region}" -o json >> "${QUOTA_FILE}" 2>/dev/null || echo " Unable to fetch storage quotas" >> "${QUOTA_FILE}"
echo "" >> "${QUOTA_FILE}"
# Network quotas
echo "Network Quotas:" >> "${QUOTA_FILE}"
az network list-usages --location "${region}" -o table >> "${QUOTA_FILE}" 2>/dev/null || echo " Unable to fetch network quotas" >> "${QUOTA_FILE}"
echo "" >> "${QUOTA_FILE}"
done
echo ""
echo -e "${GREEN}✓ Quota check complete${NC}"
echo -e "${GREEN}✓ Results saved to: ${QUOTA_FILE}${NC}"
echo ""

View File

@@ -0,0 +1,133 @@
#!/bin/bash
#
# Azure Resource Provider Registration Script
# Registers all required resource providers for The Order
#
set -e
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m'
# Required Resource Providers
REQUIRED_PROVIDERS=(
"Microsoft.ContainerService" # AKS
"Microsoft.KeyVault" # Key Vault
"Microsoft.Storage" # Storage Accounts
"Microsoft.Network" # Networking
"Microsoft.Compute" # Compute resources
"Microsoft.DBforPostgreSQL" # PostgreSQL
"Microsoft.ContainerRegistry" # ACR
"Microsoft.ManagedIdentity" # Managed Identities
"Microsoft.Insights" # Application Insights, Monitor
"Microsoft.Logic" # Logic Apps
"Microsoft.OperationalInsights" # Log Analytics
"Microsoft.Authorization" # RBAC
"Microsoft.Resources" # Resource Manager
)
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE}Azure Resource Provider Registration${NC}"
echo -e "${BLUE}========================================${NC}"
echo ""
# Check if Azure CLI is installed
if ! command -v az &> /dev/null; then
echo -e "${RED}Error: Azure CLI is not installed.${NC}"
exit 1
fi
# Check if logged in
if ! az account show &> /dev/null; then
echo -e "${YELLOW}Please log in to Azure...${NC}"
az login
fi
SUBSCRIPTION_ID=$(az account show --query id -o tsv)
SUBSCRIPTION_NAME=$(az account show --query name -o tsv)
echo -e "${GREEN}Subscription: ${SUBSCRIPTION_NAME} (${SUBSCRIPTION_ID})${NC}"
echo ""
# Check current registration status
echo -e "${YELLOW}Checking current registration status...${NC}"
echo ""
UNREGISTERED=()
ALREADY_REGISTERED=()
REGISTERING=()
for provider in "${REQUIRED_PROVIDERS[@]}"; do
STATUS=$(az provider show --namespace "${provider}" --query "registrationState" -o tsv 2>/dev/null || echo "NotRegistered")
if [ "${STATUS}" == "Registered" ]; then
echo -e "${GREEN}${provider} - Already Registered${NC}"
ALREADY_REGISTERED+=("${provider}")
elif [ "${STATUS}" == "Registering" ]; then
echo -e "${YELLOW}${provider} - Currently Registering${NC}"
REGISTERING+=("${provider}")
else
echo -e "${RED}${provider} - Not Registered${NC}"
UNREGISTERED+=("${provider}")
fi
done
echo ""
# Register unregistered providers
if [ ${#UNREGISTERED[@]} -gt 0 ]; then
echo -e "${YELLOW}Registering ${#UNREGISTERED[@]} unregistered provider(s)...${NC}"
echo ""
for provider in "${UNREGISTERED[@]}"; do
echo -n "Registering ${provider}... "
az provider register --namespace "${provider}" --wait
echo -e "${GREEN}✓ Registered${NC}"
done
echo ""
fi
# Wait for providers that are currently registering
if [ ${#REGISTERING[@]} -gt 0 ]; then
echo -e "${YELLOW}Waiting for ${#REGISTERING[@]} provider(s) to finish registering...${NC}"
echo ""
for provider in "${REGISTERING[@]}"; do
echo -n "Waiting for ${provider}... "
az provider register --namespace "${provider}" --wait
echo -e "${GREEN}✓ Registered${NC}"
done
echo ""
fi
# Final status check
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE}Final Registration Status${NC}"
echo -e "${BLUE}========================================${NC}"
echo ""
ALL_REGISTERED=true
for provider in "${REQUIRED_PROVIDERS[@]}"; do
STATUS=$(az provider show --namespace "${provider}" --query "registrationState" -o tsv)
if [ "${STATUS}" == "Registered" ]; then
echo -e "${GREEN}${provider}${NC}"
else
echo -e "${RED}${provider} - Status: ${STATUS}${NC}"
ALL_REGISTERED=false
fi
done
echo ""
if [ "${ALL_REGISTERED}" = true ]; then
echo -e "${GREEN}✓ All required resource providers are registered!${NC}"
exit 0
else
echo -e "${YELLOW}⚠ Some providers are not yet registered. Please wait and run this script again.${NC}"
exit 1
fi

254
infra/scripts/azure-setup.sh Executable file
View File

@@ -0,0 +1,254 @@
#!/bin/bash
#
# Azure Setup Script for The Order
# This script sets up Azure prerequisites including:
# - Listing available regions (excluding US)
# - Checking and registering required resource providers
# - Checking quotas for all regions
# - Setting default region to West Europe
#
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Default region
DEFAULT_REGION="westeurope"
# Required Resource Providers
REQUIRED_PROVIDERS=(
"Microsoft.ContainerService" # AKS
"Microsoft.KeyVault" # Key Vault
"Microsoft.Storage" # Storage Accounts
"Microsoft.Network" # Networking
"Microsoft.Compute" # Compute resources
"Microsoft.DBforPostgreSQL" # PostgreSQL
"Microsoft.ContainerRegistry" # ACR
"Microsoft.ManagedIdentity" # Managed Identities
"Microsoft.Insights" # Application Insights, Monitor
"Microsoft.Logic" # Logic Apps
"Microsoft.OperationalInsights" # Log Analytics
"Microsoft.Authorization" # RBAC
"Microsoft.Resources" # Resource Manager
)
# Preview Features (if needed)
PREVIEW_FEATURES=(
# Add preview features here if needed
# Example: "Microsoft.ContainerService/EnableWorkloadIdentityPreview"
)
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE}Azure Setup for The Order${NC}"
echo -e "${BLUE}========================================${NC}"
echo ""
# Check if Azure CLI is installed
if ! command -v az &> /dev/null; then
echo -e "${RED}Error: Azure CLI is not installed.${NC}"
echo "Please install it from: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli"
exit 1
fi
# Check if logged in
echo -e "${YELLOW}Checking Azure CLI login status...${NC}"
if ! az account show &> /dev/null; then
echo -e "${YELLOW}Not logged in. Please log in...${NC}"
az login
fi
# Get current subscription
SUBSCRIPTION_ID=$(az account show --query id -o tsv)
SUBSCRIPTION_NAME=$(az account show --query name -o tsv)
echo -e "${GREEN}Current Subscription: ${SUBSCRIPTION_NAME} (${SUBSCRIPTION_ID})${NC}"
echo ""
# Set default region
echo -e "${BLUE}Setting default region to: ${DEFAULT_REGION}${NC}"
export AZURE_DEFAULT_REGION=${DEFAULT_REGION}
echo ""
# ============================================
# 1. List All Azure Commercial Regions (Excluding US)
# ============================================
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE}1. Available Azure Commercial Regions${NC}"
echo -e "${BLUE}========================================${NC}"
echo ""
# Get all locations and filter out US regions
echo -e "${YELLOW}Fetching available regions (excluding US)...${NC}"
az account list-locations \
--query "[?metadata.regionType=='Physical' && !contains(name, 'us')].{Name:name, DisplayName:displayName, RegionalDisplayName:regionalDisplayName}" \
-o table
echo ""
echo -e "${YELLOW}Recommended regions for The Order:${NC}"
echo " - westeurope (Primary - Default)"
echo " - northeurope (Secondary)"
echo " - uksouth (UK)"
echo " - switzerlandnorth (Switzerland)"
echo " - norwayeast (Norway)"
echo ""
# Save regions to file
REGIONS_FILE="azure-regions.txt"
az account list-locations \
--query "[?metadata.regionType=='Physical' && !contains(name, 'us')].name" \
-o tsv > "${REGIONS_FILE}"
echo -e "${GREEN}Regions list saved to: ${REGIONS_FILE}${NC}"
echo ""
# ============================================
# 2. List Required Resource Providers
# ============================================
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE}2. Required Resource Providers${NC}"
echo -e "${BLUE}========================================${NC}"
echo ""
echo -e "${YELLOW}Required Resource Providers:${NC}"
for provider in "${REQUIRED_PROVIDERS[@]}"; do
echo " - ${provider}"
done
echo ""
# ============================================
# 3. Check and Register Resource Providers
# ============================================
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE}3. Checking Resource Provider Registration${NC}"
echo -e "${BLUE}========================================${NC}"
echo ""
UNREGISTERED_PROVIDERS=()
for provider in "${REQUIRED_PROVIDERS[@]}"; do
echo -n "Checking ${provider}... "
STATUS=$(az provider show --namespace "${provider}" --query "registrationState" -o tsv 2>/dev/null || echo "NotRegistered")
if [ "${STATUS}" == "Registered" ]; then
echo -e "${GREEN}✓ Registered${NC}"
else
echo -e "${YELLOW}✗ Not Registered${NC}"
UNREGISTERED_PROVIDERS+=("${provider}")
fi
done
echo ""
# Register unregistered providers
if [ ${#UNREGISTERED_PROVIDERS[@]} -gt 0 ]; then
echo -e "${YELLOW}Registering unregistered providers...${NC}"
for provider in "${UNREGISTERED_PROVIDERS[@]}"; do
echo -n "Registering ${provider}... "
az provider register --namespace "${provider}" --wait
echo -e "${GREEN}✓ Registered${NC}"
done
echo ""
else
echo -e "${GREEN}All required providers are already registered!${NC}"
echo ""
fi
# ============================================
# 4. Check Preview Features
# ============================================
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE}4. Preview Features${NC}"
echo -e "${BLUE}========================================${NC}"
echo ""
if [ ${#PREVIEW_FEATURES[@]} -gt 0 ]; then
echo -e "${YELLOW}Required Preview Features:${NC}"
for feature in "${PREVIEW_FEATURES[@]}"; do
echo " - ${feature}"
done
echo ""
echo -e "${YELLOW}Note: Preview features may need to be enabled manually in Azure Portal${NC}"
echo ""
else
echo -e "${GREEN}No preview features required.${NC}"
echo ""
fi
# ============================================
# 5. Check Quotas for All Regions
# ============================================
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE}5. Checking Quotas for All Regions${NC}"
echo -e "${BLUE}========================================${NC}"
echo ""
# Read regions from file
REGIONS=$(cat "${REGIONS_FILE}")
# Quota types to check
QUOTA_TYPES=(
"cores" # VM cores
"virtualMachines" # VM instances
)
# Primary regions to check in detail
PRIMARY_REGIONS=("westeurope" "northeurope" "uksouth")
echo -e "${YELLOW}Checking quotas for primary regions...${NC}"
echo ""
QUOTA_FILE="azure-quotas.txt"
> "${QUOTA_FILE}" # Clear file
for region in "${PRIMARY_REGIONS[@]}"; do
echo -e "${BLUE}Region: ${region}${NC}"
echo "----------------------------------------"
# Get VM family quotas
echo "VM Family Quotas:"
az vm list-usage \
--location "${region}" \
--query "[].{Name:name.value, CurrentValue:currentValue, Limit:limit}" \
-o table 2>/dev/null || echo " Unable to fetch VM quotas"
echo "" >> "${QUOTA_FILE}"
echo "Region: ${region}" >> "${QUOTA_FILE}"
echo "----------------------------------------" >> "${QUOTA_FILE}"
az vm list-usage --location "${region}" -o table >> "${QUOTA_FILE}" 2>/dev/null || true
echo "" >> "${QUOTA_FILE}"
# Get storage account quota
echo "Storage Account Quota:"
STORAGE_QUOTA=$(az storage account show-usage \
--location "${region}" \
--query "{CurrentValue:currentValue, Limit:limit}" \
-o json 2>/dev/null || echo '{"CurrentValue": "N/A", "Limit": "N/A"}')
echo "${STORAGE_QUOTA}" | jq '.' 2>/dev/null || echo "${STORAGE_QUOTA}"
echo ""
done
echo -e "${GREEN}Detailed quota information saved to: ${QUOTA_FILE}${NC}"
echo ""
# ============================================
# 6. Summary
# ============================================
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE}Setup Summary${NC}"
echo -e "${BLUE}========================================${NC}"
echo ""
echo -e "${GREEN}✓ Default region set to: ${DEFAULT_REGION}${NC}"
echo -e "${GREEN}✓ Available regions listed (excluding US)${NC}"
echo -e "${GREEN}✓ Resource providers checked and registered${NC}"
echo -e "${GREEN}✓ Quotas checked for primary regions${NC}"
echo ""
echo -e "${YELLOW}Next Steps:${NC}"
echo " 1. Review quota limits in ${QUOTA_FILE}"
echo " 2. Update Terraform variables with region: ${DEFAULT_REGION}"
echo " 3. Proceed with infrastructure deployment"
echo ""