-
Notifications
You must be signed in to change notification settings - Fork 261
Expand file tree
/
Copy pathdeploy_backend_docker.bicep
More file actions
121 lines (114 loc) · 3.11 KB
/
deploy_backend_docker.bicep
File metadata and controls
121 lines (114 loc) · 3.11 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
param imageTag string
param applicationInsightsId string
param solutionName string
@secure()
param appSettings object = {}
param appServicePlanId string
@secure()
param azureOpenAIKey string
@secure()
param azureAiProjectConnString string
@secure()
param azureSearchAdminKey string
param userassignedIdentityId string
var imageName = 'DOCKER|kmcontainerreg.azurecr.io/km-api:${imageTag}'
var name = '${solutionName}-api'
var reactAppLayoutConfig ='''{
"appConfig": {
"THREE_COLUMN": {
"DASHBOARD": 50,
"CHAT": 33,
"CHATHISTORY": 17
},
"TWO_COLUMN": {
"DASHBOARD_CHAT": {
"DASHBOARD": 65,
"CHAT": 35
},
"CHAT_CHATHISTORY": {
"CHAT": 80,
"CHATHISTORY": 20
}
}
},
"charts": [
{
"id": "SATISFIED",
"name": "Satisfied",
"type": "card",
"layout": { "row": 1, "column": 1, "height": 11 }
},
{
"id": "TOTAL_CALLS",
"name": "Total Calls",
"type": "card",
"layout": { "row": 1, "column": 2, "span": 1 }
},
{
"id": "AVG_HANDLING_TIME",
"name": "Average Handling Time",
"type": "card",
"layout": { "row": 1, "column": 3, "span": 1 }
},
{
"id": "SENTIMENT",
"name": "Topics Overview",
"type": "donutchart",
"layout": { "row": 2, "column": 1, "width": 40, "height": 44.5 }
},
{
"id": "AVG_HANDLING_TIME_BY_TOPIC",
"name": "Average Handling Time By Topic",
"type": "bar",
"layout": { "row": 2, "column": 2, "row-span": 2, "width": 60 }
},
{
"id": "TOPICS",
"name": "Trending Topics",
"type": "table",
"layout": { "row": 3, "column": 1, "span": 2 }
},
{
"id": "KEY_PHRASES",
"name": "Key Phrases",
"type": "wordcloud",
"layout": { "row": 3, "column": 2, "height": 44.5 }
}
]
}'''
module appService 'deploy_app_service.bicep' = {
name: '${name}-app-module'
params: {
solutionName: name
appServicePlanId: appServicePlanId
appImageName: imageName
userassignedIdentityId:userassignedIdentityId
appSettings: union(
appSettings,
{
AZURE_OPENAI_API_KEY: azureOpenAIKey
AZURE_AI_SEARCH_API_KEY: azureSearchAdminKey
AZURE_AI_PROJECT_CONN_STRING:azureAiProjectConnString
APPINSIGHTS_INSTRUMENTATIONKEY: reference(applicationInsightsId, '2015-05-01').InstrumentationKey
REACT_APP_LAYOUT_CONFIG: reactAppLayoutConfig
}
)
}
}
resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2022-08-15' existing = {
name: appSettings.AZURE_COSMOSDB_ACCOUNT
}
resource contributorRoleDefinition 'Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions@2024-05-15' existing = {
parent: cosmos
name: '00000000-0000-0000-0000-000000000002'
}
resource role 'Microsoft.DocumentDB/databaseAccounts/sqlRoleAssignments@2022-05-15' = {
parent: cosmos
name: guid(contributorRoleDefinition.id, cosmos.id)
properties: {
principalId: appService.outputs.identityPrincipalId
roleDefinitionId: contributorRoleDefinition.id
scope: cosmos.id
}
}
output appUrl string = appService.outputs.appUrl