|
| 1 | +environment: |
| 2 | + name: content-generation |
| 3 | + location: eastus |
| 4 | + |
| 5 | +name: content-generation |
| 6 | +metadata: |
| 7 | + template: content-generation@1.22 |
| 8 | + |
| 9 | +requiredVersions: |
| 10 | + azd: '>= 1.18.0' |
| 11 | + |
| 12 | +parameters: |
| 13 | + solutionPrefix: |
| 14 | + type: string |
| 15 | + default: contentgen |
| 16 | + displayName: Solution Prefix |
| 17 | + description: A unique prefix for all resources (3-15 chars) |
| 18 | + azureAiServiceLocation: |
| 19 | + type: string |
| 20 | + default: eastus |
| 21 | + displayName: AI Services Location |
| 22 | + description: Location for Azure AI Services deployments |
| 23 | + enableMonitoring: |
| 24 | + type: boolean |
| 25 | + default: false |
| 26 | + displayName: Enable Monitoring (WAF) |
| 27 | + description: Enable Log Analytics and Application Insights |
| 28 | + enableScalability: |
| 29 | + type: boolean |
| 30 | + default: false |
| 31 | + displayName: Enable Scalability (WAF) |
| 32 | + description: Enable auto-scaling and higher SKUs |
| 33 | + enableRedundancy: |
| 34 | + type: boolean |
| 35 | + default: false |
| 36 | + displayName: Enable Redundancy (WAF) |
| 37 | + description: Enable zone redundancy and geo-replication |
| 38 | + enablePrivateNetworking: |
| 39 | + type: boolean |
| 40 | + default: false |
| 41 | + displayName: Enable Private Networking (WAF) |
| 42 | + description: Enable VNet integration and private endpoints |
| 43 | + |
| 44 | +infra: |
| 45 | + provider: bicep |
| 46 | + path: ./content-gen/infra |
| 47 | + module: main |
| 48 | + |
| 49 | +workflows: |
| 50 | + up: |
| 51 | + steps: |
| 52 | + - azd: provision |
| 53 | + |
| 54 | +hooks: |
| 55 | + postprovision: |
| 56 | + windows: |
| 57 | + run: | |
| 58 | + Write-Host "===== Provision Complete =====" -ForegroundColor Green |
| 59 | + Write-Host "" |
| 60 | + Write-Host "Web App URL: " -NoNewline |
| 61 | + Write-Host "$env:WEB_APP_URL" -ForegroundColor Cyan |
| 62 | + Write-Host "Storage Account: " -NoNewline |
| 63 | + Write-Host "$env:AZURE_BLOB_ACCOUNT_NAME" -ForegroundColor Cyan |
| 64 | + Write-Host "AI Search Service: " -NoNewline |
| 65 | + Write-Host "$env:AI_SEARCH_SERVICE_NAME" -ForegroundColor Cyan |
| 66 | + Write-Host "AI Search Index: " -NoNewline |
| 67 | + Write-Host "$env:AZURE_AI_SEARCH_PRODUCTS_INDEX" -ForegroundColor Cyan |
| 68 | + Write-Host "AI Service Location: " -NoNewline |
| 69 | + Write-Host "$env:AZURE_ENV_OPENAI_LOCATION" -ForegroundColor Cyan |
| 70 | + Write-Host "Container Instance: " -NoNewline |
| 71 | + Write-Host "$env:CONTAINER_INSTANCE_NAME" -ForegroundColor Cyan |
| 72 | + |
| 73 | + # Run post-deploy script to upload sample data and create search index |
| 74 | + Write-Host "" |
| 75 | + # Note: Cosmos DB role is assigned to deployer via Bicep. |
| 76 | + Write-Host "===== Running Post-Deploy Script =====" -ForegroundColor Yellow |
| 77 | + Write-Host "This will upload sample data and create the search index..." |
| 78 | +
|
| 79 | + # Ensure post-deploy Python dependencies are installed |
| 80 | + $python = "python" |
| 81 | + if (Test-Path "./.venv/Scripts/python.exe") { $python = "./.venv/Scripts/python.exe" } |
| 82 | + elseif (Test-Path "../.venv/Scripts/python.exe") { $python = "../.venv/Scripts/python.exe" } |
| 83 | + elseif (Test-Path "./.venv/bin/python") { $python = "./.venv/bin/python" } |
| 84 | + elseif (Test-Path "../.venv/bin/python") { $python = "../.venv/bin/python" } |
| 85 | + & $python -m pip install -r ./content-gen/scripts/requirements-post-deploy.txt --quiet | Out-Null |
| 86 | + |
| 87 | + if (Test-Path "./content-gen/scripts/post_deploy.py") { |
| 88 | + & $python ./content-gen/scripts/post_deploy.py --skip-tests |
| 89 | + |
| 90 | + if ($LASTEXITCODE -eq 0) { |
| 91 | + Write-Host "Post-deploy script completed successfully!" -ForegroundColor Green |
| 92 | + } else { |
| 93 | + Write-Host "Post-deploy script completed with warnings (some steps may have failed)" -ForegroundColor Yellow |
| 94 | + } |
| 95 | + } else { |
| 96 | + Write-Host "Warning: post_deploy.py not found, skipping sample data upload" -ForegroundColor Yellow |
| 97 | + } |
| 98 | + |
| 99 | + Write-Host "" |
| 100 | + Write-Host "===== Deployment Complete =====" -ForegroundColor Green |
| 101 | + Write-Host "" |
| 102 | + Write-Host "Access the web application:" |
| 103 | + Write-Host " $env:WEB_APP_URL" -ForegroundColor Cyan |
| 104 | + shell: pwsh |
| 105 | + continueOnError: false |
| 106 | + interactive: true |
| 107 | + posix: |
| 108 | + run: | |
| 109 | + echo "===== Provision Complete =====" |
| 110 | + echo "" |
| 111 | + echo "Web App URL: $WEB_APP_URL" |
| 112 | + echo "Storage Account: $AZURE_BLOB_ACCOUNT_NAME" |
| 113 | + echo "AI Search Service: $AI_SEARCH_SERVICE_NAME" |
| 114 | + echo "AI Search Index: $AZURE_AI_SEARCH_PRODUCTS_INDEX" |
| 115 | + echo "AI Service Location: $AZURE_ENV_OPENAI_LOCATION" |
| 116 | + echo "Container Instance: $CONTAINER_INSTANCE_NAME" |
| 117 | + |
| 118 | + echo "" |
| 119 | + echo "Container Registry: $ACR_NAME" |
| 120 | + |
| 121 | + # Run post-deploy script to upload sample data and create search index |
| 122 | + echo "" |
| 123 | + # Note: Cosmos DB role is assigned to deployer via Bicep. |
| 124 | + echo "===== Running Post-Deploy Script =====" |
| 125 | + echo "This will upload sample data and create the search index..." |
| 126 | + |
| 127 | + if [ -f "./content-gen/scripts/post_deploy.py" ]; then |
| 128 | + # Prefer local venv if present (repo root or content-gen) |
| 129 | + if [ -x "./.venv/bin/python" ]; then |
| 130 | + PYTHON_BIN="./.venv/bin/python" |
| 131 | + elif [ -x "../.venv/bin/python" ]; then |
| 132 | + PYTHON_BIN="../.venv/bin/python" |
| 133 | + else |
| 134 | + PYTHON_BIN="python3" |
| 135 | + fi |
| 136 | +
|
| 137 | + "$PYTHON_BIN" -m pip install -r ./content-gen/scripts/requirements-post-deploy.txt --quiet > /dev/null \ |
| 138 | + && "$PYTHON_BIN" ./content-gen/scripts/post_deploy.py --skip-tests \ |
| 139 | + && echo "Post-deploy script completed successfully!" \ |
| 140 | + || echo "Post-deploy script completed with warnings (some steps may have failed)" |
| 141 | + else |
| 142 | + echo "Warning: post_deploy.py not found, skipping sample data upload" |
| 143 | + fi |
| 144 | + |
| 145 | + echo "" |
| 146 | + echo "===== Deployment Complete =====" |
| 147 | + echo "" |
| 148 | + echo "Access the web application:" |
| 149 | + echo " $WEB_APP_URL" |
| 150 | + shell: sh |
| 151 | + continueOnError: false |
| 152 | + interactive: true |
0 commit comments