Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Bump json5 from 2.2.1 to 2.2.3 in /function_vnet_integration/src #13

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
45 changes: 45 additions & 0 deletions aca.camera/Aca.Camera.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30114.105
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CameraService", "src\CameraService\CameraService.csproj", "{0DE5D578-9DCA-4E30-8ED0-3C412C7A48B1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CameraControlService", "src\CameraControlService\CameraControlService.csproj", "{FF06E45F-865B-4420-8B75-DB70ED57ACAB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotificationService", "src\NotificationService\NotificationService.csproj", "{AA6C912B-EFAF-43D3-A2A4-506F0A1821C1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DD83AB62-DD46-4797-8B90-A46BF1BA1AE5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CameraSimulator", "src\CameraSimulator\CameraSimulator.csproj", "{6E1CDBDC-9CDE-4D2B-9D8D-4DC5C6E8688E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0DE5D578-9DCA-4E30-8ED0-3C412C7A48B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0DE5D578-9DCA-4E30-8ED0-3C412C7A48B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0DE5D578-9DCA-4E30-8ED0-3C412C7A48B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0DE5D578-9DCA-4E30-8ED0-3C412C7A48B1}.Release|Any CPU.Build.0 = Release|Any CPU
{FF06E45F-865B-4420-8B75-DB70ED57ACAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FF06E45F-865B-4420-8B75-DB70ED57ACAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FF06E45F-865B-4420-8B75-DB70ED57ACAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FF06E45F-865B-4420-8B75-DB70ED57ACAB}.Release|Any CPU.Build.0 = Release|Any CPU
{AA6C912B-EFAF-43D3-A2A4-506F0A1821C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AA6C912B-EFAF-43D3-A2A4-506F0A1821C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA6C912B-EFAF-43D3-A2A4-506F0A1821C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AA6C912B-EFAF-43D3-A2A4-506F0A1821C1}.Release|Any CPU.Build.0 = Release|Any CPU
{6E1CDBDC-9CDE-4D2B-9D8D-4DC5C6E8688E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6E1CDBDC-9CDE-4D2B-9D8D-4DC5C6E8688E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6E1CDBDC-9CDE-4D2B-9D8D-4DC5C6E8688E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6E1CDBDC-9CDE-4D2B-9D8D-4DC5C6E8688E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{6E1CDBDC-9CDE-4D2B-9D8D-4DC5C6E8688E} = {DD83AB62-DD46-4797-8B90-A46BF1BA1AE5}
EndGlobalSection
EndGlobal
44 changes: 44 additions & 0 deletions aca.camera/deploy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Create the resource group

``` shell
az group create -n aca-camera -l eastus
```

# Create the bicep deployment

``` shell
az deployment group create -g aca-camera --template-file main.bicep
```

# Logs Analytics Query

``` shell
ContainerAppConsoleLogs_CL
| where ContainerAppName_s == 'camera-control'
| project Log_State_Message_s, TimeGenerated
| order by TimeGenerated desc
```

# Log stream

``` shell
az containerapp logs show -n camera-control -g aca-camera
```

# Connect to Console

``` shell
az containerapp exec -n camera-control -g aca-camera --command bash
```

# Cleanup

``` shell
az group delete -n aca-camera
```

## References:

* [Azure Container Apps Virtual Network Integration](https://techcommunity.microsoft.com/t5/apps-on-azure-blog/azure-container-apps-virtual-network-integration/ba-p/3096932)
* [Quickstart: Deploy your first container app](https://docs.microsoft.com/en-us/azure/container-apps/get-started?ocid=AID3042118&tabs=bash)
* [Azure Container Apps GitHub](https://github.com/microsoft/azure-container-apps)
158 changes: 158 additions & 0 deletions aca.camera/deploy/aca/aca_environment.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
@description('Specifies the location for resources.')
param location string = resourceGroup().location

@description('Specifies the VNET.')
param vnetId string

@description('Storage Account Name')
param accountName string = 'daprcfmstorage'

@description('Storage Account Key')
@secure()
param storageaccountkey string

@description('EventHubs Connection String')
param evhConnectionString string

@description('CosmosDB Name')
param cosmosDbName string

resource logs 'Microsoft.OperationalInsights/workspaces@2020-03-01-preview' = {
name: 'container-apps-logs'
location: location
properties: {
sku: {
name: 'PerGB2018'
}
retentionInDays: 30
}
}

resource insights 'Microsoft.Insights/components@2020-02-02' = {
name: 'container-apps-insights'
location: location
kind: 'web'
properties: {
Application_Type: 'web'
WorkspaceResourceId: logs.id
}
}

// https://github.com/Azure/azure-rest-api-specs/blob/cca8e03063c627f256fe0b3761db82450b25fdbb/specification/app/resource-manager/Microsoft.App/preview/2022-01-01-preview/ManagedEnvironments.json#L660
resource app_environment 'Microsoft.App/managedEnvironments@2022-01-01-preview' = {
name: 'container-apps-env'
location: location
properties: {
daprAIInstrumentationKey: insights.properties.InstrumentationKey
appLogsConfiguration: {
destination: 'log-analytics'
logAnalyticsConfiguration: {
customerId: logs.properties.customerId
sharedKey: logs.listKeys().primarySharedKey
}
}
vnetConfiguration: {
internal: true
infrastructureSubnetId: '${vnetId}/subnets/apps'
}
}
}

module aca_environment_dns './aca_environment_dns.bicep' = {
name: 'aca_environment_dns-module'
params: {
fqdn: app_environment.properties.defaultDomain
vnetId: vnetId
staticIP: app_environment.properties.staticIp
}
}

resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2021-01-15' existing = {
name: cosmosDbName
}

resource dapr_state_store 'Microsoft.App/managedEnvironments/daprComponents@2022-01-01-preview' = {
name: 'statestore'
parent: app_environment
properties: {
componentType: 'state.azure.cosmosdb'
version: 'v1'
secrets: [
{
name: 'masterkey'
value: cosmos.listKeys().primaryMasterKey
}
]
metadata: [
{
name: 'url'
value: cosmos.properties.documentEndpoint
}
{
name: 'database'
value: 'cameras'
}
{
name: 'collection'
value: 'state'
}
{
name: 'masterKey'
secretRef: 'masterkey'
}
{
name: 'actorStateStore'
value: 'true'
}
]
scopes: []
}
}

resource dapr_pub_sub 'Microsoft.App/managedEnvironments/daprComponents@2022-01-01-preview' = {
name: 'pubsub'
parent: app_environment
properties: {
componentType: 'pubsub.azure.eventhubs'
version: 'v1'
secrets: [
{
name: 'evhconnectionstring'
value: evhConnectionString
}
{
name: 'storageaccountkey'
value: storageaccountkey
}
]
metadata: [
{
name: 'connectionString'
secretRef: 'evhconnectionstring'
}
{
name: 'enableEntityManagement'
value: 'false'
}
{
name: 'storageAccountName'
value: accountName
}
{
name: 'storageContainerName'
value: 'subscribers'
}
{
name: 'storageAccountKey'
secretRef: 'storageaccountkey'
}
]
scopes: [
'camera-control'
'notification-service'
'camera-simulator'
]
}
}

output id string = app_environment.id
40 changes: 40 additions & 0 deletions aca.camera/deploy/aca/aca_environment_dns.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@description('Specifies the VNET.')
param vnetId string

@description('Specifies the Azure Container App FQDN.')
param fqdn string

@description('Specifies the Azure Container App Load Balancer IP.')
param staticIP string

// Create the Private DNS Zone
resource aca_dns 'Microsoft.Network/privateDnsZones@2018-09-01' = {
name: fqdn
location: 'global'
}

// Create A record pointing all subdomains to the Azure Container App Static IP
resource a_record 'Microsoft.Network/privateDnsZones/A@2020-06-01' = {
name: '*'
parent: aca_dns
properties: {
aRecords: [
{
ipv4Address: staticIP
}
]
ttl: 3600
}
}

// Link the Private DNS Zone with the VNET
resource vnet_dns_link 'Microsoft.Network/privateDnsZones/virtualNetworkLinks@2018-09-01' = {
name: '${aca_dns.name}/private-network'
location: 'global'
properties: {
registrationEnabled: false
virtualNetwork: {
id: vnetId
}
}
}
39 changes: 39 additions & 0 deletions aca.camera/deploy/bastion/bastion.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@description('Specifies the location for resources.')
param location string = resourceGroup().location

@description('Specifies the VNET.')
param vnetId string

@description('Specifies the Subnet.')
param subnetName string

resource publicIpAddressForBastion 'Microsoft.Network/publicIpAddresses@2020-08-01' = {
name: 'aca-bastion-public-ip'
location: location
sku: {
name: 'Standard'
}
properties: {
publicIPAllocationMethod: 'Static'
}
}

resource bastionHost 'Microsoft.Network/bastionHosts@2021-03-01' = {
name: 'bastion'
location: location
properties: {
ipConfigurations: [
{
name: 'IpConf'
properties: {
subnet: {
id: '${vnetId}/subnets/${subnetName}'
}
publicIPAddress: {
id: publicIpAddressForBastion.id
}
}
}
]
}
}
49 changes: 49 additions & 0 deletions aca.camera/deploy/cosmosdb/cosmosdb.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@description('Specifies the location for resources.')
param location string = resourceGroup().location

resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2021-01-15' = {
name: 'dapr-aca-cosmosdb'
kind: 'GlobalDocumentDB'
location: location
properties: {
consistencyPolicy: {
defaultConsistencyLevel: 'Strong'
}
locations: [
{
isZoneRedundant: false
locationName: location
}
]
databaseAccountOfferType: 'Standard'
enableAutomaticFailover: false
}
}

resource cosmos_databaseName 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases@2021-01-15' = {
parent: cosmos
name: 'runners'
properties: {
resource: {
id: 'runners'
}
}
}

resource cosmos_containerName 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers@2021-01-15' = {
parent: cosmos_databaseName
name: 'state'
properties: {
resource: {
id: 'state'
partitionKey: {
paths: [
'/partitionKey'
]
kind: 'Hash'
}
}
}
}

output name string = cosmos.name
Loading