-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Azure Container App one click deployment (#165)
* Azure HPA one click deployment - DRAFT * Azure HPA one click deployment - DRAFT * Azure HPA one click deployment - DRAFT * Azure HPA one click deployment - DRAFT * Azure HPA one click deployment - DRAFT * Azure HPA one click deployment - DRAFT * Azure HPA one click deployment - DRAFT * Azure HPA one click deployment - DRAFT * Azure Container App one click deployment
- Loading branch information
1 parent
d089057
commit f5ad3ee
Showing
4 changed files
with
287 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# | ||
name: Create and publish single container image with nginx proxy | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
inputs: | ||
tags: | ||
description: "tags to attach to image" | ||
required: false | ||
type: string | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: cohere-toolkit-proxy | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
# | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/cohere-ai/${{ env.IMAGE_NAME }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
file: ./Dockerfile | ||
- name: Test the Docker image | ||
run: | | ||
docker run -d -p 8000:8000 $REGISTRY/cohere-ai/$IMAGE_NAME | ||
sleep 30 | ||
status_code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8000/health) | ||
if [ $status_code -eq 200 ]; then | ||
echo "Backend started successfully" | ||
else | ||
echo "Backend failed to start" | ||
exit 1 | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"resources": [ | ||
{ | ||
"type": "Microsoft.OperationalInsights/workspaces", | ||
"apiVersion": "2022-10-01", | ||
"name": "[parameters('containerAppLogAnalyticsName')]", | ||
"location": "[parameters('location')]", | ||
"properties": { | ||
"sku": { | ||
"name": "PerGB2018" | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Microsoft.App/managedEnvironments", | ||
"apiVersion": "2023-11-02-preview", | ||
"name": "[parameters('containerAppEnvName')]", | ||
"location": "[parameters('location')]", | ||
"sku": { | ||
"name": "Consumption" | ||
}, | ||
"properties": { | ||
"appLogsConfiguration": { | ||
"destination": "log-analytics", | ||
"logAnalyticsConfiguration": { | ||
"customerId": "[reference(resourceId('Microsoft.OperationalInsights/workspaces', parameters('containerAppLogAnalyticsName'))).customerId]", | ||
"sharedKey": "[listKeys(resourceId('Microsoft.OperationalInsights/workspaces', parameters('containerAppLogAnalyticsName')), '2022-10-01').primarySharedKey]" | ||
} | ||
} | ||
}, | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.OperationalInsights/workspaces', parameters('containerAppLogAnalyticsName'))]" | ||
] | ||
}, | ||
{ | ||
"type": "Microsoft.App/containerApps", | ||
"apiVersion": "2022-06-01-preview", | ||
"name": "[parameters('containerAppName')]", | ||
"location": "[parameters('location')]", | ||
"properties": { | ||
"managedEnvironmentId": "[resourceId('Microsoft.App/managedEnvironments', parameters('containerAppEnvName'))]", | ||
"configuration": { | ||
"ingress": { | ||
"external": true, | ||
"targetPort": "[parameters('targetPort')]", | ||
"allowInsecure": false, | ||
"traffic": [ | ||
{ | ||
"latestRevision": true, | ||
"weight": 100 | ||
} | ||
] | ||
} | ||
}, | ||
"template": { | ||
"containers": [ | ||
{ | ||
"name": "[parameters('containerAppName')]", | ||
"image": "[parameters('image')]", | ||
"resources": { | ||
"cpu": "[json(parameters('cpuCore'))]", | ||
"memory": "[format('{0}Gi', parameters('memorySize'))]" | ||
}, | ||
"env": [ | ||
{ | ||
"name": "DATABASE_URL", | ||
"value": "[parameters('databaseUrl')]" | ||
}, | ||
{ | ||
"name": "COHERE_API_KEY", | ||
"value": "[parameters('cohereApiKey')]" | ||
} | ||
] | ||
} | ||
], | ||
"scale": { | ||
"minReplicas": "[parameters('minReplicas')]", | ||
"maxReplicas": "[parameters('maxReplicas')]", | ||
"rules": [ | ||
{ | ||
"name": "http-scale-rule", | ||
"http": { | ||
"metadata": { | ||
"concurrentRequests": "100" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.App/managedEnvironments', parameters('containerAppEnvName'))]" | ||
] | ||
} | ||
], | ||
"parameters": { | ||
"containerAppName": { | ||
"type": "string", | ||
"defaultValue": "[format('toolkit-app-{0}', uniqueString(resourceGroup().id))]", | ||
"metadata": { | ||
"description": "Specifies the name of the container app." | ||
} | ||
}, | ||
"containerAppEnvName": { | ||
"type": "string", | ||
"defaultValue": "[format('toolkit-env-{0}', uniqueString(resourceGroup().id))]", | ||
"metadata": { | ||
"description": "Specifies the name of the container app environment." | ||
} | ||
}, | ||
"containerAppLogAnalyticsName": { | ||
"type": "string", | ||
"defaultValue": "[format('toolkit-log-{0}', uniqueString(resourceGroup().id))]", | ||
"metadata": { | ||
"description": "Specifies the name of the log analytics workspace." | ||
} | ||
}, | ||
"location": { | ||
"type": "string", | ||
"defaultValue": "[resourceGroup().location]", | ||
"metadata": { | ||
"description": "Specifies the location for all resources." | ||
} | ||
}, | ||
"targetPort": { | ||
"type": "int", | ||
"defaultValue": 4000, | ||
"metadata": { | ||
"description": "Specifies the container port." | ||
} | ||
}, | ||
"cpuCore": { | ||
"type": "string", | ||
"defaultValue": "2", | ||
"allowedValues": [ | ||
"0.25", | ||
"0.5", | ||
"0.75", | ||
"1", | ||
"1.25", | ||
"1.5", | ||
"1.75", | ||
"2" | ||
], | ||
"metadata": { | ||
"description": "Number of CPU cores the container can use. Can be with a maximum of two decimals." | ||
} | ||
}, | ||
"memorySize": { | ||
"type": "string", | ||
"defaultValue": "4", | ||
"allowedValues": [ | ||
"0.5", | ||
"1", | ||
"1.5", | ||
"2", | ||
"3", | ||
"3.5", | ||
"4" | ||
], | ||
"metadata": { | ||
"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." | ||
} | ||
}, | ||
"minReplicas": { | ||
"type": "int", | ||
"defaultValue": 1, | ||
"maxValue": 2, | ||
"minValue": 0, | ||
"metadata": { | ||
"description": "Minimum number of replicas that will be deployed" | ||
} | ||
}, | ||
"maxReplicas": { | ||
"type": "int", | ||
"defaultValue": 1, | ||
"maxValue": 2, | ||
"minValue": 0, | ||
"metadata": { | ||
"description": "Maximum number of replicas that will be deployed" | ||
} | ||
}, | ||
"image": { | ||
"type": "string", | ||
"defaultValue": "ghcr.io/cohere-ai/cohere-toolkit-proxy", | ||
"metadata": { | ||
"description": "Docker image to deploy" | ||
} | ||
}, | ||
"databaseUrl": { | ||
"type": "string", | ||
"metadata": { | ||
"description": "Your Database connection URL" | ||
} | ||
}, | ||
"cohereApiKey": { | ||
"type": "string", | ||
"metadata": { | ||
"description": "Your Cohere API key for the application" | ||
} | ||
} | ||
} | ||
} |
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