Skip to content

Commit 6bbd57f

Browse files
committed
README split to allow multi deployment guidance
1 parent 84a4291 commit 6bbd57f

18 files changed

+511
-486
lines changed

README.md

Lines changed: 10 additions & 453 deletions
Large diffs are not rendered by default.

app/frontend/.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
manifests
1+
manifests
2+
node_modules

deploy/aca/scripts/start-compose.ps1 renamed to app/start-compose.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ Write-Host ""
5353
Write-Host "Starting solution locally using docker compose."
5454
Write-Host ""
5555

56-
docker compose -f ../../../app/compose.yaml up
56+
docker compose -f ./compose.yaml up

deploy/aca/scripts/start-compose.sh renamed to app/start-compose.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ echo ""
6060
echo "Starting solution locally using docker compose. "
6161
echo ""
6262

63-
docker compose -f ../../../app/compose.yaml up
63+
docker compose -f ./compose.yaml up

deploy/aca/infra/main.bicep

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ param storageResourceGroupLocation string = location
3434
param storageContainerName string = 'content'
3535
param storageSkuName string // Set in main.parameters.json
3636

37-
@allowed(['azure', 'openai'])
38-
param openAiHost string // Set in main.parameters.json
37+
3938

4039
param openAiServiceName string = ''
4140
param openAiResourceGroupName string = ''
@@ -194,7 +193,7 @@ module api './app/api.bicep' = {
194193
}
195194
{
196195
name: 'AZURE_OPENAI_SERVICE'
197-
value: openAiHost == 'azure' ? openAi.outputs.name : ''
196+
value: openAi.outputs.name
198197
}
199198
{
200199
name: 'AZURE_OPENAI_CHATGPT_DEPLOYMENT'
@@ -251,7 +250,7 @@ module indexer './app/indexer.bicep' = {
251250

252251
{
253252
name: 'AZURE_OPENAI_SERVICE'
254-
value: openAiHost == 'azure' ? openAi.outputs.name : ''
253+
value: openAi.outputs.name
255254
}
256255

257256
{
@@ -287,7 +286,7 @@ module web './app/web.bicep' = {
287286
}
288287

289288

290-
module openAi '../../shared/ai/cognitiveservices.bicep' = if (openAiHost == 'azure') {
289+
module openAi '../../shared/ai/cognitiveservices.bicep' = {
291290
name: 'openai'
292291
scope: openAiResourceGroup
293292
params: {
@@ -410,7 +409,7 @@ module eventGridSubscription '../../shared/event/eventgrid.bicep' = {
410409
}
411410

412411
// USER ROLES
413-
module openAiRoleUser '../../shared/security/role.bicep' = if (openAiHost == 'azure') {
412+
module openAiRoleUser '../../shared/security/role.bicep' = {
414413
scope: openAiResourceGroup
415414
name: 'openai-role-user'
416415
params: {
@@ -482,7 +481,7 @@ module searchSvcContribRoleUser '../../shared/security/role.bicep' = {
482481

483482
// SYSTEM IDENTITIES
484483

485-
module openAiRoleBackend '../../shared/security/role.bicep' = if (openAiHost == 'azure') {
484+
module openAiRoleBackend '../../shared/security/role.bicep' = {
486485
scope: openAiResourceGroup
487486
name: 'openai-role-backend'
488487
params: {
@@ -579,17 +578,17 @@ output AZURE_CONTAINER_REGISTRY_ENDPOINT string = containerApps.outputs.registry
579578
output AZURE_CONTAINER_REGISTRY_NAME string = containerApps.outputs.registryName
580579

581580
// Shared by all OpenAI deployments
582-
output OPENAI_HOST string = openAiHost
581+
583582
output AZURE_OPENAI_EMB_MODEL_NAME string = embeddingModelName
584583
output AZURE_OPENAI_CHATGPT_MODEL string = chatGptModelName
585584
// Specific to Azure OpenAI
586-
output AZURE_OPENAI_SERVICE string = (openAiHost == 'azure') ? openAi.outputs.name : ''
587-
output AZURE_OPENAI_RESOURCE_GROUP string = (openAiHost == 'azure') ? openAiResourceGroup.name : ''
588-
output AZURE_OPENAI_CHATGPT_DEPLOYMENT string = (openAiHost == 'azure') ? chatGptDeploymentName : ''
589-
output AZURE_OPENAI_EMB_DEPLOYMENT string = (openAiHost == 'azure') ? embeddingDeploymentName : ''
585+
output AZURE_OPENAI_SERVICE string = openAi.outputs.name
586+
output AZURE_OPENAI_RESOURCE_GROUP string = openAiResourceGroup.name
587+
output AZURE_OPENAI_CHATGPT_DEPLOYMENT string = chatGptDeploymentName
588+
output AZURE_OPENAI_EMB_DEPLOYMENT string = embeddingDeploymentName
590589
// Used only with non-Azure OpenAI deployments
591-
output OPENAI_API_KEY string = (openAiHost == 'openai') ? openAiApiKey : ''
592-
output OPENAI_ORGANIZATION string = (openAiHost == 'openai') ? openAiApiOrganization : ''
590+
output OPENAI_API_KEY string = openAiApiKey
591+
output OPENAI_ORGANIZATION string = openAiApiOrganization
593592

594593
output AZURE_FORMRECOGNIZER_SERVICE string = formRecognizer.outputs.name
595594
output AZURE_FORMRECOGNIZER_RESOURCE_GROUP string = formRecognizerResourceGroup.name

docs/aca/README-ACA.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ All prerequisites are already installed in the container. You can skip to the [
7878
* **Important**: Ensure you can run `pwsh.exe` from a PowerShell command. If this fails, you likely need to upgrade PowerShell.
7979

8080

81-
>NOTE: Your Azure Account must have `Microsoft.Authorization/roleAssignments/write` permissions, such as [User Access Administrator](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#user-access-administrator) or [Owner](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#owner).
81+
>[!WARNING] Your Azure Account must have `Microsoft.Authorization/roleAssignments/write` permissions, such as [User Access Administrator](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#user-access-administrator) or [Owner](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#owner).
8282
8383
### Starting from scratch
8484

8585
You can clone this repo and change directory to the root of the repo. Or you can run `azd init -t Azure-Samples/azure-search-openai-demo-java`.
8686

8787
Once you have the project available locally, run the following commands if you don't have any pre-existing Azure services and want to start from a fresh deployment.
8888
> [!IMPORTANT]
89-
> All the commands below assume be run from the `deploy/aca` folder
89+
> All the commands below must be run from the `deploy/aca` folder
9090
9191
1. Run
9292

@@ -103,13 +103,13 @@ Once you have the project available locally, run the following commands if you d
103103
* This will provision Azure resources and deploy this sample to those resources, including building the search index based on the files found in the `./data` folder.
104104
* For the target location, the regions that currently support the models used in this sample are **East US**, **France Central**, **South Central US**, **UK South**, and **West Europe**. For an up-to-date list of regions and models, check [here](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models)
105105

106-
3. After the application has been successfully deployed you will see a frontend app URL printed to the console. Click that URL to interact with the application in your browser.
106+
3. After the application has been successfully deployed you will see a web app URL printed to the console. Click that URL to interact with the application in your browser.
107107

108108
It will look like the following:
109109

110-
!['Output from running azd up'](docs/endpoint.png)
110+
!['Output from running azd up'](aca-endpoint.png)
111111

112-
> NOTE: It may take a minute for the application to be fully deployed.
112+
> NOTE: It may take few minutes for the indexer app to consume the pdf ingestion request messages. You can monitor the ingestion process by checking the log stream of the indexer app in the Azure Portal.
113113

114114
### Deploying with existing Azure resources
115115

@@ -158,6 +158,19 @@ If you've changed the infrastructure files (`infra` folder or `azure.yaml`), the
158158
159159
```shell
160160
azd up
161+
```
162+
> WARNING: when you run `azd up` multiple times to redeploy infrastructure, make sure to set the following parameters in `infra/main.parameters.json` to `true` to avoid container apps images from being overridden with default "mcr.microsoft.com/azuredocs/containerapps-helloworld" image:
163+
164+
```json
165+
"apiAppExists": {
166+
"value": true
167+
},
168+
"webAppExists": {
169+
"value": true
170+
},
171+
"indexerAppExists": {
172+
"value": true
173+
}
161174
```
162175
163176
### Examples of an azd deployment changing the default chatgpt deployment model
@@ -203,7 +216,7 @@ azd up
203216
cd app
204217
```
205218
206-
3. Run the `./start.ps1` (Windows) or `./start.sh` (Linux/Mac) scripts or run the "VS Code Task: Start App" to start the project locally.
219+
3. Run the `./start-compose.ps1` (Windows) or `./start-compose.sh` (Linux/Mac) scripts or run the "VS Code Task: Start App" to start the project locally.
207220
4. Wait for the docker compose to start all the containers (web, api, indexer) and refresh your browser to [http://localhost](http://localhost)
208221
209222
### UI Navigation
@@ -242,7 +255,7 @@ To see the performance data, go to the Application Insights resource in your res
242255
To inspect the performance of chat requests, use the "Drill into Samples" button to see end-to-end traces of all the API calls made for any chat request.
243256
Under "Trace & Events" panel you can review custom Java informational logs to better understand content of OpenAI requests and responses.
244257

245-
![Tracing screenshot](docs/transaction-tracing.png)
258+
![Tracing screenshot](transaction-tracing.png)
246259

247260
To see any exceptions and server errors, navigate to the "Investigate -> Failures" blade and use the filtering tools to locate a specific exception. You can see Java stack traces on the right-hand side.
248261

@@ -396,12 +409,5 @@ Here are the most common failure scenarios and solutions:
396409
6. After running `./app/start.ps1` on Windows PowerShell you get `The file C:\path\to\azure-search-openai-demo-java\app\start.ps1 is not digitally signed. You cannot run this script on the current system`. Try to run `Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass` and try to re-run `./app/start.ps1`
397410
398411
7. After running `./app/start.ps1` or `./app/start.sh` you get `"Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project myproject: Fatal error compiling: invalid target release: 17"`. It means you are not using JDK 17 but a previous version. Be sure to set the `JAVA_HOME` env variable to your Java 17 installation directory and update your `PATH` env variable to have the Java 17 bin folder as the first occurrence amongst the listed directories. More info [here](https://learn.microsoft.com/en-us/java/openjdk/install)
399-
8. After running `./app/start.sh` on Ubuntu 16.04 or later, the first time you try to create a virtual environment with Python 3.6, Python 3.7, Python 3.8 or Python 3.9, you'll get the following error `"The virtual environment was not created successfully because ensurepip is not available"`. Just follow the hint provided in the error message and run `apt-get install python3-venv` to install the missing packages. More info [here](https://www.softwarepragmatism.com/cannot-create-a-python-virtual-environment-on-ubuntu-ensurepip-is-not-available)
400-
9. While running `azd up` in VS Code Dev Containers you got this error `".. Maven: failed finding mvnw in repository path: exec: /azure-search-openai-demo-java/app/backend/mvnw: permission denied "`. Run `chmod +x ./azure-search-openai-demo-javaapp/backend/mvnw` to fix it and rerun `azd up`.
401-
10. Github App CI pipeline might fail in some scenarios where the provisioned App Service instance doesn't have "Basic Auth Publishing Credentials" enabled in your subscription. To fix it, you can go to your App Service instance in Azure Portal, click on "Settings/Configuration(Panel)->General Settins (Tab)" and flag to ON the "Basic Auth Publishing Credentials" checkbox group. Or you can run the following azd cli commands:
402412
403-
```
404-
az resource update --resource-group <resource-group> --name ftp --namespace Microsoft.Web --resource-type basicPublishingCredentialsPolicies --parent sites/<site-name> --set properties.allow=true
405-
az resource update --resource-group <resource-group> --name scm --namespace Microsoft.Web --resource-type basicPublishingCredentialsPolicies --parent sites/<site-name> --set properties.allow=true
406-
```
407-
For more details see this [issue](https://github.com/Azure-Samples/azure-search-openai-demo-java/issues/7).
413+
8. While running `azd up` in VS Code Dev Containers you got this error `".. Maven: failed finding mvnw in repository path: exec: /azure-search-openai-demo-java/app/backend/mvnw: permission denied "`. Run `chmod +x ./azure-search-openai-demo-javaapp/backend/mvnw` to fix it and rerun `azd up`.

docs/aca/aca-endpoint.png

120 KB
Loading

docs/aca/transaction-tracing.png

111 KB
Loading

docs/aks/README-AKS.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ You can clone this repo and change directory to the root of the repo. Or you can
8888
Once you have the project available locally, run the following commands if you don't have any pre-existing Azure services and want to start from a fresh deployment.
8989

9090
> [!IMPORTANT]
91-
> All the commands below assume be run from the `deploy/aks` folder
91+
> All the commands below must be run from the `deploy/aks` folder
9292
9393
1. Run
9494

@@ -192,6 +192,22 @@ azd env set AZURE_SEARCH_SERVICE_LOCATION "eastus2" # Region of the ACS service
192192

193193
azd up
194194
```
195+
### Running locally
196+
197+
1. Run
198+
199+
```shell
200+
az login
201+
```
202+
203+
2. Change dir to `app`
204+
205+
```shell
206+
cd app
207+
```
208+
209+
3. Run the `./start-compose.ps1` (Windows) or `./start-compose.sh` (Linux/Mac) scripts or run the "VS Code Task: Start App" to start the project locally.
210+
4. Wait for the docker compose to start all the containers (web, api, indexer) and refresh your browser to [http://localhost](http://localhost)
195211

196212
### UI Navigation
197213

0 commit comments

Comments
 (0)