-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Rollout] Production rollout 2024-09-10 (#3940)
- Loading branch information
Showing
39 changed files
with
1,276 additions
and
808 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
145 changes: 145 additions & 0 deletions
145
eng/service-templates/ProductConstructionService/container-app.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
param location string | ||
param containerRegistryName string | ||
param containerImageName string | ||
param containerCpuCoreCount string | ||
param containerMemory string | ||
param aspnetcoreEnvironment string | ||
param productConstructionServiceName string | ||
param applicationInsightsConnectionString string | ||
param pcsIdentityId string | ||
param containerEnvironmentId string | ||
param contributorRoleId string | ||
param deploymentIdentityPrincipalId string | ||
|
||
// common environment variables used by the app | ||
var containerAppEnv = [ | ||
{ | ||
name: 'ASPNETCORE_ENVIRONMENT' | ||
value: aspnetcoreEnvironment | ||
} | ||
{ | ||
name: 'Logging__Console__FormatterName' | ||
value: 'simple' | ||
} | ||
{ | ||
name: 'Logging__Console__FormatterOptions__SingleLine' | ||
value: 'true' | ||
} | ||
{ | ||
name: 'Logging__Console__FormatterOptions__IncludeScopes' | ||
value: 'true' | ||
} | ||
{ | ||
name: 'ASPNETCORE_LOGGING__CONSOLE__DISABLECOLORS' | ||
value: 'true' | ||
} | ||
{ | ||
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING' | ||
value: applicationInsightsConnectionString | ||
} | ||
{ | ||
name: 'VmrPath' | ||
value: '/mnt/datadir/vmr' | ||
} | ||
{ | ||
name: 'TmpPath' | ||
value: '/mnt/datadir/tmp' | ||
} | ||
] | ||
|
||
// container app hosting the Product Construction Service | ||
resource containerApp 'Microsoft.App/containerApps@2023-04-01-preview' = { | ||
name: productConstructionServiceName | ||
location: location | ||
identity: { | ||
type: 'UserAssigned' | ||
userAssignedIdentities: { '${pcsIdentityId}' : {}} | ||
} | ||
properties: { | ||
managedEnvironmentId: containerEnvironmentId | ||
configuration: { | ||
activeRevisionsMode: 'Multiple' | ||
maxInactiveRevisions: 5 | ||
ingress: { | ||
external: true | ||
targetPort: 8080 | ||
transport: 'http' | ||
} | ||
dapr: { enabled: false } | ||
registries: [ | ||
{ | ||
server: '${containerRegistryName}.azurecr.io' | ||
identity: pcsIdentityId | ||
} | ||
] | ||
} | ||
template: { | ||
scale: { | ||
minReplicas: 1 | ||
maxReplicas: 1 | ||
} | ||
serviceBinds: [] | ||
containers: [ | ||
{ | ||
image: containerImageName | ||
name: 'api' | ||
env: containerAppEnv | ||
resources: { | ||
cpu: json(containerCpuCoreCount) | ||
memory: containerMemory | ||
ephemeralStorage: '50Gi' | ||
} | ||
volumeMounts: [ | ||
{ | ||
volumeName: 'data' | ||
mountPath: '/mnt/datadir' | ||
} | ||
] | ||
probes: [ | ||
{ | ||
httpGet: { | ||
path: '/alive' | ||
port: 8080 | ||
scheme: 'HTTP' | ||
} | ||
initialDelaySeconds: 5 | ||
periodSeconds: 10 | ||
successThreshold: 1 | ||
failureThreshold: 3 | ||
type: 'Startup' | ||
} | ||
{ | ||
httpGet: { | ||
path: '/health' | ||
port: 8080 | ||
scheme: 'HTTP' | ||
} | ||
initialDelaySeconds: 60 | ||
failureThreshold: 10 | ||
successThreshold: 1 | ||
periodSeconds: 30 | ||
type: 'Readiness' | ||
} | ||
] | ||
} | ||
] | ||
volumes: [ | ||
{ | ||
name: 'data' | ||
storageType: 'EmptyDir' | ||
} | ||
] | ||
} | ||
} | ||
} | ||
|
||
// Give the PCS Deployment MI the Contributor role in the containerapp to allow it to deploy | ||
resource deploymentSubscriptionTriggererContributor 'Microsoft.Authorization/roleAssignments@2022-04-01' = { | ||
scope: containerApp | ||
name: guid(subscription().id, resourceGroup().id, '${productConstructionServiceName}-contributor') | ||
properties: { | ||
roleDefinitionId: contributorRoleId | ||
principalType: 'ServicePrincipal' | ||
principalId: deploymentIdentityPrincipalId | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
eng/service-templates/ProductConstructionService/container-environment.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
param location string | ||
param logAnalyticsName string | ||
param containerEnvironmentName string | ||
param productConstructionServiceSubnetId string | ||
param infrastructureResourceGroupName string | ||
param applicationInsightsName string | ||
|
||
resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2021-12-01-preview' = { | ||
name: logAnalyticsName | ||
location: location | ||
properties: any({ | ||
retentionInDays: 30 | ||
features: { | ||
searchVersion: 1 | ||
} | ||
sku: { | ||
name: 'PerGB2018' | ||
} | ||
}) | ||
} | ||
|
||
resource containerEnvironment 'Microsoft.App/managedEnvironments@2023-04-01-preview' = { | ||
name: containerEnvironmentName | ||
location: location | ||
properties: { | ||
appLogsConfiguration: { | ||
destination: 'log-analytics' | ||
logAnalyticsConfiguration: { | ||
customerId: logAnalytics.properties.customerId | ||
sharedKey: logAnalytics.listKeys().primarySharedKey | ||
} | ||
} | ||
workloadProfiles: [ | ||
{ | ||
name: 'Consumption' | ||
workloadProfileType: 'Consumption' | ||
} | ||
] | ||
vnetConfiguration: { | ||
infrastructureSubnetId: productConstructionServiceSubnetId | ||
} | ||
infrastructureResourceGroup: infrastructureResourceGroupName | ||
} | ||
} | ||
|
||
// application insights for service logging | ||
resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = { | ||
name: applicationInsightsName | ||
location: location | ||
kind: 'web' | ||
properties: { | ||
Application_Type: 'web' | ||
publicNetworkAccessForIngestion: 'Enabled' | ||
publicNetworkAccessForQuery: 'Enabled' | ||
RetentionInDays: 120 | ||
WorkspaceResourceId: logAnalytics.id | ||
} | ||
} | ||
|
||
output applicationInsightsConnectionString string = applicationInsights.properties.ConnectionString | ||
output containerEnvironmentId string = containerEnvironment.id |
Oops, something went wrong.