Skip to content

Commit

Permalink
EES-XXXX - trialling different configuration options
Browse files Browse the repository at this point in the history
  • Loading branch information
duncan-at-hiveit committed Dec 20, 2024
1 parent ddf7596 commit 3502f03
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ module apiContainerAppModule '../../components/containerApp.bicep' = {
memorySizeGis: resourceAndScalingConfig.memoryGis
minReplicas: resourceAndScalingConfig.minReplicas
maxReplicas: resourceAndScalingConfig.maxReplicas
scaleAtConcurrentHttpRequests: resourceAndScalingConfig.scaleAtConcurrentHttpRequests
workloadProfileName: resourceAndScalingConfig.workloadProfileName
tagValues: tagValues
}
}
Expand Down
5 changes: 5 additions & 0 deletions infrastructure/templates/public-api/ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ parameters:
- name: deployDataProcessor
displayName: Does the Data Processor need creating or updating?
default: true
- name: deployDocsSite
displayName: Does the Public API static docs site need creating or updating?
default: true
- name: deployAlerts
displayName: Whether to create or update Azure Monitor alerts during this deploy.
default: false
Expand Down Expand Up @@ -58,6 +61,8 @@ variables:
value: ${{ parameters.deployContainerApp }}
- name: deployDataProcessor
value: ${{ parameters.deployDataProcessor }}
- name: deployDocsSite
value: ${{ parameters.deployDocsSite }}
- name: deployAlerts
value: ${{ parameters.deployAlerts }}
- name: awaitActiveOrchestrations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ parameters:
jobs:
- deployment: DeployPublicApiDocs
displayName: Deploy Public API docs
condition: and(succeeded(), eq(variables.deployDocsSite, true))
dependsOn: ${{ parameters.dependsOn }}
environment: ${{ parameters.environment }}
strategy:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
deployPsqlFlexibleServer: false
deployContainerApp: false
deployDataProcessor: false
deployDocsSite: false
deployAlerts: false
dataProcessorExists: false

Expand Down Expand Up @@ -68,6 +69,7 @@ jobs:
deployPsqlFlexibleServer: $(deployPsqlFlexibleServer)
deployContainerApp: $(deployContainerApp)
deployDataProcessor: $(deployDataProcessor)
deployDocsSite: $(deployDocsSite)
deployAlerts: $(deployAlerts)
dataProcessorExists: $(dataProcessorExists)

