Skip to content

Commit 7b00bc6

Browse files
removed the ACR deployment and few infra updates
1 parent 48fb8d6 commit 7b00bc6

5 files changed

Lines changed: 5 additions & 201 deletions

File tree

content-gen/azure.yaml

Lines changed: 3 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ environment:
22
name: content-generation
33
location: eastus
44

5-
# name: content-generation
6-
# metadata:
7-
# template: content-generation@1.22
5+
name: content-generation
6+
metadata:
7+
template: content-generation@1.22
88

99
requiredVersions:
1010
azd: '>= 1.18.0'
@@ -46,10 +46,6 @@ infra:
4646
path: ./infra
4747
module: main
4848

49-
# Custom workflow:
50-
# 1. First provision creates infrastructure (skips ACI for private networking)
51-
# 2. Build container image to ACR
52-
# 3. Second provision creates ACI with the now-available image
5349
workflows:
5450
up:
5551
steps:
@@ -120,47 +116,6 @@ hooks:
120116
Write-Host " Cosmos DB role may already be assigned" -ForegroundColor Yellow
121117
}
122118
123-
# ============================================================
124-
# ACR Image Build - COMMENTED OUT
125-
# Images should be pre-built and pushed to ACR before deployment:
126-
# Frontend (App Service): content-gen-webapp:latest
127-
# Backend (ACI): content-gen-api:latest
128-
#
129-
# To build and push manually:
130-
# az acr build --registry $ACR_NAME --image content-gen-webapp:latest --file ./src/Frontend.Dockerfile ./src
131-
# az acr build --registry $ACR_NAME --image content-gen-api:latest --file ./src/backend/ApiApp.Dockerfile ./src
132-
# ============================================================
133-
134-
# # Build container image and deploy ACI if ACR exists and ACI was skipped
135-
# $skipContainer = azd env get-value skipContainerDeployment 2>$null
136-
# if ($env:ACR_NAME -and $skipContainer -eq 'true') {
137-
# Write-Host ""
138-
# Write-Host "===== Building Container Image =====" -ForegroundColor Yellow
139-
# Write-Host "Building and pushing image to ACR: $env:ACR_NAME" -ForegroundColor Cyan
140-
#
141-
# az acr build --registry $env:ACR_NAME --image content-gen-api:latest --file ./src/backend/ApiApp.Dockerfile ./src
142-
#
143-
# if ($LASTEXITCODE -eq 0) {
144-
# Write-Host "Container image built and pushed successfully!" -ForegroundColor Green
145-
#
146-
# # Enable container deployment and re-provision
147-
# Write-Host ""
148-
# Write-Host "===== Deploying Container Instance =====" -ForegroundColor Yellow
149-
# azd env set skipContainerDeployment false
150-
#
151-
# Write-Host "Re-running provision to deploy ACI..." -ForegroundColor Cyan
152-
# azd provision --no-prompt
153-
#
154-
# if ($LASTEXITCODE -eq 0) {
155-
# Write-Host "Container Instance deployed successfully!" -ForegroundColor Green
156-
# } else {
157-
# Write-Host "Container Instance deployment failed" -ForegroundColor Red
158-
# }
159-
# } else {
160-
# Write-Host "Failed to build container image" -ForegroundColor Red
161-
# }
162-
# }
163-
164119
if ($env:CONTAINER_INSTANCE_NAME) {
165120
Write-Host ""
166121
Write-Host "Container Instance: " -NoNewline
@@ -169,48 +124,6 @@ hooks:
169124
Write-Host "$env:CONTAINER_INSTANCE_PRIVATE_IP" -ForegroundColor Cyan
170125
}
171126
172-
Write-Host ""
173-
Write-Host "Container Registry: " -NoNewline
174-
Write-Host "$env:ACR_NAME" -ForegroundColor Cyan
175-
176-
# ============================================================
177-
# Frontend Build/Deploy - COMMENTED OUT (using pre-built ACR image)
178-
# ============================================================
179-
# # Build and deploy frontend to App Service
180-
# Write-Host ""
181-
# Write-Host "===== Building Frontend =====" -ForegroundColor Yellow
182-
# Push-Location ./src/frontend
183-
# npm install
184-
# npm run build
185-
#
186-
# if ($LASTEXITCODE -eq 0) {
187-
# Write-Host "Frontend build completed!" -ForegroundColor Green
188-
#
189-
# # Copy build to frontend-server
190-
# Copy-Item -Path ../static/* -Destination ../frontend-server/static/ -Recurse -Force -ErrorAction SilentlyContinue
191-
#
192-
# Push-Location ../frontend-server
193-
#
194-
# # Create deployment package
195-
# Write-Host "Creating deployment package..."
196-
# Remove-Item -Path frontend-deploy.zip -Force -ErrorAction SilentlyContinue
197-
# Compress-Archive -Path static, server.js, package.json, package-lock.json -DestinationPath frontend-deploy.zip -Force
198-
#
199-
# Write-Host ""
200-
# Write-Host "===== Deploying Frontend to App Service =====" -ForegroundColor Yellow
201-
# az webapp deploy --resource-group $env:RESOURCE_GROUP_NAME --name $env:APP_SERVICE_NAME --src-path frontend-deploy.zip --type zip
202-
#
203-
# if ($LASTEXITCODE -eq 0) {
204-
# Write-Host "Frontend deployed successfully!" -ForegroundColor Green
205-
# } else {
206-
# Write-Host "Frontend deployment failed" -ForegroundColor Red
207-
# }
208-
#
209-
# Pop-Location
210-
# } else {
211-
# Write-Host "Frontend build failed" -ForegroundColor Red
212-
# }
213-
# Pop-Location
214127
215128
# Run post-deploy script to upload sample data and create search index
216129
Write-Host ""
@@ -272,43 +185,6 @@ hooks:
272185
--principal-id "$signed_user_id" \
273186
--scope "/" 2>/dev/null && echo " Cosmos DB role assigned successfully" || echo " Cosmos DB role may already be assigned"
274187
275-
# ============================================================
276-
# ACR Image Build - COMMENTED OUT
277-
# Images should be pre-built and pushed to ACR before deployment:
278-
# Frontend (App Service): content-gen-webapp:latest
279-
# Backend (ACI): content-gen-api:latest
280-
#
281-
# To build and push manually:
282-
# az acr build --registry $ACR_NAME --image content-gen-webapp:latest --file ./src/Frontend.Dockerfile ./src
283-
# az acr build --registry $ACR_NAME --image content-gen-api:latest --file ./src/backend/ApiApp.Dockerfile ./src
284-
# ============================================================
285-
286-
# # Build container image and deploy ACI if ACR exists and ACI was skipped
287-
# skip_container=$(azd env get-value skipContainerDeployment 2>/dev/null || echo "")
288-
# if [ -n "$ACR_NAME" ] && [ "$skip_container" = "true" ]; then
289-
# echo ""
290-
# echo "===== Building Container Image ====="
291-
# echo "Building and pushing image to ACR: $ACR_NAME"
292-
#
293-
# if az acr build --registry "$ACR_NAME" --image content-gen-api:latest --file ./src/backend/ApiApp.Dockerfile ./src; then
294-
# echo "Container image built and pushed successfully!"
295-
#
296-
# # Enable container deployment and re-provision
297-
# echo ""
298-
# echo "===== Deploying Container Instance ====="
299-
# azd env set skipContainerDeployment false
300-
#
301-
# echo "Re-running provision to deploy ACI..."
302-
# if azd provision --no-prompt; then
303-
# echo "Container Instance deployed successfully!"
304-
# else
305-
# echo "Container Instance deployment failed"
306-
# fi
307-
# else
308-
# echo "Failed to build container image"
309-
# fi
310-
# fi
311-
312188
if [ -n "$CONTAINER_INSTANCE_NAME" ]; then
313189
echo ""
314190
echo "Container Instance: $CONTAINER_INSTANCE_NAME"
@@ -318,44 +194,6 @@ hooks:
318194
echo ""
319195
echo "Container Registry: $ACR_NAME"
320196
321-
# ============================================================
322-
# Frontend Build/Deploy - COMMENTED OUT (using pre-built ACR image)
323-
# ============================================================
324-
# # Build and deploy frontend to App Service
325-
# echo ""
326-
# echo "===== Building Frontend ====="
327-
# cd ./src/frontend
328-
# if npm install && npm run build; then
329-
# echo "Frontend build completed!"
330-
#
331-
# # Copy build to frontend-server
332-
# cp -r ../static/* ../frontend-server/static/ 2>/dev/null || true
333-
#
334-
# cd ../frontend-server
335-
#
336-
# # Create deployment package
337-
# echo "Creating deployment package..."
338-
# rm -f frontend-deploy.zip
339-
# zip -r frontend-deploy.zip static/ server.js package.json package-lock.json
340-
#
341-
# echo ""
342-
# echo "===== Deploying Frontend to App Service ====="
343-
# if az webapp deploy \
344-
# --resource-group "$RESOURCE_GROUP_NAME" \
345-
# --name "$APP_SERVICE_NAME" \
346-
# --src-path frontend-deploy.zip \
347-
# --type zip; then
348-
# echo "Frontend deployed successfully!"
349-
# else
350-
# echo "Frontend deployment failed"
351-
# fi
352-
#
353-
# cd ../..
354-
# else
355-
# echo "Frontend build failed"
356-
# cd ../..
357-
# fi
358-
359197
# Run post-deploy script to upload sample data and create search index
360198
echo ""
361199
echo "===== Running Post-Deploy Script ====="

