diff --git a/.github/workflows/release-docker-image.yml b/.github/workflows/release-docker-image.yml index 575a063090..84edefbdb1 100644 --- a/.github/workflows/release-docker-image.yml +++ b/.github/workflows/release-docker-image.yml @@ -1,95 +1,95 @@ -name: Docker Image Build and Push - -on: - workflow_call: - inputs: - registry: - type: string - default: ghcr.io - image: - type: string - required: true - context: - type: string - required: true - dockerfile: - type: string - required: true - -jobs: - docker_image_build_and_push: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Fetching the Latest Release Tag number - id: releaseVersion - run: | - GIT_RELEASE=$(echo ${{ github.ref_name }} | cut -d'/' -f 2) - echo "GIT_RELEASE=$GIT_RELEASE" >> $GITHUB_ENV - echo "release_tag: Latest Tag is : $GIT_RELEASE" - echo "release_tag=$GIT_RELEASE" >> $GITHUB_OUTPUT - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: | - ghcr.io/${{ github.repository }}/${{ inputs.image }} - tags: | - type=semver,pattern={{version}},value=${{ steps.releaseVersion.outputs.release_tag }} - type=sha,format=long - - - name: Build and push Docker images - uses: docker/build-push-action@v5 - with: - context: ${{ inputs.context }} - file: ${{ inputs.dockerfile }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - push: true - build-args: | - FOUNDATIONALLM_VERSION=${{ steps.releaseVersion.outputs.release_tag }} - - helm_chart_package_and_push: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Fetching the Latest Release Tag number - id: releaseVersion - run: | - GIT_RELEASE=$(echo ${{ github.ref_name }} | cut -d'/' -f 2) - echo "GIT_RELEASE=$GIT_RELEASE" >> $GITHUB_ENV - echo "release_tag: Latest Tag is : $GIT_RELEASE" - echo "release_tag=$GIT_RELEASE" >> $GITHUB_OUTPUT - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Helm Chart Update, Package, and Push - run: | - cd ./deploy/common/helm/${{ inputs.image }} - sed -i "s/version\: 0\.0\.0/version\: ${{ steps.releaseVersion.outputs.release_tag }}/" Chart.yaml - sed -i "s/tag\: latest/tag\: ${{ steps.releaseVersion.outputs.release_tag }}/" values.yaml - helm package . --app-version ${{ steps.releaseVersion.outputs.release_tag }} +name: Docker Image Build and Push + +on: + workflow_call: + inputs: + registry: + type: string + default: ghcr.io + image: + type: string + required: true + context: + type: string + required: true + dockerfile: + type: string + required: true + +jobs: + docker_image_build_and_push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Fetching the Latest Release Tag number + id: releaseVersion + run: | + GIT_RELEASE=$(echo ${{ github.ref_name }} | cut -d'/' -f 2) + echo "GIT_RELEASE=$GIT_RELEASE" >> $GITHUB_ENV + echo "release_tag: Latest Tag is : $GIT_RELEASE" + echo "release_tag=$GIT_RELEASE" >> $GITHUB_OUTPUT + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/${{ github.repository }}/${{ inputs.image }} + tags: | + type=semver,pattern={{version}},value=${{ steps.releaseVersion.outputs.release_tag }} + type=sha,format=long + + - name: Build and push Docker images + uses: docker/build-push-action@v5 + with: + context: ${{ inputs.context }} + file: ${{ inputs.dockerfile }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + push: true + build-args: | + FOUNDATIONALLM_VERSION=${{ steps.releaseVersion.outputs.release_tag }} + + helm_chart_package_and_push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Fetching the Latest Release Tag number + id: releaseVersion + run: | + GIT_RELEASE=$(echo ${{ github.ref_name }} | cut -d'/' -f 2) + echo "GIT_RELEASE=$GIT_RELEASE" >> $GITHUB_ENV + echo "release_tag: Latest Tag is : $GIT_RELEASE" + echo "release_tag=$GIT_RELEASE" >> $GITHUB_OUTPUT + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Helm Chart Update, Package, and Push + run: | + cd ./deploy/common/helm/${{ inputs.image }} + sed -i "s/version\: 0\.0\.0/version\: ${{ steps.releaseVersion.outputs.release_tag }}/" Chart.yaml + sed -i "s/tag\: latest/tag\: ${{ steps.releaseVersion.outputs.release_tag }}/" values.yaml + helm package . --app-version ${{ steps.releaseVersion.outputs.release_tag }} helm push ${{ inputs.image }}-${{ steps.releaseVersion.outputs.release_tag }}.tgz oci://ghcr.io/${{ github.repository }}/helm \ No newline at end of file diff --git a/deploy/standard/bicep/ops-rg.bicep b/deploy/standard/bicep/ops-rg.bicep index 76abab415a..399e04ca1e 100644 --- a/deploy/standard/bicep/ops-rg.bicep +++ b/deploy/standard/bicep/ops-rg.bicep @@ -1,275 +1,275 @@ -/** Inputs **/ -@description('Administrator Object Id') -param administratorObjectId string - -@description('Administrator principal type.') -param administratorPrincipalType string = 'Group' - -@description('DNS Resource Group Name') -param dnsResourceGroupName string - -@description('The environment name token used in naming resources.') -param environmentName string - -@description('Location used for all resources.') -param location string - -@description('Project Name, used in naming resources.') -param project string - -@description('Timestamp used in naming nested deployments.') -param timestamp string = utcNow() - -@description('Virtual Network ID, used to find the subnet IDs.') -param vnetId string - -/** Locals **/ -@description('Formatted untruncated resource name') -var kvFormattedName = toLower('${kvServiceType}-${substring(kvResourceSuffix, 0, length(kvResourceSuffix) - 4)}') - -@description('The Resource Name') -var kvTruncatedName = substring(kvFormattedName,0,min([length(kvFormattedName),20])) -var kvName = '${kvTruncatedName}-${substring(kvResourceSuffix, length(kvResourceSuffix) - 3, 3)}' - -@description('KeyVault resource suffix') -var kvResourceSuffix = resourceSuffix - -@description('The Resource Service Type token') -var kvServiceType = 'kv' - -@description('Resource Suffix used in naming resources.') -var resourceSuffix = '${project}-${environmentName}-${location}-${workload}' - -@description('Tags for all resources') -var tags = { - Environment: environmentName - IaC: 'Bicep' - Project: project - Purpose: 'DevOps' -} - -@description('Workload Token used in naming resources.') -var workload = 'ops' - -@description('Private DNS Zones for Azure Monitor Private Link Scope') -var zonesAmpls = filter( - dnsZones.outputs.ids, - (zone) => contains([ 'monitor', 'blob', 'ods', 'oms', 'agentsvc' ], zone.key) -) - -@description('Private DNS Zones for Container Registry') -var zonesRegistry = filter( - dnsZones.outputs.ids, - (zone) => contains([ 'cr', 'cr_region' ], zone.key) -) - -@description('Private DNS Zones for Storage Accounts') -var zonesStorage = filter( - dnsZones.outputs.ids, - (zone) => contains([ 'blob', 'dfs', 'file', 'queue', 'table', 'web' ], zone.key) -) - -/** Outputs **/ -@description('Azure Monitor Action Group') -output actionGroupId string = actionGroup.outputs.id - -@description('Log Analytics Workspace') -output logAnalyticsWorkspaceId string = logAnalytics.outputs.id - -/** Resources **/ -@description('User Assigned Identity for App Configuration') -resource uaiAppConfig 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = { - location: location - name: 'uai-appconfig-${resourceSuffix}' - tags: tags -} - -/** Modules **/ -@description('Read DNS Zones') -module dnsZones 'modules/utility/dnsZoneData.bicep' = { - name: 'dnsZones-${timestamp}' - scope: resourceGroup(dnsResourceGroupName) - params: { - location: location - } -} - -@description('Azure Monitor Action Group') -module actionGroup 'modules/actionGroup.bicep' = { - name: 'actionGroup-${timestamp}' - params: { - environmentName: environmentName - project: project - resourceSuffix: resourceSuffix - } -} - -@description('Azure Monitor Private Link Scope') -module ampls 'modules/ampls.bicep' = { - name: 'ampls-${timestamp}' - params: { - environmentName: environmentName - location: location - privateDnsZones: zonesAmpls - project: project - resourceSuffix: resourceSuffix - subnetId: '${vnetId}/subnets/ops' - } -} - -@description('App Configuration') -module appConfig 'modules/appConfig.bicep' = { - dependsOn: [ uaiAppConfigRoleAssignments ] - name: 'appConfig-${timestamp}' - params: { - administratorObjectId: administratorObjectId - administratorPrincipalType: administratorPrincipalType - actionGroupId: actionGroup.outputs.id - location: location - logAnalyticWorkspaceId: logAnalytics.outputs.id - privateDnsZones: filter(dnsZones.outputs.ids, (zone) => zone.key == 'configuration_stores') - resourceSuffix: resourceSuffix - subnetId: '${vnetId}/subnets/ops' - tags: tags - uaiId: uaiAppConfig.id - vaultName: keyVault.outputs.name - } -} - -@description('Application Insights') -module applicationInights 'modules/applicationInsights.bicep' = { - name: 'appInsights-${timestamp}' - params: { - amplsName: ampls.outputs.name - environmentName: environmentName - location: location - logAnalyticWorkspaceId: logAnalytics.outputs.id - project: project - resourceSuffix: resourceSuffix - tags: tags - } - dependsOn: [ keyVault ] -} - -@description('Azure Container Registry') -module containerRegistry 'modules/containerRegistry.bicep' = { - name: 'containerRegistry-${timestamp}' - params: { - agentPoolSubnetId: '${vnetId}/subnets/ops' - location: location - logAnalyticWorkspaceId: logAnalytics.outputs.id - privateDnsZones: zonesRegistry - resourceSuffix: resourceSuffix - subnetId: '${vnetId}/subnets/ops' - tags: tags - } -} - -// @description('Azure Managed Grafana') -// module grafana 'modules/grafana.bicep' = { -// name: 'grafana-${timestamp}' -// params: { -// azureMonitorWorkspaceResourceId: monitorWorkspace.outputs.id -// location: location -// privateDnsZones: filter(privateDnsZones, (zone) => zone.key == 'grafana') -// resourceSuffix: resourceSuffix -// subnetId: '${vnetId}/subnets/ops' -// tags: tags -// } -// } - -@description('Key Vault') -module keyVault 'modules/keyVault.bicep' = { - name: 'keyVault-${timestamp}' - params: { - actionGroupId: actionGroup.outputs.id - administratorObjectId: administratorObjectId - administratorPrincipalType: administratorPrincipalType - allowAzureServices: false - location: location - logAnalyticWorkspaceId: logAnalytics.outputs.id - privateDnsZones: filter(dnsZones.outputs.ids, (zone) => zone.key == 'vault') - resourceSuffix: resourceSuffix - subnetId: '${vnetId}/subnets/ops' - tags: tags - } -} - -@description('Log Analytics') -module logAnalytics 'modules/logAnalytics.bicep' = { - name: 'logAnalytics-${timestamp}' - params: { - actionGroupId: actionGroup.outputs.id - environmentName: environmentName - location: location - project: project - resourceSuffix: resourceSuffix - - ampls: { - id: ampls.outputs.id - name: ampls.outputs.name - } - } -} - -@description('Azure Monitor Workspace') -module monitorWorkspace 'modules/monitorWorksapce.bicep' = { - name: 'monitorWorkspace-${timestamp}' - params: { - location: location - privateDnsZones: filter(dnsZones.outputs.ids, (zone) => zone.key == 'prometheusMetrics') - resourceSuffix: resourceSuffix - subnetId: '${vnetId}/subnets/ops' - tags: tags - } -} - -// See: https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles -module uaiAppConfigRoleAssignments 'modules/utility/roleAssignments.bicep' = { - name: 'uaiAppConfigRoleAssignments-${timestamp}' - params: { - principalId: uaiAppConfig.properties.principalId - roleDefinitionIds: { - 'Key Vault Crypto Service Encryption User': 'e147488a-f6f5-4113-8e2d-b22465e65bf6' - } - } -} - -@description('Storage Account') -module storage 'modules/storageAccount.bicep' = { - name: 'storage-${timestamp}' - params: { - actionGroupId: actionGroup.outputs.id - location: location - logAnalyticWorkspaceId: logAnalytics.outputs.id - privateDnsZones: zonesStorage - resourceSuffix: resourceSuffix - subnetId: '${vnetId}/subnets/ops' - tags: tags - } - dependsOn: [ keyVault ] -} - -@description('Placeholder configuration setting for CSV file') -module csvFileSecret 'modules/kvSecret.bicep' = { - name: 'csvFileSecret-${timestamp}' - params: { - kvName: kvName - secretName: 'foundationallm-langchain-csvfile-url' - secretValue: 'FIXME' - tags: tags - } - dependsOn: [ keyVault ] -} - -@description('Placeholder configuration setting for Test DB Password') -module dbPasswdSecret 'modules/kvSecret.bicep' = { - name: 'dbPasswdSecret-${timestamp}' - params: { - kvName: kvName - secretName: 'foundationallm-langchain-sqldatabase-testdb-password' - secretValue: 'FIXME' - tags: tags - } - dependsOn: [ keyVault ] -} +/** Inputs **/ +@description('Administrator Object Id') +param administratorObjectId string + +@description('Administrator principal type.') +param administratorPrincipalType string = 'Group' + +@description('DNS Resource Group Name') +param dnsResourceGroupName string + +@description('The environment name token used in naming resources.') +param environmentName string + +@description('Location used for all resources.') +param location string + +@description('Project Name, used in naming resources.') +param project string + +@description('Timestamp used in naming nested deployments.') +param timestamp string = utcNow() + +@description('Virtual Network ID, used to find the subnet IDs.') +param vnetId string + +/** Locals **/ +@description('Formatted untruncated resource name') +var kvFormattedName = toLower('${kvServiceType}-${substring(kvResourceSuffix, 0, length(kvResourceSuffix) - 4)}') + +@description('The Resource Name') +var kvTruncatedName = substring(kvFormattedName,0,min([length(kvFormattedName),20])) +var kvName = '${kvTruncatedName}-${substring(kvResourceSuffix, length(kvResourceSuffix) - 3, 3)}' + +@description('KeyVault resource suffix') +var kvResourceSuffix = resourceSuffix + +@description('The Resource Service Type token') +var kvServiceType = 'kv' + +@description('Resource Suffix used in naming resources.') +var resourceSuffix = '${project}-${environmentName}-${location}-${workload}' + +@description('Tags for all resources') +var tags = { + Environment: environmentName + IaC: 'Bicep' + Project: project + Purpose: 'DevOps' +} + +@description('Workload Token used in naming resources.') +var workload = 'ops' + +@description('Private DNS Zones for Azure Monitor Private Link Scope') +var zonesAmpls = filter( + dnsZones.outputs.ids, + (zone) => contains([ 'monitor', 'blob', 'ods', 'oms', 'agentsvc' ], zone.key) +) + +@description('Private DNS Zones for Container Registry') +var zonesRegistry = filter( + dnsZones.outputs.ids, + (zone) => contains([ 'cr', 'cr_region' ], zone.key) +) + +@description('Private DNS Zones for Storage Accounts') +var zonesStorage = filter( + dnsZones.outputs.ids, + (zone) => contains([ 'blob', 'dfs', 'file', 'queue', 'table', 'web' ], zone.key) +) + +/** Outputs **/ +@description('Azure Monitor Action Group') +output actionGroupId string = actionGroup.outputs.id + +@description('Log Analytics Workspace') +output logAnalyticsWorkspaceId string = logAnalytics.outputs.id + +/** Resources **/ +@description('User Assigned Identity for App Configuration') +resource uaiAppConfig 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = { + location: location + name: 'uai-appconfig-${resourceSuffix}' + tags: tags +} + +/** Modules **/ +@description('Read DNS Zones') +module dnsZones 'modules/utility/dnsZoneData.bicep' = { + name: 'dnsZones-${timestamp}' + scope: resourceGroup(dnsResourceGroupName) + params: { + location: location + } +} + +@description('Azure Monitor Action Group') +module actionGroup 'modules/actionGroup.bicep' = { + name: 'actionGroup-${timestamp}' + params: { + environmentName: environmentName + project: project + resourceSuffix: resourceSuffix + } +} + +@description('Azure Monitor Private Link Scope') +module ampls 'modules/ampls.bicep' = { + name: 'ampls-${timestamp}' + params: { + environmentName: environmentName + location: location + privateDnsZones: zonesAmpls + project: project + resourceSuffix: resourceSuffix + subnetId: '${vnetId}/subnets/ops' + } +} + +@description('App Configuration') +module appConfig 'modules/appConfig.bicep' = { + dependsOn: [ uaiAppConfigRoleAssignments ] + name: 'appConfig-${timestamp}' + params: { + administratorObjectId: administratorObjectId + administratorPrincipalType: administratorPrincipalType + actionGroupId: actionGroup.outputs.id + location: location + logAnalyticWorkspaceId: logAnalytics.outputs.id + privateDnsZones: filter(dnsZones.outputs.ids, (zone) => zone.key == 'configuration_stores') + resourceSuffix: resourceSuffix + subnetId: '${vnetId}/subnets/ops' + tags: tags + uaiId: uaiAppConfig.id + vaultName: keyVault.outputs.name + } +} + +@description('Application Insights') +module applicationInights 'modules/applicationInsights.bicep' = { + name: 'appInsights-${timestamp}' + params: { + amplsName: ampls.outputs.name + environmentName: environmentName + location: location + logAnalyticWorkspaceId: logAnalytics.outputs.id + project: project + resourceSuffix: resourceSuffix + tags: tags + } + dependsOn: [ keyVault ] +} + +@description('Azure Container Registry') +module containerRegistry 'modules/containerRegistry.bicep' = { + name: 'containerRegistry-${timestamp}' + params: { + agentPoolSubnetId: '${vnetId}/subnets/ops' + location: location + logAnalyticWorkspaceId: logAnalytics.outputs.id + privateDnsZones: zonesRegistry + resourceSuffix: resourceSuffix + subnetId: '${vnetId}/subnets/ops' + tags: tags + } +} + +// @description('Azure Managed Grafana') +// module grafana 'modules/grafana.bicep' = { +// name: 'grafana-${timestamp}' +// params: { +// azureMonitorWorkspaceResourceId: monitorWorkspace.outputs.id +// location: location +// privateDnsZones: filter(privateDnsZones, (zone) => zone.key == 'grafana') +// resourceSuffix: resourceSuffix +// subnetId: '${vnetId}/subnets/ops' +// tags: tags +// } +// } + +@description('Key Vault') +module keyVault 'modules/keyVault.bicep' = { + name: 'keyVault-${timestamp}' + params: { + actionGroupId: actionGroup.outputs.id + administratorObjectId: administratorObjectId + administratorPrincipalType: administratorPrincipalType + allowAzureServices: true + location: location + logAnalyticWorkspaceId: logAnalytics.outputs.id + privateDnsZones: filter(dnsZones.outputs.ids, (zone) => zone.key == 'vault') + resourceSuffix: resourceSuffix + subnetId: '${vnetId}/subnets/ops' + tags: tags + } +} + +@description('Log Analytics') +module logAnalytics 'modules/logAnalytics.bicep' = { + name: 'logAnalytics-${timestamp}' + params: { + actionGroupId: actionGroup.outputs.id + environmentName: environmentName + location: location + project: project + resourceSuffix: resourceSuffix + + ampls: { + id: ampls.outputs.id + name: ampls.outputs.name + } + } +} + +@description('Azure Monitor Workspace') +module monitorWorkspace 'modules/monitorWorksapce.bicep' = { + name: 'monitorWorkspace-${timestamp}' + params: { + location: location + privateDnsZones: filter(dnsZones.outputs.ids, (zone) => zone.key == 'prometheusMetrics') + resourceSuffix: resourceSuffix + subnetId: '${vnetId}/subnets/ops' + tags: tags + } +} + +// See: https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles +module uaiAppConfigRoleAssignments 'modules/utility/roleAssignments.bicep' = { + name: 'uaiAppConfigRoleAssignments-${timestamp}' + params: { + principalId: uaiAppConfig.properties.principalId + roleDefinitionIds: { + 'Key Vault Crypto Service Encryption User': 'e147488a-f6f5-4113-8e2d-b22465e65bf6' + } + } +} + +@description('Storage Account') +module storage 'modules/storageAccount.bicep' = { + name: 'storage-${timestamp}' + params: { + actionGroupId: actionGroup.outputs.id + location: location + logAnalyticWorkspaceId: logAnalytics.outputs.id + privateDnsZones: zonesStorage + resourceSuffix: resourceSuffix + subnetId: '${vnetId}/subnets/ops' + tags: tags + } + dependsOn: [ keyVault ] +} + +@description('Placeholder configuration setting for CSV file') +module csvFileSecret 'modules/kvSecret.bicep' = { + name: 'csvFileSecret-${timestamp}' + params: { + kvName: kvName + secretName: 'foundationallm-langchain-csvfile-url' + secretValue: 'FIXME' + tags: tags + } + dependsOn: [ keyVault ] +} + +@description('Placeholder configuration setting for Test DB Password') +module dbPasswdSecret 'modules/kvSecret.bicep' = { + name: 'dbPasswdSecret-${timestamp}' + params: { + kvName: kvName + secretName: 'foundationallm-langchain-sqldatabase-testdb-password' + secretValue: 'FIXME' + tags: tags + } + dependsOn: [ keyVault ] +} diff --git a/deploy/starter/azd-hooks/postprovision.sh b/deploy/starter/azd-hooks/postprovision.sh index fa81824fe1..afee6a7580 100755 --- a/deploy/starter/azd-hooks/postprovision.sh +++ b/deploy/starter/azd-hooks/postprovision.sh @@ -30,26 +30,7 @@ export FOUNDATIONALLM_VECTORIZATION_WORKER_EVENT_GRID_PROFILE=`cat ./config/vect envsubst < ./config/appconfig.template.json > ./config/appconfig.json -jq -c '.[]' ./config/appconfig.json | while read i; do - keyVault=`echo $i | jq '.keyVault'` - featureFlag=`echo $i | jq '.featureFlag'` - isJson=`echo $i | jq '.isJson'` - key=`echo $i | jq -r '.key'` - value=`echo $i | jq -r '.value'` - - if [ $keyVault == 'true' ]; then - cmd="az appconfig kv set-keyvault --key $key --name $AZURE_APP_CONFIG_NAME --secret-identifier ${AZURE_KEY_VAULT_ENDPOINT}secrets/$value --yes" - elif [ $featureFlag == 'true' ]; then - cmd="az appconfig feature set --feature $value --key $key --name $AZURE_APP_CONFIG_NAME --yes" - elif [ $isJson == 'true' ]; then - cmd="az appconfig kv set --key $key --name $AZURE_APP_CONFIG_NAME --content-type application/json --yes --value '$value'" - else - cmd="az appconfig kv set --key $key --name $AZURE_APP_CONFIG_NAME --value '$value' --yes" - fi - - echo $cmd - eval $cmd public const string FoundationaLLM_LangChain_SQLDatabase_Testdb_Password = "foundationallm-langchain-sqldatabase-testdb-password"; /// - /// The foundationallm-langchainapi-key Key Vault secret name. - /// - public const string FoundationaLLM_LangChainAPI_Key = "foundationallm-langchainapi-key"; - /// /// The foundationallm-management-entra-clientsecret Key Vault secret name. /// public const string FoundationaLLM_Management_Entra_ClientSecret = "foundationallm-management-entra-clientsecret"; diff --git a/src/dotnet/Configuration/Catalog/AppConfigurationCatalog.cs b/src/dotnet/Configuration/Catalog/AppConfigurationCatalog.cs index d42ae81f3f..c789809f6e 100644 --- a/src/dotnet/Configuration/Catalog/AppConfigurationCatalog.cs +++ b/src/dotnet/Configuration/Catalog/AppConfigurationCatalog.cs @@ -1421,9 +1421,9 @@ public static class AppConfigurationCatalog new( key: Common.Constants.AppConfigurationKeys.FoundationaLLM_LangChainAPI_Key, minimumVersion: "0.3.0", - defaultValue: "Key Vault secret name: `foundationallm-langchainapi-key`", + defaultValue: "Key Vault secret name: `foundationallm-apis-langchainapi-apikey`", description: "This is a Key Vault reference.", - keyVaultSecretName: Common.Constants.KeyVaultSecretNames.FoundationaLLM_LangChainAPI_Key, + keyVaultSecretName: Common.Constants.KeyVaultSecretNames.FoundationaLLM_APIs_LangChainAPI_APIKey, contentType: "text/plain", sampleObject: null ) diff --git a/src/dotnet/Configuration/Catalog/KeyVaultSecretsCatalog.cs b/src/dotnet/Configuration/Catalog/KeyVaultSecretsCatalog.cs index 6c5565b37c..9e9e55d7f8 100644 --- a/src/dotnet/Configuration/Catalog/KeyVaultSecretsCatalog.cs +++ b/src/dotnet/Configuration/Catalog/KeyVaultSecretsCatalog.cs @@ -180,11 +180,6 @@ public static class KeyVaultSecretsCatalog minimumVersion: "0.3.0", description: "" ), - new( - secretName: Common.Constants.KeyVaultSecretNames.FoundationaLLM_LangChainAPI_Key, - minimumVersion: "0.3.0", - description: "" - ), new( secretName: Common.Constants.KeyVaultSecretNames.FoundationaLLM_OpenAI_Api_Key, minimumVersion: "0.3.0", diff --git a/src/dotnet/CoreWorker/CoreWorker.csproj b/src/dotnet/CoreWorker/CoreWorker.csproj index 7c4875141f..5062858a27 100644 --- a/src/dotnet/CoreWorker/CoreWorker.csproj +++ b/src/dotnet/CoreWorker/CoreWorker.csproj @@ -14,7 +14,6 @@ - diff --git a/src/dotnet/CoreWorker/Program.cs b/src/dotnet/CoreWorker/Program.cs index b3c5f4242a..9432bcfe2a 100644 --- a/src/dotnet/CoreWorker/Program.cs +++ b/src/dotnet/CoreWorker/Program.cs @@ -1,12 +1,9 @@ using Azure.Identity; -using Azure.Monitor.OpenTelemetry.AspNetCore; using FoundationaLLM.Common.Constants; using FoundationaLLM.Core.Interfaces; using FoundationaLLM.Core.Models.Configuration; using FoundationaLLM.Core.Services; using FoundationaLLM.Core.Worker; -using OpenTelemetry.Resources; -using OpenTelemetry.Trace; var builder = Host.CreateApplicationBuilder(args); @@ -32,25 +29,11 @@ builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddHostedService(); - -// Add the OpenTelemetry telemetry service and send telemetry data to Azure Monitor. -builder.Services.AddOpenTelemetry().UseAzureMonitor(options => +builder.Services.AddApplicationInsightsTelemetryWorkerService(options => { options.ConnectionString = builder.Configuration[AppConfigurationKeys.FoundationaLLM_CoreWorker_AppInsightsConnectionString]; }); -// Create a dictionary of resource attributes. -var resourceAttributes = new Dictionary { - { "service.name", "CoreWorker" }, - { "service.namespace", "FoundationaLLM" }, - { "service.instance.id", Guid.NewGuid().ToString() } -}; - -// Configure the OpenTelemetry tracer provider to add the resource attributes to all traces. -builder.Services.ConfigureOpenTelemetryTracerProvider((sp, builder) => - builder.ConfigureResource(resourceBuilder => - resourceBuilder.AddAttributes(resourceAttributes))); - var host = builder.Build(); host.Run(); diff --git a/src/dotnet/CoreWorker/Properties/launchSettings.json b/src/dotnet/CoreWorker/Properties/launchSettings.json index 09702813c7..1b37cb386d 100644 --- a/src/dotnet/CoreWorker/Properties/launchSettings.json +++ b/src/dotnet/CoreWorker/Properties/launchSettings.json @@ -3,7 +3,8 @@ "CoreWorker": { "commandName": "Project", "environmentVariables": { - "DOTNET_ENVIRONMENT": "Development" + "DOTNET_ENVIRONMENT": "Development", + "HOSTNAME": "CoreWorker" }, "dotnetRunMessages": true }, diff --git a/src/dotnet/VectorizationAPI/Properties/launchSettings.json b/src/dotnet/VectorizationAPI/Properties/launchSettings.json index 39e3603d0f..a64fd5a334 100644 --- a/src/dotnet/VectorizationAPI/Properties/launchSettings.json +++ b/src/dotnet/VectorizationAPI/Properties/launchSettings.json @@ -5,7 +5,8 @@ "launchBrowser": true, "launchUrl": "swagger", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", + "HOSTNAME": "VectorizationAPI" }, "dotnetRunMessages": true, "applicationUrl": "http://localhost:5144" @@ -15,7 +16,8 @@ "launchBrowser": true, "launchUrl": "swagger", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", + "HOSTNAME": "VectorizationAPI" }, "dotnetRunMessages": true, "applicationUrl": "https://localhost:7047;http://localhost:5144" @@ -25,7 +27,8 @@ "launchBrowser": true, "launchUrl": "swagger", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", + "HOSTNAME": "VectorizationAPI" } }, "Docker": { @@ -34,7 +37,8 @@ "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", "environmentVariables": { "ASPNETCORE_HTTPS_PORTS": "8081", - "ASPNETCORE_HTTP_PORTS": "8080" + "ASPNETCORE_HTTP_PORTS": "8080", + "HOSTNAME": "VectorizationAPI" }, "publishAllPorts": true, "useSSL": true @@ -49,4 +53,4 @@ "sslPort": 44354 } } -} \ No newline at end of file +} diff --git a/src/dotnet/VectorizationWorker/Properties/launchSettings.json b/src/dotnet/VectorizationWorker/Properties/launchSettings.json index cc807522a4..705be2081d 100644 --- a/src/dotnet/VectorizationWorker/Properties/launchSettings.json +++ b/src/dotnet/VectorizationWorker/Properties/launchSettings.json @@ -3,12 +3,10 @@ "VectorizationWorker": { "commandName": "Project", "environmentVariables": { - "DOTNET_ENVIRONMENT": "Development" + "DOTNET_ENVIRONMENT": "Development", + "HOSTNAME": "VectorizationWorker" }, "dotnetRunMessages": true - }, - "Docker": { - "commandName": "Docker" } } -} \ No newline at end of file +}