Expand Down
3 changes: 3 additions & 0 deletions infrastructure/templates/public-api/ci/tasks/deploy-bicep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ parameters:
default: true
- name: deployDataProcessor
type: string
- name: deployDocsSite
type: string
- name: deployAlerts
type: string
- name: dataProcessorExists
Expand Down Expand Up @@ -55,6 +57,7 @@ steps:
deployPsqlFlexibleServer=${{ parameters.deployPsqlFlexibleServer }} \
deployContainerApp=${{ parameters.deployContainerApp }} \
deployDataProcessor=${{ parameters.deployDataProcessor }} \
deployDocsSite=${{ parameters.deployDocsSite }} \
deployAlerts=${{ parameters.deployAlerts }} \
dataProcessorFunctionAppExists=${{ parameters.dataProcessorExists }} \
dataProcessorAppRegistrationClientId='$(dataProcessorAppRegistrationClientId)' \
Expand Down
35 changes: 13 additions & 22 deletions infrastructure/templates/public-api/components/containerApp.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -29,37 +29,28 @@ param corsPolicy {
param workloadProfileName string = 'Consumption'

@description('Number of CPU cores the container can use. Can be with a maximum of two decimals.')
@allowed([
1
2
3
4
])
@minValue(1)
@maxValue(8)
param cpuCores int = 4

@description('Amount of memory (in gibibytes, GiB) allocated to the container up to 4GiB. Can be with a maximum of two decimals. Ratio with CPU cores must be equal to 2.')
@allowed([
1
2
3
4
5
6
7
8
])
@description('Amount of memory (in gibibytes, GiB) allocated to the container up to 32GiB. Can be with a maximum of two decimals. Ratio with CPU cores must be equal to 2.')
@minValue(1)
@maxValue(32)
param memorySizeGis int = 8

@description('Minimum number of replicas that will be deployed')
@minValue(0)
@maxValue(25)
param minReplicas int = 1

@description('Maximum number of replicas that will be deployed')
@minValue(0)
@maxValue(25)
@maxValue(1000)
param maxReplicas int = 3

@description('Number of concurrent requests required in order to trigger scaling out.')
@minValue(1)
param scaleAtConcurrentHttpRequests int?

@description('Specifies the database connection string')
param appSettings {
name: string
Expand Down Expand Up @@ -172,16 +163,16 @@ resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
scale: {
minReplicas: minReplicas
maxReplicas: maxReplicas
rules: [
rules: union(scaleAtConcurrentHttpRequests != null ? [
{
name: 'http-requests'
http: {
metadata: {
concurrentRequests: '10'
concurrentRequests: string(scaleAtConcurrentHttpRequests)
}
}
}
]
] : [], [])
}
volumes: volumes
}
Expand Down
8 changes: 6 additions & 2 deletions infrastructure/templates/public-api/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ param deployContainerApp bool = true
@description('Does the Data Processor need creating or updating?')
param deployDataProcessor bool = true

@description('Does the Public API static docs site need creating or updating?')
param deployDocsSite bool = true

param deployAlerts bool = false

@description('Public URLs of other components in the service.')
Expand Down Expand Up @@ -116,6 +119,7 @@ param publicApiContainerAppConfig ContainerAppResourceConfig = {
memoryGis: 8
minReplicas: 0
maxReplicas: 3
scaleAtConcurrentHttpRequests: 10
workloadProfileName: 'Consumption'
}

Expand Down Expand Up @@ -309,7 +313,7 @@ module apiAppModule 'application/public-api/publicApiApp.bicep' = if (deployCont
}

// Deploy Public API docs.
module docsModule 'application/public-api/publicApiDocs.bicep' = {
module docsModule 'application/public-api/publicApiDocs.bicep' = if (deployDocsSite) {
name: 'publicApiDocsModuleDeploy'
params: {
appSku: docsAppSku
Expand All @@ -321,7 +325,7 @@ module docsModule 'application/public-api/publicApiDocs.bicep' = {
var docsRewriteSetName = '${publicApiResourcePrefix}-docs-rewrites'

// Create an Application Gateway to serve public traffic for the Public API Container App.
module appGatewayModule 'application/shared/appGateway.bicep' = if (deployContainerApp) {
module appGatewayModule 'application/shared/appGateway.bicep' = if (deployContainerApp && deployDocsSite) {
name: 'appGatewayModuleDeploy'
params: {
location: location
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,16 @@ param publicApiContainerAppConfig = {
cpuCores: 4
memoryGis: 8
minReplicas: 1
maxReplicas: 16
maxReplicas: 100
scaleAtConcurrentHttpRequests: 5
workloadProfileName: 'Consumption'
}

param publicApiContainerAppWorkloadProfiles = [{
name: 'D8'
workloadProfileType: 'D8'
minimumCount: 0
maximumCount: 10
}]

param enableThemeDeletion = true
5 changes: 3 additions & 2 deletions infrastructure/templates/public-api/types.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,11 @@ type StaticWebAppSku = 'Free' | 'Standard'
@export()
type ContainerAppResourceConfig = {
workloadProfileName: string
minReplicas: int
maxReplicas: int
cpuCores: int
memoryGis: int
minReplicas: int
maxReplicas: int
scaleAtConcurrentHttpRequests: int?
}

@export()
Expand Down

0 comments on commit 3502f03

Please sign in to comment.