Skip to content

Commit 6c70030

Browse files
author
Taiseer Joudeh
committed
Parameterize ports and sendgrid integration setting
1 parent fdf51e1 commit 6c70030

File tree

7 files changed

+69
-11
lines changed

7 files changed

+69
-11
lines changed

bicep/main.bicep

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ param sendGridEmailFrom string
7979
@description('The name of the Send Grid Email From Name.')
8080
param sendGridEmailFromName string
8181

82+
// When set to 'true', Parameters 'sendGridKeySecretValue' and 'sendGridEmailFrom' should be provided
83+
@description('Set if integration with SendGrid is enabled.')
84+
param sendGridIntegrationEnabled string
85+
8286
//Cron Shedule Jon
8387
@description('The cron settings for scheduled job.')
8488
param scheduledJobCron string
@@ -109,6 +113,16 @@ param backendApiServiceImage string
109113
@description('The image for the frontend web app service.')
110114
param frontendWebAppServiceImage string
111115

116+
// App Ports
117+
@description('The target and dapr port for the frontend web app service.')
118+
param frontendWebAppPortNumber int = 80
119+
120+
@description('The target and dapr port for the backend api service.')
121+
param backendApiPortNumber int = 80
122+
123+
@description('The dapr port for the backend processor service.')
124+
param backendProcessorPortNumber int = 80
125+
112126
// ------------------
113127
// RESOURCES
114128
// ------------------
@@ -214,9 +228,13 @@ module containerApps 'modules/container-apps.bicep' = {
214228
frontendWebAppServiceImage: frontendWebAppServiceImage
215229
sendGridKeySecretName: sendGridKeySecretName
216230
sendGridKeySecretValue: sendGridKeySecretValue
231+
sendGridIntegrationEnabled: sendGridIntegrationEnabled
217232
applicationInsightsName: containerAppsEnvironment.outputs.applicationInsightsName
218233
externalStorageAccountName: externalStorageAccount.outputs.storageAccountName
219234
externalStorageKeySecretName: externalStorageKeySecretName
235+
frontendWebAppPortNumber: frontendWebAppPortNumber
236+
backendApiPortNumber: backendApiPortNumber
237+
backendProcessorPortNumber: backendProcessorPortNumber
220238
}
221239
dependsOn: [
222240
daprComponents

bicep/main.parameters.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
"sendGridEmailFromName": {
4545
"value": "Tasks Tracker Notification"
4646
},
47+
"sendGridIntegrationEnabled": {
48+
"value": "false"
49+
},
4750
"externalTasksQueueName": {
4851
"value": "external-tasks-queue"
4952
},
@@ -70,6 +73,15 @@
7073
},
7174
"frontendWebAppServiceImage": {
7275
"value": "<CONTAINER_REGISTRY_NAME>.azurecr.io/tasksmanager/tasksmanager-frontend-webapp:latest"
76+
},
77+
"frontendWebAppPortNumber": {
78+
"value": 80
79+
},
80+
"backendApiPortNumber": {
81+
"value": 80
82+
},
83+
"backendProcessorPortNumber": {
84+
"value": 80
7385
}
7486
}
7587
}

bicep/modules/container-apps-environment.bicep

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ param logAnalyticsWorkspaceName string
1818
@description(' The name of the application insights. If set, it overrides the name generated by the template.')
1919
param applicationInsightName string
2020

21-
// ------------------
22-
// VARIABLES
23-
// ------------------
24-
2521

2622
// ------------------
2723
// RESOURCES

bicep/modules/container-apps.bicep

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ param sendGridKeySecretName string
5454
@description('The SendGrid API key for for Backend Background Processor Service.')
5555
param sendGridKeySecretValue string
5656

57+
@description('Set if integration with SendGrid is enabled.')
58+
param sendGridIntegrationEnabled string
59+
5760
@description('The name of the secret containing the External Azure Storage Access key for the Backend Background Processor Service.')
5861
param externalStorageKeySecretName string
5962

@@ -77,8 +80,21 @@ param frontendWebAppServiceImage string
7780
@description('The name of the application insights.')
7881
param applicationInsightsName string
7982

80-
var containerRegistryPullRoleGuid='7f951dda-4ed3-4680-a7ca-43fe172d538d'
83+
// App Ports
84+
@description('The target and dapr port for the frontend web app service.')
85+
param frontendWebAppPortNumber int
86+
87+
@description('The target and dapr port for the backend api service.')
88+
param backendApiPortNumber int
89+
90+
@description('The dapr port for the backend processor service.')
91+
param backendProcessorPortNumber int
8192

93+
// ------------------
94+
// VARIABLES
95+
// ------------------
96+
97+
var containerRegistryPullRoleGuid='7f951dda-4ed3-4680-a7ca-43fe172d538d'
8298

