|
| 1 | +{ |
| 2 | + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", |
| 3 | + "contentVersion": "1.0.0.0", |
| 4 | + "resources": [ |
| 5 | + { |
| 6 | + "type": "Microsoft.OperationalInsights/workspaces", |
| 7 | + "apiVersion": "2022-10-01", |
| 8 | + "name": "[parameters('containerAppLogAnalyticsName')]", |
| 9 | + "location": "[parameters('location')]", |
| 10 | + "properties": { |
| 11 | + "sku": { |
| 12 | + "name": "PerGB2018" |
| 13 | + } |
| 14 | + } |
| 15 | + }, |
| 16 | + { |
| 17 | + "type": "Microsoft.App/managedEnvironments", |
| 18 | + "apiVersion": "2023-11-02-preview", |
| 19 | + "name": "[parameters('containerAppEnvName')]", |
| 20 | + "location": "[parameters('location')]", |
| 21 | + "sku": { |
| 22 | + "name": "Consumption" |
| 23 | + }, |
| 24 | + "properties": { |
| 25 | + "appLogsConfiguration": { |
| 26 | + "destination": "log-analytics", |
| 27 | + "logAnalyticsConfiguration": { |
| 28 | + "customerId": "[reference(resourceId('Microsoft.OperationalInsights/workspaces', parameters('containerAppLogAnalyticsName'))).customerId]", |
| 29 | + "sharedKey": "[listKeys(resourceId('Microsoft.OperationalInsights/workspaces', parameters('containerAppLogAnalyticsName')), '2022-10-01').primarySharedKey]" |
| 30 | + } |
| 31 | + } |
| 32 | + }, |
| 33 | + "dependsOn": [ |
| 34 | + "[resourceId('Microsoft.OperationalInsights/workspaces', parameters('containerAppLogAnalyticsName'))]" |
| 35 | + ] |
| 36 | + }, |
| 37 | + { |
| 38 | + "type": "Microsoft.App/containerApps", |
| 39 | + "apiVersion": "2022-06-01-preview", |
| 40 | + "name": "[parameters('containerAppName')]", |
| 41 | + "location": "[parameters('location')]", |
| 42 | + "properties": { |
| 43 | + "managedEnvironmentId": "[resourceId('Microsoft.App/managedEnvironments', parameters('containerAppEnvName'))]", |
| 44 | + "configuration": { |
| 45 | + "ingress": { |
| 46 | + "external": true, |
| 47 | + "targetPort": "[parameters('targetPort')]", |
| 48 | + "allowInsecure": false, |
| 49 | + "traffic": [ |
| 50 | + { |
| 51 | + "latestRevision": true, |
| 52 | + "weight": 100 |
| 53 | + } |
| 54 | + ] |
| 55 | + } |
| 56 | + }, |
| 57 | + "template": { |
| 58 | + "containers": [ |
| 59 | + { |
| 60 | + "name": "[parameters('containerAppName')]", |
| 61 | + "image": "[parameters('image')]", |
| 62 | + "resources": { |
| 63 | + "cpu": "[json(parameters('cpuCore'))]", |
| 64 | + "memory": "[format('{0}Gi', parameters('memorySize'))]" |
| 65 | + }, |
| 66 | + "env": [ |
| 67 | + { |
| 68 | + "name": "DATABASE_URL", |
| 69 | + "value": "[parameters('databaseUrl')]" |
| 70 | + }, |
| 71 | + { |
| 72 | + "name": "COHERE_API_KEY", |
| 73 | + "value": "[parameters('cohereApiKey')]" |
| 74 | + } |
| 75 | + ] |
| 76 | + } |
| 77 | + ], |
| 78 | + "scale": { |
| 79 | + "minReplicas": "[parameters('minReplicas')]", |
| 80 | + "maxReplicas": "[parameters('maxReplicas')]", |
| 81 | + "rules": [ |
| 82 | + { |
| 83 | + "name": "http-scale-rule", |
| 84 | + "http": { |
| 85 | + "metadata": { |
| 86 | + "concurrentRequests": "100" |
| 87 | + } |
| 88 | + } |
| 89 | + } |
| 90 | + ] |
| 91 | + } |
| 92 | + } |
| 93 | + }, |
| 94 | + "dependsOn": [ |
| 95 | + "[resourceId('Microsoft.App/managedEnvironments', parameters('containerAppEnvName'))]" |
| 96 | + ] |
| 97 | + } |
| 98 | + ], |
| 99 | + "parameters": { |
| 100 | + "containerAppName": { |
| 101 | + "type": "string", |
| 102 | + "defaultValue": "[format('toolkit-app-{0}', uniqueString(resourceGroup().id))]", |
| 103 | + "metadata": { |
| 104 | + "description": "Specifies the name of the container app." |
| 105 | + } |
| 106 | + }, |
| 107 | + "containerAppEnvName": { |
| 108 | + "type": "string", |
| 109 | + "defaultValue": "[format('toolkit-env-{0}', uniqueString(resourceGroup().id))]", |
| 110 | + "metadata": { |
| 111 | + "description": "Specifies the name of the container app environment." |
| 112 | + } |
| 113 | + }, |
| 114 | + "containerAppLogAnalyticsName": { |
| 115 | + "type": "string", |
| 116 | + "defaultValue": "[format('toolkit-log-{0}', uniqueString(resourceGroup().id))]", |
| 117 | + "metadata": { |
| 118 | + "description": "Specifies the name of the log analytics workspace." |
| 119 | + } |
| 120 | + }, |
| 121 | + "location": { |
| 122 | + "type": "string", |
| 123 | + "defaultValue": "[resourceGroup().location]", |
| 124 | + "metadata": { |
| 125 | + "description": "Specifies the location for all resources." |
| 126 | + } |
| 127 | + }, |
| 128 | + "targetPort": { |
| 129 | + "type": "int", |
| 130 | + "defaultValue": 4000, |
| 131 | + "metadata": { |
| 132 | + "description": "Specifies the container port." |
| 133 | + } |
| 134 | + }, |
| 135 | + "cpuCore": { |
| 136 | + "type": "string", |
| 137 | + "defaultValue": "2", |
| 138 | + "allowedValues": [ |
| 139 | + "0.25", |
| 140 | + "0.5", |
| 141 | + "0.75", |
| 142 | + "1", |
| 143 | + "1.25", |
| 144 | + "1.5", |
| 145 | + "1.75", |
| 146 | + "2" |
| 147 | + ], |
| 148 | + "metadata": { |
| 149 | + "description": "Number of CPU cores the container can use. Can be with a maximum of two decimals." |
| 150 | + } |
| 151 | + }, |
| 152 | + "memorySize": { |
| 153 | + "type": "string", |
| 154 | + "defaultValue": "4", |
| 155 | + "allowedValues": [ |
| 156 | + "0.5", |
| 157 | + "1", |
| 158 | + "1.5", |
| 159 | + "2", |
| 160 | + "3", |
| 161 | + "3.5", |
| 162 | + "4" |
| 163 | + ], |
| 164 | + "metadata": { |
| 165 | + "description": "Amount of memory (in gibibytes, GiB) allocated to the container up to 4GiB. Can be with a maximum of two decimals. Ratio with CPU cores must be equal to 2." |
| 166 | + } |
| 167 | + }, |
| 168 | + "minReplicas": { |
| 169 | + "type": "int", |
| 170 | + "defaultValue": 1, |
| 171 | + "maxValue": 2, |
| 172 | + "minValue": 0, |
| 173 | + "metadata": { |
| 174 | + "description": "Minimum number of replicas that will be deployed" |
| 175 | + } |
| 176 | + }, |
| 177 | + "maxReplicas": { |
| 178 | + "type": "int", |
| 179 | + "defaultValue": 1, |
| 180 | + "maxValue": 2, |
| 181 | + "minValue": 0, |
| 182 | + "metadata": { |
| 183 | + "description": "Maximum number of replicas that will be deployed" |
| 184 | + } |
| 185 | + }, |
| 186 | + "image": { |
| 187 | + "type": "string", |
| 188 | + "defaultValue": "ghcr.io/cohere-ai/cohere-toolkit-proxy", |
| 189 | + "metadata": { |
| 190 | + "description": "Docker image to deploy" |
| 191 | + } |
| 192 | + }, |
| 193 | + "databaseUrl": { |
| 194 | + "type": "string", |
| 195 | + "metadata": { |
| 196 | + "description": "Your Database connection URL" |
| 197 | + } |
| 198 | + }, |
| 199 | + "cohereApiKey": { |
| 200 | + "type": "string", |
| 201 | + "metadata": { |
| 202 | + "description": "Your Cohere API key for the application" |
| 203 | + } |
| 204 | + } |
| 205 | + } |
| 206 | +} |
0 commit comments