Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/webapp/playwright/te…
Browse files Browse the repository at this point in the history
…st-1.39.0
  • Loading branch information
glahaye authored Oct 17, 2023
2 parents d251e1f + b3dad1b commit 47182c6
Show file tree
Hide file tree
Showing 6 changed files with 212 additions and 432 deletions.
27 changes: 7 additions & 20 deletions scripts/deploy/deploy-azure.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ param(
$ResourceGroup,

[string]
# Region to which to make the deployment (ignored when deploying to an existing resource group)
# Region to which to make the deployment
$Region = "southcentralus",

[string]
Expand All @@ -58,15 +58,11 @@ param(
# Azure AD cloud instance for authenticating users
$AzureAdInstance = "https://login.microsoftonline.com",

[ValidateSet("Volatile", "AzureCognitiveSearch", "Qdrant", "Postgres")]
[ValidateSet("AzureCognitiveSearch", "Qdrant")]
[string]
# What method to use to persist embeddings
$MemoryStore = "AzureCognitiveSearch",

[SecureString]
# Password for the Postgres database
$SqlAdminPassword,

[switch]
# Don't deploy Cosmos DB for chat storage - Use volatile memory instead
$NoCosmosDb,
Expand All @@ -80,26 +76,25 @@ param(
$DebugDeployment,

[switch]
# Switches on whether to deploy release packages
# Skip deployment of binary packages
$NoDeployPackage
)

# if AIService is AzureOpenAI
if ($AIService -eq "AzureOpenAI") {
# Both $AIEndpoint and $AIApiKey must be set
if ((!$AIEndpoint -and $AIApiKey) -or ($AIEndpoint -and !$AIApiKey)) {
Write-Error "When AIService is AzureOpenAI, when either AIEndpoint and AIApiKey are set then both must be set."
Write-Error "When AIService is AzureOpenAI, both AIEndpoint and AIApiKey must be set."
exit 1
}

# If both $AIEndpoint and $AIApiKey are not set, set $DeployAzureOpenAI to true and inform the user. Otherwise set $DeployAzureOpenAI to false and inform the user.
if (!$AIEndpoint -and !$AIApiKey) {
$DeployAzureOpenAI = $true
Write-Host "When AIService is AzureOpenAI and both AIEndpoint and AIApiKey are not set then a new Azure OpenAI resource will be created."
Write-Host "When AIService is AzureOpenAI and both AIEndpoint and AIApiKey are not set, then a new Azure OpenAI resource will be created."
}
else {
$DeployAzureOpenAI = $false
Write-Host "When AIService is AzureOpenAI and both AIEndpoint and AIApiKey are set, use the existing Azure OpenAI resource."
}
}

Expand All @@ -109,29 +104,21 @@ if ($AIService -eq "OpenAI" -and !$AIApiKey) {
exit 1
}

if ($MemoryStore -eq "Postgres" -and !$SqlAdminPassword) {
Write-Host "When MemoryStore is Postgres, SqlAdminPassword must be set"
exit 1
}

$jsonConfig = "
{
`\`"webAppServiceSku`\`": { `\`"value`\`": `\`"$WebAppServiceSku`\`" },
`\`"aiService`\`": { `\`"value`\`": `\`"$AIService`\`" },
`\`"aiApiKey`\`": { `\`"value`\`": `\`"$AIApiKey`\`" },
`\`"aiEndpoint`\`": { `\`"value`\`": `\`"$AIEndpoint`\`" },
`\`"deployWebApiPackage`\`": { `\`"value`\`": $(If (!($NoDeployPackage)) {"true"} Else {"false"}) },
`\`"deployMemoryPipelinePackage`\`": { `\`"value`\`": $(If (!($NoDeployPackage)) {"true"} Else {"false"}) },
`\`"deployWebSearcherPackage`\`": { `\`"value`\`": $(If (!($NoDeployPackage)) {"true"} Else {"false"}) },
`\`"deployPackages`\`": { `\`"value`\`": $(If ($NoDeployPackage) {"false"} Else {"true"}) },
`\`"azureAdInstance`\`": { `\`"value`\`": `\`"$AzureAdInstance`\`" },
`\`"azureAdTenantId`\`": { `\`"value`\`": `\`"$TenantId`\`" },
`\`"webApiClientId`\`": { `\`"value`\`": `\`"$BackendClientId`\`"},
`\`"frontendClientId`\`": { `\`"value`\`": `\`"$FrontendClientId`\`"},
`\`"deployNewAzureOpenAI`\`": { `\`"value`\`": $(If ($DeployAzureOpenAI) {"true"} Else {"false"}) },
`\`"memoryStore`\`": { `\`"value`\`": `\`"$MemoryStore`\`" },
`\`"deployCosmosDB`\`": { `\`"value`\`": $(If (!($NoCosmosDb)) {"true"} Else {"false"}) },
`\`"deploySpeechServices`\`": { `\`"value`\`": $(If (!($NoSpeechServices)) {"true"} Else {"false"}) },
`\`"sqlAdminPassword`\`": { `\`"value`\`": `\`"$(If ($SqlAdminPassword) {ConvertFrom-SecureString $SqlAdminPassword -AsPlainText} Else {$null})`\`" }
`\`"deploySpeechServices`\`": { `\`"value`\`": $(If (!($NoSpeechServices)) {"true"} Else {"false"}) }
}
"

Expand Down
22 changes: 3 additions & 19 deletions scripts/deploy/deploy-azure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ usage() {
echo " -i, --instance AZURE_AD_INSTANCE Azure AD cloud instance for authenticating users"
echo " (default: \"https://login.microsoftonline.com\")"
echo " -ms, --memory-store Method to use to persist embeddings. Valid values are"
echo " \"AzureCognitiveSearch\" (default), \"Qdrant\", \"Postgres\" and \"Volatile\""
echo " -sap, --sql-admin-password Password for the PostgreSQL Server admin user"
echo " \"AzureCognitiveSearch\" (default) and \"Qdrant\""
echo " -nc, --no-cosmos-db Don't deploy Cosmos DB for chat storage - Use volatile memory instead"
echo " -ns, --no-speech-services Don't deploy Speech Services to enable speech as chat input"
echo " -dd, --debug-deployment Switches on verbose template deployment output"
echo " -ndp, --no-deploy-package Skips deploying the Web API package when set."
echo " -ndp, --no-deploy-package Skips deploying binary packages to cloud when set."
}

# Parse arguments
Expand Down Expand Up @@ -98,11 +97,6 @@ while [[ $# -gt 0 ]]; do
MEMORY_STORE=="$2"
shift
;;
-sap | --sql-admin-password)
SQL_ADMIN_PASSWORD="$2"
shift
shift
;;
-nc | --no-cosmos-db)
NO_COSMOS_DB=true
shift
Expand Down Expand Up @@ -166,13 +160,6 @@ if [[ "${AI_SERVICE_TYPE,,}" = "openai" ]] && [[ -z "$AI_SERVICE_KEY" ]]; then
exit 1
fi

# If MEMORY_STORE is Postges, then SQL_ADMIN_PASSWORD is mandatory
if [[ "${MEMORY_STORE,,}" = "postgres" ]] && [[ -z "$SQL_ADMIN_PASSWORD" ]]; then
echo "When --memory-store is 'Postgres', --sql-admin-password must be set."
usage
exit 1
fi

# If resource group is not set, then set it to rg-DEPLOYMENT_NAME
if [ -z "$RESOURCE_GROUP" ]; then
RESOURCE_GROUP="rg-${DEPLOYMENT_NAME}"
Expand Down Expand Up @@ -203,17 +190,14 @@ JSON_CONFIG=$(
"webAppServiceSku": { "value": "$WEB_APP_SVC_SKU" },
"aiService": { "value": "$AI_SERVICE_TYPE" },
"aiApiKey": { "value": "$AI_SERVICE_KEY" },
"deployWebApiPackage": { "value": $([ "$NO_DEPLOY_PACKAGE" = true ] && echo "false" || echo "true") },
"deployMemoryPipelinePackage": { "value": $([ "$NO_DEPLOY_PACKAGE" = true ] && echo "false" || echo "true") },
"deployWebSearcherPackage": { "value": $([ "$NO_DEPLOY_PACKAGE" = true ] && echo "false" || echo "true") },
"deployPackages": { "value": $([ "$NO_DEPLOY_PACKAGE" = true ] && echo "false" || echo "true") },
"aiEndpoint": { "value": "$([ ! -z "$AI_ENDPOINT" ] && echo "$AI_ENDPOINT")" },
"azureAdInstance": { "value": "$AZURE_AD_INSTANCE" },
"azureAdTenantId": { "value": "$AZURE_AD_TENANT_ID" },
"webApiClientId": { "value": "$BACKEND_CLIENT_ID" },
"frontendClientId": { "value": "$FRONTEND_CLIENT_ID" },
"deployNewAzureOpenAI": { "value": $([ "$NO_NEW_AZURE_OPENAI" = true ] && echo "false" || echo "true") },
"memoryStore": { "value": "$MEMORY_STORE" },
"sqlAdminPassword": { "value": "$SQL_ADMIN_PASSWORD" },
"deployCosmosDB": { "value": $([ "$NO_COSMOS_DB" = true ] && echo "false" || echo "true") },
"deploySpeechServices": { "value": $([ "$NO_SPEECH_SERVICES" = true ] && echo "false" || echo "true") }
}
Expand Down
Loading

0 comments on commit 47182c6

Please sign in to comment.