Skip to content

Commit

Permalink
Merge pull request #18 from pamelafox/infra-update
Browse files Browse the repository at this point in the history
infra update
  • Loading branch information
pamelafox authored Apr 5, 2024
2 parents e7e7e71 + fd8cbb9 commit ad82afd
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 286 deletions.
17 changes: 17 additions & 0 deletions infra/core/host/appservice-appsettings.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
metadata description = 'Updates app settings for an Azure App Service.'
@description('The name of the app service resource within the current resource group scope')
param name string

@description('The app settings to be applied to the app service')
@secure()
param appSettings object

resource appService 'Microsoft.Web/sites@2022-03-01' existing = {
name: name
}

resource settings 'Microsoft.Web/sites/config@2022-03-01' = {
name: 'appsettings'
parent: appService
properties: appSettings
}
53 changes: 39 additions & 14 deletions infra/core/host/appservice.bicep
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
metadata description = 'Creates an Azure App Service in an existing Azure App Service plan.'
param name string
param location string = resourceGroup().location
param tags object = {}
Expand All @@ -23,6 +24,7 @@ param kind string = 'app,linux'
param allowedOrigins array = []
param alwaysOn bool = true
param appCommandLine string = ''
@secure()
param appSettings object = {}
param clientAffinityEnabled bool = false
param enableOryxBuild bool = contains(kind, 'linux')
Expand All @@ -33,6 +35,7 @@ param numberOfWorkers int = -1
param scmDoBuildDuringDeployment bool = false
param use32BitWorkerProcess bool = false
param ftpsState string = 'FtpsOnly'
param healthCheckPath string = ''

resource appService 'Microsoft.Web/sites@2022-03-01' = {
name: name
Expand All @@ -45,11 +48,13 @@ resource appService 'Microsoft.Web/sites@2022-03-01' = {
linuxFxVersion: linuxFxVersion
alwaysOn: alwaysOn
ftpsState: ftpsState
minTlsVersion: '1.2'
appCommandLine: appCommandLine
numberOfWorkers: numberOfWorkers != -1 ? numberOfWorkers : null
minimumElasticInstanceCount: minimumElasticInstanceCount != -1 ? minimumElasticInstanceCount : null
use32BitWorkerProcess: use32BitWorkerProcess
functionAppScaleLimit: functionAppScaleLimit != -1 ? functionAppScaleLimit : null
healthCheckPath: healthCheckPath
cors: {
allowedOrigins: union([ 'https://portal.azure.com', 'https://ms.portal.azure.com' ], allowedOrigins)
}
Expand All @@ -60,29 +65,49 @@ resource appService 'Microsoft.Web/sites@2022-03-01' = {

identity: { type: managedIdentity ? 'SystemAssigned' : 'None' }

resource configAppSettings 'config' = {
name: 'appsettings'
properties: union(appSettings,
resource basicPublishingCredentialsPoliciesFtp 'basicPublishingCredentialsPolicies' = {
name: 'ftp'
properties: {
allow: false
}
}

resource basicPublishingCredentialsPoliciesScm 'basicPublishingCredentialsPolicies' = {
name: 'scm'
properties: {
allow: false
}
}
}

// Updates to the single Microsoft.sites/web/config resources that need to be performed sequentially
// sites/web/config 'appsettings'
module configAppSettings 'appservice-appsettings.bicep' = {
name: '${name}-appSettings'
params: {
name: appService.name
appSettings: union(appSettings,
{
SCM_DO_BUILD_DURING_DEPLOYMENT: string(scmDoBuildDuringDeployment)
ENABLE_ORYX_BUILD: string(enableOryxBuild)
},
runtimeName == 'python' && appCommandLine == '' ? { PYTHON_ENABLE_GUNICORN_MULTIWORKERS: 'true'} : {},
!empty(applicationInsightsName) ? { APPLICATIONINSIGHTS_CONNECTION_STRING: applicationInsights.properties.ConnectionString } : {},
!empty(keyVaultName) ? { AZURE_KEY_VAULT_ENDPOINT: keyVault.properties.vaultUri } : {})
}
}

resource configLogs 'config' = {
name: 'logs'
properties: {
applicationLogs: { fileSystem: { level: 'Verbose' } }
detailedErrorMessages: { enabled: true }
failedRequestsTracing: { enabled: true }
httpLogs: { fileSystem: { enabled: true, retentionInDays: 1, retentionInMb: 35 } }
}
dependsOn: [
configAppSettings
]
// sites/web/config 'logs'
resource configLogs 'Microsoft.Web/sites/config@2022-03-01' = {
name: 'logs'
parent: appService
properties: {
applicationLogs: { fileSystem: { level: 'Verbose' } }
detailedErrorMessages: { enabled: true }
failedRequestsTracing: { enabled: true }
httpLogs: { fileSystem: { enabled: true, retentionInDays: 1, retentionInMb: 35 } }
}
dependsOn: [configAppSettings]
}

resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' existing = if (!(empty(keyVaultName))) {
Expand Down
2 changes: 2 additions & 0 deletions infra/core/host/appserviceplan.bicep
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
metadata description = 'Creates an Azure App Service plan.'
param name string
param location string = resourceGroup().location
param tags object = {}
Expand All @@ -18,3 +19,4 @@ resource appServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = {
}

output id string = appServicePlan.id
output name string = appServicePlan.name
77 changes: 0 additions & 77 deletions infra/core/host/container-app.bicep

This file was deleted.

26 changes: 0 additions & 26 deletions infra/core/host/container-apps-environment.bicep

This file was deleted.

30 changes: 0 additions & 30 deletions infra/core/host/container-apps.bicep

This file was deleted.

36 changes: 0 additions & 36 deletions infra/core/host/container-registry.bicep

This file was deleted.

82 changes: 0 additions & 82 deletions infra/core/host/functions.bicep

This file was deleted.

Loading

0 comments on commit ad82afd

Please sign in to comment.