From 728e1c3c4a6d1629a090c8ee62ea302d3231b632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9mence=20Lesn=C3=A9?= Date: Mon, 22 Jan 2024 15:56:14 +0100 Subject: [PATCH] dev: Simplify a lot the deployment required config --- README.md | 32 +++++++++++++++++++++++++++++--- bicep/app.bicep | 25 +++++++++++++++++++++++++ bicep/main.bicep | 3 ++- 3 files changed, 56 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ef144091..8c662ae5 100644 --- a/README.md +++ b/README.md @@ -205,11 +205,37 @@ Container is available on GitHub Actions, at: - Latest version from a branch: `ghcr.io/clemlesne/claim-ai-phone-bot:main` - Specific tag: `ghcr.io/clemlesne/claim-ai-phone-bot:0.1.0` (recommended) +Create a local `config.yaml` file (most of the fields are filled automatically by the deployment script): + +```yaml +# config.yaml +api: {} + +database: + cosmos_db: {} + +resources: {} + +workflow: + agent_phone_number: "+33612345678" + bot_company: Contoso + bot_name: Robert + +communication_service: + phone_number: "+33612345678" + voice_name: fr-FR-DeniseNeural + +cognitive_service: + endpoint: https://xxx.cognitiveservices.azure.com + +openai: {} +``` + Steps to deploy: -1. Create an Communication Services resource with a phone number -2. Create a local `config.yaml` file (be sure to use the phone number previously created) -3. Connect to (for example `az login`) +1. Create an `Communication Services` resource plus a `Phone Number` +2. Create the local `config.yaml` +3. Connect to your Azure environment (e.g. `az login`) 4. Run deployment with `make deploy name=my-instance` 5. Wait for the deployment to finish 6. Get the logs with `make logs name=my-instance` diff --git a/bicep/app.bicep b/bicep/app.bicep index 32df80aa..0f8620a3 100644 --- a/bicep/app.bicep +++ b/bicep/app.bicep @@ -11,6 +11,7 @@ var appUrl = 'https://claim-ai.${acaEnv.properties.defaultDomain}' var gptModelFullName = toLower('${gptModel}-${gptVersion}') output appUrl string = appUrl +output blobStoragePublicName string = storageAccount.name output communicationId string = communication.id resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2022-10-01' = { @@ -93,6 +94,30 @@ resource containerApp 'Microsoft.App/containerApps@2023-05-01' = { name: 'DATABASE_COSMOS_DB_DATABASE' value: database.name } + { + name: 'RESOURCES_PUBLIC_URL' + value: storageAccount.properties.primaryEndpoints.web + } + { + name: 'COMMUNICATION_SERVICE_ENDPOINT' + value: communication.properties.hostName + } + { + name: 'COMMUNICATION_SERVICE_ACCESS_KEY' + value: communication.listKeys().primaryKey + } + { + name: 'OPENAI_ENDPOINT' + value: cognitiveOpenai.properties.endpoint + } + { + name: 'OPENAI_GPT_DEPLOYMENT' + value: gpt.name + } + { + name: 'OPENAI_GPT_MODEL' + value: gptModel + } ] resources: { cpu: 1 diff --git a/bicep/main.bicep b/bicep/main.bicep index 5aa5aaae..48c7e8de 100644 --- a/bicep/main.bicep +++ b/bicep/main.bicep @@ -1,5 +1,5 @@ param config string -param imageVersion string = 'main' +param imageVersion string = 'develop' param gptModel string = 'gpt-4' param gptVersion string = '1106-Preview' param instance string = deployment().name @@ -9,6 +9,7 @@ param openaiLocation string = 'swedencentral' targetScope = 'subscription' output appUrl string = app.outputs.appUrl +output blobStoragePublicName string = app.outputs.blobStoragePublicName output communicationId string = app.outputs.communicationId var tags = {