8399
// ------------------
84100
// RESOURCES
@@ -124,6 +140,7 @@ module frontendWebAppService 'container-apps/webapp-frontend-service.bicep' = {
124140
containerRegistryUserAssignedIdentityId: containerRegistryUserAssignedIdentity.id
125141
frontendWebAppServiceImage: frontendWebAppServiceImage
126142
appInsightsInstrumentationKey: applicationInsights.properties.InstrumentationKey
143+
frontendWebAppPortNumber: frontendWebAppPortNumber
127144

128145
}
129146
}
@@ -144,6 +161,7 @@ module backendApiService 'container-apps/webapi-backend-service.bicep' = {
144161
cosmosDbDatabaseName: cosmosDbDatabaseName
145162
cosmosDbCollectionName: cosmosDbCollectionName
146163
appInsightsInstrumentationKey: applicationInsights.properties.InstrumentationKey
164+
backendApiPortNumber: backendApiPortNumber
147165
}
148166
}
149167

@@ -162,10 +180,12 @@ module backendProcessorService 'container-apps/processor-backend-service.bicep'
162180
containerRegistryUserAssignedIdentityId: containerRegistryUserAssignedIdentity.id
163181
sendGridKeySecretName: sendGridKeySecretName
164182
sendGridKeySecretValue: sendGridKeySecretValue
183+
sendGridIntegrationEnabled:sendGridIntegrationEnabled
165184
externalStorageAccountName: externalStorageAccountName
166185
externalStorageKeySecretName:externalStorageKeySecretName
167186
backendProcessorServiceImage: backendProcessorServiceImage
168187
appInsightsInstrumentationKey: applicationInsights.properties.InstrumentationKey
188+
backendProcessorPortNumber: backendProcessorPortNumber
169189
}
170190
}
171191

bicep/modules/container-apps/processor-backend-service.bicep

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ param externalStorageKeySecretName string
3636
@description('The Application Insights Instrumentation.')
3737
param appInsightsInstrumentationKey string
3838

39+
@description('Set if integration with SendGrid is enabled.')
40+
param sendGridIntegrationEnabled string
41+
3942
// Service Bus
4043
@description('The name of the service bus namespace.')
4144
param serviceBusName string
@@ -60,6 +63,9 @@ param containerRegistryUserAssignedIdentityId string
6063
@description('The image for the backend processor service.')
6164
param backendProcessorServiceImage string
6265

66+
@description('The dapr port for the backend processor service.')
67+
param backendProcessorPortNumber int
68+
6369

6470
// ------------------
6571
// VARIABLES
@@ -111,7 +117,7 @@ resource backendProcessorService 'Microsoft.App/containerApps@2022-06-01-preview
111117
enabled: true
112118
appId: backendProcessorServiceName
113119
appProtocol: 'http'
114-
appPort: 80
120+
appPort: backendProcessorPortNumber
115121
logLevel: 'info'
116122
enableApiLogging: true
117123
}
@@ -144,7 +150,7 @@ resource backendProcessorService 'Microsoft.App/containerApps@2022-06-01-preview
144150
env: [
145151
{
146152
name: 'SendGrid__IntegrationEnabled'
147-
value: 'true'
153+
value: sendGridIntegrationEnabled
148154
}
149155
{
150156
name: 'ApplicationInsights__InstrumentationKey'

bicep/modules/container-apps/webapi-backend-service.bicep

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ param backendApiServiceImage string
4747
@description('The Application Insights Instrumentation.')
4848
param appInsightsInstrumentationKey string
4949

50+
@description('The target and dapr port for the backend api service.')
51+
param backendApiPortNumber int
52+
5053
// ------------------
5154
// RESOURCES
5255
// ------------------
@@ -90,13 +93,13 @@ resource backendApiService 'Microsoft.App/containerApps@2022-06-01-preview' = {
9093
activeRevisionsMode: 'single'
9194
ingress: {
9295
external: false
93-
targetPort: 80
96+
targetPort: backendApiPortNumber
9497
}
9598
dapr: {
9699
enabled: true
97100
appId: backendApiServiceName
98101
appProtocol: 'http'
99-
appPort: 80
102+
appPort: backendApiPortNumber
100103
logLevel: 'info'
101104
enableApiLogging: true
102105
}

bicep/modules/container-apps/webapp-frontend-service.bicep

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ param frontendWebAppServiceImage string
3030
@description('The Application Insights Instrumentation.')
3131
param appInsightsInstrumentationKey string
3232

33+
@description('The target and dapr port for the frontend web app service.')
34+
param frontendWebAppPortNumber int
35+
3336
// ------------------
3437
// RESOURCES
3538
// ------------------
@@ -50,13 +53,13 @@ resource frontendWebAppService 'Microsoft.App/containerApps@2022-06-01-preview'
5053
activeRevisionsMode: 'single'
5154
ingress: {
5255
external: true
53-
targetPort: 80
56+
targetPort: frontendWebAppPortNumber
5457
}
5558
dapr: {
5659
enabled: true
5760
appId: frontendWebAppServiceName
5861
appProtocol: 'http'
59-
appPort: 80
62+
appPort: frontendWebAppPortNumber
6063
logLevel: 'info'
6164
enableApiLogging: true
6265
}

0 commit comments

Comments
 (0)