-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathazure.yaml
More file actions
93 lines (85 loc) · 2.97 KB
/
Copy pathazure.yaml
File metadata and controls
93 lines (85 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json
#
# News Aggregator — azd project manifest
# Infra: infra/main.bicep (PostgreSQL, Key Vault, ACR, newsagg-web / newsagg-func / newsagg-ui)
# CI: GitHub workflows also deploy apps; azd up uses the ordered workflow below.
name: newsagg
metadata:
template: newsagg@1.0.0
requiredVersions:
azd: ">= 1.14.0"
infra:
path: infra
# Default azd up: provision, then deploy backend → scraper → frontend (UI waits for API health).
workflows:
up:
steps:
- azd: provision
- azd: deploy backend
- azd: deploy scraper
- azd: deploy frontend
services:
# ASP.NET Core 10 Web API → App Service newsagg-web
# Includes scraper/ scripts in publish output for optional in-process scrape.
backend:
project: backend/NewsAggregator.Api
host: appservice
language: dotnet
# Python 3.13 Azure Functions v2 → newsagg-func
# Timer calls SCRAPER_REFRESH_URL on the backend (set in Bicep).
scraper:
project: functionapp
host: function
language: python
remoteBuild: false
# React (Vite) + nginx container → App Service newsagg-ui
# Proxies /api to backend; image built via ACR remote build.
frontend:
project: .
host: appservice
language: docker
docker:
path: ./frontend/Dockerfile
context: .
remoteBuild: true
registry: ${AZURE_CONTAINER_REGISTRY_ENDPOINT}
image: newsagg-frontend
hooks:
predeploy:
posix:
shell: sh
interactive: false
continueOnError: false
run: |
set -e
backend="${SERVICE_BACKEND_ENDPOINT_URL:-https://newsagg-web.azurewebsites.net}"
echo "Waiting for backend at ${backend}/api/health"
for attempt in $(seq 1 36); do
if curl -fsS "${backend}/api/health" >/dev/null 2>&1; then
echo "Backend is healthy."
exit 0
fi
echo "Attempt ${attempt}/36: not ready, sleeping 10s..."
sleep 10
done
echo "Backend did not become healthy in time."
exit 1
windows:
shell: pwsh
interactive: false
continueOnError: false
run: |
$ErrorActionPreference = 'Stop'
$backend = if ($env:SERVICE_BACKEND_ENDPOINT_URL) { $env:SERVICE_BACKEND_ENDPOINT_URL } else { 'https://newsagg-web.azurewebsites.net' }
Write-Host "Waiting for backend at $backend/api/health"
1..36 | ForEach-Object {
try {
Invoke-WebRequest -Uri "$backend/api/health" -UseBasicParsing | Out-Null
Write-Host 'Backend is healthy.'
exit 0
} catch {
Write-Host "Attempt $_/36: not ready, sleeping 10s..."
Start-Sleep -Seconds 10
}
}
throw 'Backend did not become healthy in time.'