-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added production deployment section on README.md
- Loading branch information
1 parent
e263577
commit 99cd148
Showing
5 changed files
with
122 additions
and
0 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
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,51 @@ | ||
services: | ||
frontend: | ||
image: ai-chat-reference-java/frontend | ||
build: ./frontend | ||
environment: | ||
REACT_APP_API_BASE_URL: "http://backend:8080" | ||
ports: | ||
- "80:80" | ||
backend: | ||
image: ai-chat-reference-java/backend | ||
build: ./backend | ||
environment: | ||
- AZURE_STORAGE_ACCOUNT=${AZURE_STORAGE_ACCOUNT} | ||
- AZURE_STORAGE_CONTAINER=${AZURE_STORAGE_CONTAINER} | ||
- AZURE_SEARCH_INDEX=${AZURE_SEARCH_INDEX} | ||
- AZURE_SEARCH_SERVICE=${AZURE_SEARCH_SERVICE} | ||
- AZURE_SEARCH_QUERY_LANGUAGE=${AZURE_SEARCH_QUERY_LANGUAGE} | ||
- AZURE_SEARCH_QUERY_SPELLER=${AZURE_SEARCH_QUERY_SPELLER} | ||
- AZURE_OPENAI_EMB_MODEL_NAME=${AZURE_OPENAI_EMB_MODEL_NAME} | ||
- AZURE_OPENAI_EMB_DEPLOYMENT=${AZURE_OPENAI_EMB_DEPLOYMENT} | ||
- AZURE_OPENAI_CHATGPT_MODEL=${AZURE_OPENAI_CHATGPT_MODEL} | ||
- AZURE_OPENAI_SERVICE=${AZURE_OPENAI_SERVICE} | ||
- AZURE_OPENAI_CHATGPT_DEPLOYMENT=${AZURE_OPENAI_CHATGPT_DEPLOYMENT} | ||
- spring_profiles_active=docker | ||
- AZURE_CLIENT_ID=${servicePrincipal} | ||
- AZURE_CLIENT_SECRET=${servicePrincipalPassword} | ||
- AZURE_TENANT_ID=${servicePrincipalTenant} | ||
ports: | ||
- "8080:8080" | ||
indexer: | ||
image: ai-chat-reference-java/indexer | ||
build: | ||
context: ./indexer | ||
dockerfile: microservice/Dockerfile | ||
environment: | ||
- AZURE_STORAGE_ACCOUNT=${AZURE_STORAGE_ACCOUNT} | ||
- AZURE_STORAGE_CONTAINER=${AZURE_STORAGE_CONTAINER} | ||
- AZURE_SEARCH_INDEX=${AZURE_SEARCH_INDEX} | ||
- AZURE_SEARCH_SERVICE=${AZURE_SEARCH_SERVICE} | ||
- AZURE_FORMRECOGNIZER_SERVICE=${AZURE_FORMRECOGNIZER_SERVICE} | ||
- AZURE_SEARCH_QUERY_SPELLER=${AZURE_SEARCH_QUERY_SPELLER} | ||
- AZURE_OPENAI_EMB_MODEL_NAME=${AZURE_OPENAI_EMB_MODEL_NAME} | ||
- AZURE_OPENAI_EMB_DEPLOYMENT=${AZURE_OPENAI_EMB_DEPLOYMENT} | ||
- AZURE_OPENAI_SERVICE=${AZURE_OPENAI_SERVICE} | ||
- AZURE_SERVICEBUS_NAMESPACE=${AZURE_SERVICEBUS_NAMESPACE} | ||
- spring_profiles_active=docker | ||
- SPRING_CONFIG_LOCATION=classpath:/local-dev.properties | ||
- AZURE_CLIENT_ID=${servicePrincipal} | ||
- AZURE_CLIENT_SECRET=${servicePrincipalPassword} | ||
- AZURE_TENANT_ID=${servicePrincipalTenant} | ||
|
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,63 @@ | ||
echo "" | ||
echo "Loading azd .env file from current environment" | ||
echo "" | ||
|
||
while IFS='=' read -r key value; do | ||
value=$(echo "$value" | sed 's/^"//' | sed 's/"$//') | ||
export "$key=$value" | ||
echo "export $key=$value" | ||
done <<EOF | ||
$(azd env get-values) | ||
EOF | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Failed to load environment variables from azd environment" | ||
exit $? | ||
fi | ||
|
||
echo "" | ||
echo "Checking Service Principal and get password" | ||
echo "" | ||
|
||
roles=( | ||
"5e0bd9bd-7b93-4f28-af87-19fc36ad61bd" | ||
"a97b65f3-24c7-4388-baec-2e87135dc908" | ||
"2a2b9908-6ea1-4ae2-8e65-a410df84e7d1" | ||
"ba92f5b4-2d11-453d-a403-e96b0029c9fe" | ||
"1407120a-92aa-4202-b7e9-c0e197c71c8f" | ||
"8ebe5a00-799e-43f5-93ac-243d3dce84a7" | ||
"7ca78c08-252a-4471-8644-bb5ff32d4ba0" | ||
"4f6d3b9b-027b-4f4c-9142-0e5a2a2247e0" | ||
) | ||
|
||
#Check if service principal exists | ||
export servicePrincipal=$(az ad sp list --display-name "azure-ai-chat-java-spi" --query [].appId --output tsv) | ||
|
||
if [ -z "$servicePrincipal" ]; then | ||
echo "Service principal not found. Creating service principal" | ||
export servicePrincipal=$(az ad sp create-for-rbac --name "azure-ai-chat-java-spi" --role reader --scopes /subscriptions/"$AZURE_SUBSCRIPTION_ID"/resourceGroups/"$AZURE_RESOURCE_GROUP" --query appId --output tsv) | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to create service principal" | ||
exit $? | ||
fi | ||
export servicePrincipalObjectId=$(az ad sp show --id "$servicePrincipal" --query id --output tsv) | ||
echo "Assigning Roles to service principal azure-ai-chat-java-spi with principal id:$servicePrincipal and object id[$servicePrincipalObjectId]" | ||
for role in "${roles[@]}"; do | ||
|
||
echo "Assigning Role[$role] to principal id[$servicePrincipal] for resource[/subscriptions/"$AZURE_SUBSCRIPTION_ID"/resourceGroups/"$AZURE_RESOURCE_GROUP"] " | ||
az role assignment create \ | ||
--role "$role" \ | ||
--assignee-object-id "$servicePrincipalObjectId" \ | ||
--scope /subscriptions/"$AZURE_SUBSCRIPTION_ID"/resourceGroups/"$AZURE_RESOURCE_GROUP" \ | ||
--assignee-principal-type ServicePrincipal | ||
done | ||
fi | ||
|
||
export servicePrincipalPassword=$(az ad sp credential reset --id "$servicePrincipal" --query password --output tsv) | ||
export servicePrincipalTenant=$(az ad sp show --id "$servicePrincipal" --query appOwnerOrganizationId --output tsv) | ||
|
||
echo "" | ||
echo "Starting solution locally using docker compose. " | ||
echo "" | ||
|
||
docker compose -f ./compose.yaml up |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.