-
Notifications
You must be signed in to change notification settings - Fork 184
Expand file tree
/
Copy pathdeploy_container_app_api_web.bicep
More file actions
167 lines (154 loc) · 4.99 KB
/
deploy_container_app_api_web.bicep
File metadata and controls
167 lines (154 loc) · 4.99 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
param solutionName string
param location string
param containerAppEnvId string
param appConfigEndPoint string = ''
param containerAppApiEndpoint string = ''
param containerAppWebEndpoint string = ''
@description('Minimum number of replicas to be added for Container App')
param minReplicaContainerApp int = 1
@description('Maximum number of replicas to be added for Container App')
param maxReplicaContainerApp int = 1
@description('Minimum number of replicas to be added for Container Api')
param minReplicaContainerApi int = 1
@description('Maximum number of replicas to be added for Container Api')
param maxReplicaContainerApi int = 1
@description('Minimum number of replicas to be added for Container Web App')
param minReplicaContainerWeb int = 1
@description('Maximum number of replicas to be added for Container Web App')
param maxReplicaContainerWeb int = 1
// Container related params
param azureContainerRegistry string
param containerRegistryReaderId string
param useLocalBuild string = 'false'
var abbrs = loadJsonContent('../abbreviations.json')
var probes = [
// Liveness Probe - Checks if the app is still running
{
type: 'Liveness'
httpGet: {
path: '/startup' // Your app must expose this endpoint
port: 80
scheme: 'HTTP'
}
initialDelaySeconds: 5
periodSeconds: 10
failureThreshold: 3
}
// Readiness Probe - Checks if the app is ready to receive traffic
{
type: 'Readiness'
httpGet: {
path: '/startup'
port: 80
scheme: 'HTTP'
}
initialDelaySeconds: 5
periodSeconds: 10
failureThreshold: 3
}
{
type: 'Startup'
httpGet: {
path: '/startup'
port: 80
scheme: 'HTTP'
}
initialDelaySeconds: 20 // Wait 10s before checking
periodSeconds: 5 // Check every 15s
failureThreshold: 30 // Restart if it fails 5 times
}
]
module containerApp 'deploy_container_app.bicep' = {
name: 'deploy_container_app'
params: {
location: location
containerAppName: '${abbrs.containers.containerApp}${solutionName}-app'
containerEnvId: containerAppEnvId
azureContainerRegistry: azureContainerRegistry
azureContainerRegistryImage: 'contentprocessor'
azureContainerRegistryImageTag: 'latest'
managedIdentityId: containerRegistryReaderId
containerEnvVars: [
{
name: 'APP_CONFIG_ENDPOINT'
value: appConfigEndPoint
}
]
enableIngress: false
minReplicas: minReplicaContainerApp
maxReplicas: maxReplicaContainerApp
useLocalBuild: useLocalBuild
}
}
module containerAppApi 'deploy_container_app.bicep' = {
name: 'deploy_container_app_api'
params: {
location: location
containerAppName: '${abbrs.containers.containerApp}${solutionName}-api'
containerEnvId: containerAppEnvId
azureContainerRegistry: azureContainerRegistry
azureContainerRegistryImage: 'contentprocessorapi'
azureContainerRegistryImageTag: 'latest'
managedIdentityId: containerRegistryReaderId
allowedOrigins: [containerAppWebEndpoint]
containerEnvVars: [
{
name: 'APP_CONFIG_ENDPOINT'
value: appConfigEndPoint
}
]
probes: probes
minReplicas: minReplicaContainerApi
maxReplicas: maxReplicaContainerApi
useLocalBuild: useLocalBuild
}
}
module containerAppWeb 'deploy_container_app.bicep' = {
name: 'deploy_container_app_web'
params: {
location: location
containerAppName: '${abbrs.containers.containerApp}${solutionName}-web'
containerEnvId: containerAppEnvId
azureContainerRegistry: azureContainerRegistry
azureContainerRegistryImage: 'contentprocessorweb'
azureContainerRegistryImageTag: 'latest'
managedIdentityId: containerRegistryReaderId
containerEnvVars: [
{
name: 'APP_API_BASE_URL'
value: containerAppApiEndpoint
}
{
name: 'APP_MSAL_AUTH_CLIENT_ID'
value: '<APP_REGISTRATION_CLIENTID>'
}
{
name: 'APP_MSAL_AUTH_AUTHORITY'
value: '${environment().authentication.loginEndpoint}/${tenant().tenantId}'
}
{
name: 'APP_MSAL_AUTH_SCOPE'
value: '<FRONTEND_API_SCOPE>'
}
{
name: 'APP_MSAL_TOKEN_SCOPE'
value: '<BACKEND_API_SCOPE>'
}
{
name: 'APP_ISLOGS_ENABLED'
value: 'false'
}
]
minReplicas: minReplicaContainerWeb
maxReplicas: maxReplicaContainerWeb
useLocalBuild: useLocalBuild
}
}
output containerAppPrincipalId string = containerApp.outputs.principalId
output containerAppApiPrincipalId string = containerAppApi.outputs.principalId
output containerAppWebPrincipalId string = containerAppWeb.outputs.principalId
output containerAppName string = containerApp.outputs.containerName
output containerAppApiName string = containerAppApi.outputs.containerName
output containerAppWebName string = containerAppWeb.outputs.containerName
output containweAppWebEndPoint string = containerAppWeb.outputs.containerEndPoint
output containweAppApiEndPoint string = containerAppApi.outputs.containerEndPoint