content-gen/infra/main.bicep

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -678,33 +678,6 @@ module storageAccount 'br/public:avm/res/storage/storage-account:0.30.0' = {
678678
}
679679
}
680680

681-
// ========== Azure Container Registry ========== //
682-
// COMMENTED OUT: ACR is NOT deployed - images are pre-built and pushed to an existing ACR before deployment
683-
// The acrName parameter should be set to point to your existing ACR
684-
// Required images:
685-
// - content-gen-webapp:latest (Frontend - App Service)
686-
// - content-gen-api:latest (Backend - ACI, for private networking mode)
687-
//
688-
// module containerRegistry 'br/public:avm/res/container-registry/registry:0.9.3' = {
689-
// name: take('avm.res.container-registry.registry.${acrResourceName}', 64)
690-
// params: {
691-
// name: acrResourceName
692-
// location: solutionLocation
693-
// tags: tags
694-
// enableTelemetry: enableTelemetry
695-
// acrSku: 'Basic'
696-
// acrAdminUserEnabled: false
697-
// publicNetworkAccess: 'Enabled'
698-
// roleAssignments: [
699-
// {
700-
// roleDefinitionIdOrName: '7f951dda-4ed3-4680-a7ca-43fe172d538d' // AcrPull
701-
// principalId: userAssignedIdentity.outputs.principalId
702-
// principalType: 'ServicePrincipal'
703-
// }
704-
// ]
705-
// }
706-
// }
707-
708681
// ========== Cosmos DB ========== //
709682
var cosmosDBResourceName = 'cosmos-${solutionSuffix}'
710683
var cosmosDBDatabaseName = 'content_generation_db'

