forked from semantica-agi/semantica
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.bicep
More file actions
132 lines (123 loc) · 3.39 KB
/
Copy pathmain.bicep
File metadata and controls
132 lines (123 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
targetScope = 'resourceGroup'
param environmentName string = 'semantica-ke'
param location string = resourceGroup().location
param imageName string
param containerPort int = 8000
param allowedOrigins string = '*'
param falkordbHost string = 'falkordb'
param falkordbPort string = '6379'
@description('Deploy the managed environment with an internal load balancer (no public IP). Recommended for production. Set false only for quick dev/test deployments.')
param vnetInternal bool = true
@description('Resource ID of an existing subnet for the Container Apps environment. Required when vnetInternal is true. E.g. /subscriptions/.../subnets/aca-subnet')
param infrastructureSubnetId string = ''
var appName = '${environmentName}-explorer'
var logAnalyticsName = '${environmentName}-logs'
var managedEnvironmentName = '${environmentName}-env'
// Two concrete objects avoids a `null` ternary branch, which crashes checkov's Bicep parser.
var vnetConfigInternal = {
internal: true
infrastructureSubnetId: infrastructureSubnetId
}
var vnetConfigExternal = {
internal: false
}
resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2023-09-01' = {
name: logAnalyticsName
location: location
properties: {
sku: {
name: 'PerGB2018'
}
retentionInDays: 30
}
}
resource managedEnvironment 'Microsoft.App/managedEnvironments@2024-03-01' = {
name: managedEnvironmentName
location: location
properties: {
vnetConfiguration: vnetInternal ? vnetConfigInternal : vnetConfigExternal
appLogsConfiguration: {
destination: 'log-analytics'
logAnalyticsConfiguration: {
customerId: logAnalytics.properties.customerId
sharedKey: logAnalytics.listKeys().primarySharedKey
}
}
}
}
resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
name: appName
location: location
identity: {
type: 'SystemAssigned'
}
tags: {
'azd-service-name': 'explorer'
}
properties: {
managedEnvironmentId: managedEnvironment.id
configuration: {
activeRevisionsMode: 'Single'
ingress: {
external: true
targetPort: containerPort
transport: 'auto'
allowInsecure: false
}
}
template: {
containers: [
{
name: 'explorer'
image: imageName
env: [
{
name: 'ALLOWED_ORIGINS'
value: allowedOrigins
}
{
name: 'FALKORDB_HOST'
value: falkordbHost
}
{
name: 'FALKORDB_PORT'
value: falkordbPort
}
]
probes: [
{
type: 'Liveness'
httpGet: {
path: '/api/health'
port: containerPort
}
initialDelaySeconds: 20
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 3
}
]
resources: {
cpu: json('0.5')
memory: '1Gi'
}
}
]
scale: {
minReplicas: 0
maxReplicas: 10
rules: [
{
name: 'http-concurrency'
http: {
metadata: {
concurrentRequests: '100'
}
}
}
]
}
}
}
}
output endpoint string = 'https://${containerApp.properties.configuration.ingress.fqdn}'