Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add deployment to Azure (with Cosmos DB as push subscription store) #18

Merged
merged 2 commits into from
Nov 11, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Deploy infrastructure
  • Loading branch information
tpeczek committed Nov 11, 2023
commit 9be0f4f3463de4d501b4d6743e9ced7b8f1b6098
4 changes: 2 additions & 2 deletions .github/workflows/deploy-to-azure-with-cosmos-db.yml
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ permissions:
contents: read

jobs:
deploy-infrastructe:
deploy-infrastructure:
runs-on: ubuntu-latest
environment: azure
steps:
@@ -38,7 +38,7 @@ jobs:
az cache purge
az account clear
build-and-deploy-webapp:
needs: [deploy-infrastructe]
needs: [deploy-infrastructure]
runs-on: ubuntu-latest
environment: azure
steps:
9 changes: 9 additions & 0 deletions infrastructure/azure/main.bicep
Original file line number Diff line number Diff line change
@@ -7,3 +7,12 @@ resource resourceGroupResource 'Microsoft.Resources/resourceGroups@2022-09-01' =
name: 'rg-${projectName}'
location: projectLocation
}

module resourceGroupModule 'resource-group.bicep' = {
name: '${projectName}-rg'
scope: resourceGroup(resourceGroupResource.name)
params: {
projectName: projectName
projectLocation: resourceGroupResource.location
}
}
48 changes: 48 additions & 0 deletions infrastructure/azure/resource-group.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
targetScope = 'resourceGroup'

param projectName string
param projectLocation string = resourceGroup().location

var projectAppServiceName = 'app-${length(projectName) > 56 ? substring(projectName, 0, 56) : projectName}'
var projectAppServicePlanName = 'asp-${length(projectName) > 36 ? substring(projectName, 0, 36) : projectName}'
var projectDocumentDBAccountName = 'cosmos-${uniqueString(resourceGroup().id)}'

resource projectDocumentDBAccount 'Microsoft.DocumentDB/databaseAccounts@2023-04-15' = {
name: projectDocumentDBAccountName
location: projectLocation
properties: {
enableFreeTier: true
databaseAccountOfferType: 'Standard'
consistencyPolicy: {
defaultConsistencyLevel: 'Session'
}
locations: [
{
locationName: projectLocation
}
]
}
}

resource projectAppServicePlan 'Microsoft.Web/serverfarms@2022-09-01' = {
name: projectAppServicePlanName
location: projectLocation
sku: {
name: 'F1'
}
kind: 'linux'
properties: {
reserved: true
}
}

resource projectAppService 'Microsoft.Web/sites@2022-09-01' = {
name: projectAppServiceName
location: projectLocation
properties: {
serverFarmId: projectAppServicePlan.id
siteConfig: {
linuxFxVersion: 'DOTNETCORE|6.0'
}
}
}