content-gen/infra/modules/container-instance.bicep

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// ========== container-instance.bicep ========== //
22
// Azure Container Instance module for backend API deployment
3-
// Supports both private (VNet) and public IP modes
43

54
@description('Required. Name of the container group.')
65
param name string
@@ -38,10 +37,6 @@ param registryServer string
3837
@description('Optional. User-assigned managed identity resource ID for ACR pull.')
3938
param userAssignedIdentityResourceId string = ''
4039

41-
// ============== //
42-
// Variables //
43-
// ============== //
44-
4540
var isPrivateNetworking = !empty(subnetResourceId)
4641

4742
// ============== //

content-gen/scripts/post_deploy.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ async def upload_images(config: ResourceConfig, dry_run: bool = False) -> int:
228228
print(f" - {img.name}")
229229
return len(image_files)
230230

231-
# Upload images one at a time to avoid App Service gateway timeout (230s)
231+
# Upload images one at a time
232232
uploaded_count = 0
233233

234234
async with httpx.AsyncClient(timeout=120.0) as client: # 2 minute timeout per image
@@ -243,7 +243,6 @@ async def upload_images(config: ResourceConfig, dry_run: bool = False) -> int:
243243
"content_type": content_type,
244244
"data": base64.b64encode(image_bytes).decode("utf-8")
245245
}
246-
print_step(f"Uploading: {image_path.name} ({len(image_bytes):,} bytes)...")
247246

248247
try:
249248
response = await client.post(
@@ -257,7 +256,6 @@ async def upload_images(config: ResourceConfig, dry_run: bool = False) -> int:
257256
return uploaded_count
258257

259258
if response.status_code == 200:
260-
print_success(f"{image_path.name}")
261259
uploaded_count += 1
262260
else:
263261
print_error(f"{image_path.name}: API returned {response.status_code}")

content-gen/scripts/requirements-post-deploy.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Installs the core application dependencies first, then adds post-deploy-only deps.
44

5-
-r ../src/requirements.txt
5+
-r ../src/backend/requirements.txt
66

77
# Post-deploy script deps
88
azure-search-documents>=11.6.0

0 commit comments

Comments
 (0)