Skip to content

Commit

Permalink
update web site config to avm
Browse files Browse the repository at this point in the history
  • Loading branch information
Menghua1 committed Jul 5, 2024
1 parent 00648d5 commit cef4144
Show file tree
Hide file tree
Showing 23 changed files with 179 additions and 127 deletions.
21 changes: 0 additions & 21 deletions templates/todo/common/infra/bicep/app/website-config.bicep

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ var actualDatabaseName = !empty(cosmosDatabaseName) ? cosmosDatabaseName : 'Todo
var webUri = 'https://${web.outputs.defaultHostname}'
var apiUri = 'https://${api.outputs.defaultHostname}'
var apimApiUri = 'https://${apim.outputs.name}.azure-api.net/todo'
var apimServiceId = useAPIM ? apim.outputs.resourceId : ''

// Organize resources in a resource group
resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
Expand All @@ -53,7 +54,7 @@ resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
}

// The application frontend
module web 'br/public:avm/res/web/site:0.3.4' = {
module web 'br/public:avm/res/web/site:0.3.9' = {
name: 'web'
scope: rg
params: {
Expand All @@ -68,11 +69,17 @@ module web 'br/public:avm/res/web/site:0.3.4' = {
linuxFxVersion: 'node|20-lts'
alwaysOn: true
}
logsConfiguration: {
applicationLogs: { fileSystem: { level: 'Verbose' } }
detailedErrorMessages: { enabled: true }
failedRequestsTracing: { enabled: true }
httpLogs: { fileSystem: { enabled: true, retentionInDays: 1, retentionInMb: 35 } }
}
}
}

// The application backend
module api 'br/public:avm/res/web/site:0.3.4' = {
module api 'br/public:avm/res/web/site:0.3.9' = {
name: 'api'
scope: rg
params: {
Expand Down Expand Up @@ -102,6 +109,12 @@ module api 'br/public:avm/res/web/site:0.3.4' = {
SCM_DO_BUILD_DURING_DEPLOYMENT: 'False'
ENABLE_ORYX_BUILD: 'True'
}
logsConfiguration: {
applicationLogs: { fileSystem: { level: 'Verbose' } }
detailedErrorMessages: { enabled: true }
failedRequestsTracing: { enabled: true }
httpLogs: { fileSystem: { enabled: true, retentionInDays: 1, retentionInMb: 35 } }
}
}
}

Expand Down Expand Up @@ -336,13 +349,19 @@ module apim 'br/public:avm/res/api-management/service:0.2.0' = if (useAPIM) {
}

//Configures the API settings for an api app within the Azure API Management (APIM) service.
module apiConfig '../../../../../common/infra/bicep/app/website-config.bicep' = if (useAPIM) {
module apiConfig 'br/public:avm/res/web/site:0.3.9' = if (useAPIM) {
name: 'apiconfig'
scope: rg
params: {
apimServiceId: useAPIM ? apim.outputs.resourceId : ''
apiName: apimApiName
apiAppName: api.outputs.name
kind: 'app'
name: api.outputs.name
serverFarmResourceId: appServicePlan.outputs.resourceId
location: location
apiManagementConfiguration: {
apiManagementConfig: {
id: '${apimServiceId}/apis/${apimApiName}'
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ repo:
- from: ../../../../common/infra/bicep/app/applicationinsights-dashboard.bicep
to: ./infra/app/applicationinsights-dashboard.bicep

- from: ../../../../common/infra/bicep/app/website-config.bicep
to: ./infra/app/website-config.bicep

- from: ./../../
to: ./
ignore:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ var actualDatabaseName = !empty(sqlDatabaseName) ? sqlDatabaseName : defaultData
var webUri = 'https://${web.outputs.defaultHostname}'
var apiUri = 'https://${api.outputs.defaultHostname}'
var apimApiUri = 'https://${apim.outputs.name}.azure-api.net/todo'
var apimServiceId = useAPIM ? apim.outputs.resourceId : ''

// Organize resources in a resource group
resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
Expand All @@ -77,7 +78,7 @@ module web 'br/public:avm/res/web/static-site:0.3.0' = {
}

// The application backend
module api 'br/public:avm/res/web/site:0.3.4' = {
module api 'br/public:avm/res/web/site:0.3.9' = {
name: 'api'
scope: rg
params: {
Expand Down Expand Up @@ -107,6 +108,12 @@ module api 'br/public:avm/res/web/site:0.3.4' = {
SCM_DO_BUILD_DURING_DEPLOYMENT: 'False'
ENABLE_ORYX_BUILD: 'True'
}
logsConfiguration: {
applicationLogs: { fileSystem: { level: 'Verbose' } }
detailedErrorMessages: { enabled: true }
failedRequestsTracing: { enabled: true }
httpLogs: { fileSystem: { enabled: true, retentionInDays: 1, retentionInMb: 35 } }
}
storageAccountResourceId: storage.outputs.resourceId
}
}
Expand Down Expand Up @@ -355,13 +362,19 @@ module apim 'br/public:avm/res/api-management/service:0.2.0' = if (useAPIM) {
}

//Configures the API settings for an api app within the Azure API Management (APIM) service.
module apiConfig '../../../../../common/infra/bicep/app/website-config.bicep' = if (useAPIM) {
module apiConfig 'br/public:avm/res/web/site:0.3.9' = if (useAPIM) {
name: 'apiconfig'
scope: rg
params: {
apimServiceId: useAPIM ? apim.outputs.resourceId : ''
apiName: apimApiName
apiAppName: api.outputs.name
kind: 'app'
name: api.outputs.name
serverFarmResourceId: appServicePlan.outputs.resourceId
location: location
apiManagementConfiguration: {
apiManagementConfig: {
id: '${apimServiceId}/apis/${apimApiName}'
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ repo:
- from: ../../../../common/infra/bicep/app/applicationinsights-dashboard.bicep
to: ./infra/app/applicationinsights-dashboard.bicep

- from: ../../../../common/infra/bicep/app/website-config.bicep
to: ./infra/app/website-config.bicep

- from: ../../../../common/infra/bicep/app/sql-deployment-script.bicep
to: ./infra/app/sql-deployment-script.bicep

Expand Down
31 changes: 25 additions & 6 deletions templates/todo/projects/csharp-sql/.repo/bicep/infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ var actualDatabaseName = !empty(sqlDatabaseName) ? sqlDatabaseName : defaultData
var webUri = 'https://${web.outputs.defaultHostname}'
var apiUri = 'https://${api.outputs.defaultHostname}'
var apimApiUri = 'https://${apim.outputs.name}.azure-api.net/todo'
var apimServiceId = useAPIM ? apim.outputs.resourceId : ''

// Organize resources in a resource group
resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
Expand All @@ -63,7 +64,7 @@ resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
}

// The application frontend
module web 'br/public:avm/res/web/site:0.3.2' = {
module web 'br/public:avm/res/web/site:0.3.9' = {
name: 'web'
scope: rg
params: {
Expand All @@ -78,11 +79,17 @@ module web 'br/public:avm/res/web/site:0.3.2' = {
linuxFxVersion: 'node|20-lts'
alwaysOn: true
}
logsConfiguration: {
applicationLogs: { fileSystem: { level: 'Verbose' } }
detailedErrorMessages: { enabled: true }
failedRequestsTracing: { enabled: true }
httpLogs: { fileSystem: { enabled: true, retentionInDays: 1, retentionInMb: 35 } }
}
}
}

// The application backend
module api 'br/public:avm/res/web/site:0.2.0' = {
module api 'br/public:avm/res/web/site:0.3.9' = {
name: 'api'
scope: rg
params: {
Expand All @@ -109,6 +116,12 @@ module api 'br/public:avm/res/web/site:0.2.0' = {
SCM_DO_BUILD_DURING_DEPLOYMENT: 'False'
ENABLE_ORYX_BUILD: 'True'
}
logsConfiguration: {
applicationLogs: { fileSystem: { level: 'Verbose' } }
detailedErrorMessages: { enabled: true }
failedRequestsTracing: { enabled: true }
httpLogs: { fileSystem: { enabled: true, retentionInDays: 1, retentionInMb: 35 } }
}
}
}

Expand Down Expand Up @@ -338,13 +351,19 @@ module apim 'br/public:avm/res/api-management/service:0.2.0' = if (useAPIM) {
}

//Configures the API settings for an api app within the Azure API Management (APIM) service.
module apiConfig '../../../../../common/infra/bicep/app/website-config.bicep' = if (useAPIM) {
module apiConfig 'br/public:avm/res/web/site:0.3.9' = if (useAPIM) {
name: 'apiconfig'
scope: rg
params: {
apimServiceId: useAPIM ? apim.outputs.resourceId : ''
apiName: apimApiName
apiAppName: api.outputs.name
kind: 'app'
name: api.outputs.name
serverFarmResourceId: appServicePlan.outputs.resourceId
location: location
apiManagementConfiguration: {
apiManagementConfig: {
id: '${apimServiceId}/apis/${apimApiName}'
}
}
}
}

Expand Down
3 changes: 0 additions & 3 deletions templates/todo/projects/csharp-sql/.repo/bicep/repo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ repo:
- from: ../../../../common/infra/bicep/app/applicationinsights-dashboard.bicep
to: ./infra/app/applicationinsights-dashboard.bicep

- from: ../../../../common/infra/bicep/app/website-config.bicep
to: ./infra/app/website-config.bicep

- from: ../../../../common/infra/bicep/app/sql-deployment-script.bicep
to: ./infra/app/sql-deployment-script.bicep

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,16 +412,6 @@ module apim 'br/public:avm/res/api-management/service:0.2.0' = if (useAPIM) {
}
}

//Configures the API settings for an api app within the Azure API Management (APIM) service.
module apiConfig '../../../../../common/infra/bicep/app/website-config.bicep' = if (useAPIM) {
name: 'apiconfig'
scope: rg
params: {
apimServiceId: useAPIM ? apim.outputs.resourceId : ''
apiName: apimApiName
}
}

// Data outputs
output AZURE_COSMOS_CONNECTION_STRING_KEY string = connectionStringKey
output AZURE_COSMOS_DATABASE_NAME string = actualDatabaseName
Expand Down
3 changes: 0 additions & 3 deletions templates/todo/projects/java-mongo-aca/.repo/bicep/repo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ repo:
- from: ../../../../common/infra/bicep/app/applicationinsights-dashboard.bicep
to: ./infra/app/applicationinsights-dashboard.bicep

- from: ../../../../common/infra/bicep/app/website-config.bicep
to: ./infra/app/website-config.bicep

- from: ./../../
to: ./
ignore:
Expand Down
31 changes: 25 additions & 6 deletions templates/todo/projects/java-mongo/.repo/bicep/infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ var actualDatabaseName = !empty(cosmosDatabaseName) ? cosmosDatabaseName : defau
var webUri = 'https://${web.outputs.defaultHostname}'
var apiUri = 'https://${api.outputs.defaultHostname}'
var apimApiUri = 'https://${apim.outputs.name}.azure-api.net/todo'
var apimServiceId = useAPIM ? apim.outputs.resourceId : ''

// Organize resources in a resource group
resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
Expand All @@ -88,7 +89,7 @@ resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
}

// The application frontend
module web 'br/public:avm/res/web/site:0.2.0' = {
module web 'br/public:avm/res/web/site:0.3.9' = {
name: 'web'
scope: rg
params: {
Expand All @@ -103,11 +104,17 @@ module web 'br/public:avm/res/web/site:0.2.0' = {
linuxFxVersion: 'node|20-lts'
alwaysOn: true
}
logsConfiguration: {
applicationLogs: { fileSystem: { level: 'Verbose' } }
detailedErrorMessages: { enabled: true }
failedRequestsTracing: { enabled: true }
httpLogs: { fileSystem: { enabled: true, retentionInDays: 1, retentionInMb: 35 } }
}
}
}

// The application backend
module api 'br/public:avm/res/web/site:0.2.0' = {
module api 'br/public:avm/res/web/site:0.3.9' = {
name: 'api'
scope: rg
params: {
Expand Down Expand Up @@ -142,6 +149,12 @@ module api 'br/public:avm/res/web/site:0.2.0' = {
['-Djdk.attach.allowAttachSelf=true']),
' ')
}
logsConfiguration: {
applicationLogs: { fileSystem: { level: 'Verbose' } }
detailedErrorMessages: { enabled: true }
failedRequestsTracing: { enabled: true }
httpLogs: { fileSystem: { enabled: true, retentionInDays: 1, retentionInMb: 35 } }
}
}
}

Expand Down Expand Up @@ -344,13 +357,19 @@ module apim 'br/public:avm/res/api-management/service:0.2.0' = if (useAPIM) {
}

//Configures the API settings for an api app within the Azure API Management (APIM) service.
module apiConfig '../../../../../common/infra/bicep/app/website-config.bicep' = if (useAPIM) {
module apiConfig 'br/public:avm/res/web/site:0.3.9' = if (useAPIM) {
name: 'apiconfig'
scope: rg
params: {
apimServiceId: useAPIM ? apim.outputs.resourceId : ''
apiName: apimApiName
apiAppName: api.outputs.name
kind: 'app'
name: api.outputs.name
serverFarmResourceId: appServicePlan.outputs.resourceId
location: location
apiManagementConfiguration: {
apiManagementConfig: {
id: '${apimServiceId}/apis/${apimApiName}'
}
}
}
}

Expand Down
3 changes: 0 additions & 3 deletions templates/todo/projects/java-mongo/.repo/bicep/repo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ repo:
- from: ../../../../common/infra/bicep/app/applicationinsights-dashboard.bicep
to: ./infra/app/applicationinsights-dashboard.bicep

- from: ../../../../common/infra/bicep/app/website-config.bicep
to: ./infra/app/website-config.bicep

- from: ./../../
to: ./
ignore:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,16 +412,6 @@ module apim 'br/public:avm/res/api-management/service:0.2.0' = if (useAPIM) {
}
}

//Configures the API settings for an api app within the Azure API Management (APIM) service.
module apiConfig '../../../../../common/infra/bicep/app/website-config.bicep' = if (useAPIM) {
name: 'apiconfig'
scope: rg
params: {
apimServiceId: useAPIM ? apim.outputs.resourceId : ''
apiName: apimApiName
}
}

// Data outputs
output AZURE_COSMOS_CONNECTION_STRING_KEY string = connectionStringKey
output AZURE_COSMOS_DATABASE_NAME string = actualDatabaseName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,6 @@ repo:
- from: ../../../../common/infra/bicep/app/applicationinsights-dashboard.bicep
to: ./infra/app/applicationinsights-dashboard.bicep

- from: ../../../../common/infra/bicep/app/website-config.bicep
to: ./infra/app/website-config.bicep

- from: ./../../
to: ./
ignore:
Expand Down
Loading

0 comments on commit cef4144

Please sign in to comment.