You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -99,6 +101,8 @@ Once you've opened the project in [Codespaces](#github-codespaces), [Dev Contain
99
101
100
102
This will create a folder under `.azure/` in your project to store the configuration for this deployment. You may have multiple azd environments if desired.
101
103
104
+
3. (Optional) If you would like to customize the deployment to [use existing Azure resources](docs/deploy_existing.md), you can set the values now.
105
+
102
106
3. Provision the resources and deploy the code:
103
107
104
108
```shell
@@ -128,9 +132,9 @@ Since the local app uses OpenAI models, you should first deploy it for the optim
128
132
1. Run these commands to install the web app as a local package (named `fastapi_app`), set up the local database, and seed it with test data:
@@ -139,7 +143,7 @@ Since the local app uses OpenAI models, you should first deploy it for the optim
139
143
cd src/frontend
140
144
npm install
141
145
npm run build
142
-
cd ../..
146
+
cd ../../
143
147
```
144
148
145
149
There must be an initial build of static assets before running the backend, since the backend serves static files from the `src/static` directory.
@@ -173,12 +177,22 @@ You may try the [Azure pricing calculator](https://azure.microsoft.com/pricing/c
173
177
* Azure PostgreSQL Flexible Server: Burstable Tier with 1 CPU core, 32GB storage. Pricing is hourly. [Pricing](https://azure.microsoft.com/pricing/details/postgresql/flexible-server/)
174
178
* Azure Monitor: Pay-as-you-go tier. Costs based on data ingested. [Pricing](https://azure.microsoft.com/pricing/details/monitor/)
175
179
176
-
## Security Guidelines
180
+
## Security guidelines
177
181
178
182
This template uses [Managed Identity](https://learn.microsoft.com/entra/identity/managed-identities-azure-resources/overview) for authenticating to the Azure services used (Azure OpenAI, Azure PostgreSQL Flexible Server).
179
183
180
184
Additionally, we have added a [GitHub Action](https://github.com/microsoft/security-devops-action) that scans the infrastructure-as-code files and generates a report containing any detected issues. To ensure continued best practices in your own repository, we recommend that anyone creating solutions based on our templates ensure that the [Github secret scanning](https://docs.github.com/code-security/secret-scanning/about-secret-scanning) setting is enabled.
181
185
186
+
## Guidance
187
+
188
+
Further documentation is available in the `docs/` folder:
189
+
190
+
* [Deploying with existing resources](docs/deploy_existing.md)
191
+
* [Monitoring with Azure Monitor](docs/monitoring.md)
192
+
* [Load testing](docs/loadtesting.md)
193
+
194
+
Please post in the issue tracker with any questions or issues.
195
+
182
196
## Resources
183
197
184
198
* [RAG chat with Azure AI Search + Python](https://github.com/Azure-Samples/azure-search-openai-demo/)
If you already have existing Azure resources, or if you want to specify the exact name of new Azure Resource, you can do so by setting `azd` environment values.
4
+
You should set these values before running `azd up`. Once you've set them, return to the [deployment steps](../README.md#deployment).
5
+
6
+
### Openai.com OpenAI account
7
+
8
+
1. Run `azd env set DEPLOY_AZURE_OPENAI false`
9
+
1. Run `azd env set OPENAI_CHAT_HOST openaicom`
10
+
2. Run `azd env set OPENAI_EMBED_HOST openaicom`
11
+
3. Run `azd env set OPENAICOM_KEY {Your OpenAI API key}`
12
+
4. Run `azd up`
13
+
14
+
You can retrieve your OpenAI key by checking [your user page](https://platform.openai.com/account/api-keys).
15
+
Learn more about creating an OpenAI free trial at [this link](https://openai.com/pricing).
16
+
Do *not* check your key into source control.
17
+
18
+
When you run `azd up` after and are prompted to select a value for `openAiResourceGroupLocation`, you can select any location as it will not be used.
We recommend running a loadtest for your expected number of users.
4
+
You can use the [locust tool](https://docs.locust.io/) with the `locustfile.py` in this sample
5
+
or set up a loadtest with Azure Load Testing.
6
+
7
+
To use locust, first install the dev requirements that includes locust:
8
+
9
+
```shell
10
+
python -m pip install -r requirements-dev.txt
11
+
```
12
+
13
+
Or manually install locust:
14
+
15
+
```shell
16
+
python -m pip install locust
17
+
```
18
+
19
+
Then run the locust command, specifying the name of the User class to use from `locustfile.py` or using the default class. We've provided a `ChatUser` class that simulates a user asking questions and receiving answers.
20
+
21
+
```shell
22
+
locust
23
+
```
24
+
25
+
Open the locust UI at [http://localhost:8089/](http://localhost:8089/), the URI displayed in the terminal.
26
+
27
+
Start a new test with the URI of your website, e.g. `https://my-chat-app.containerapps.io`.
28
+
Do *not* end the URI with a slash. You can start by pointing at your localhost if you're concerned
29
+
more about load on OpenAI than on Azure Container Apps and PostgreSQL Flexible Server.
30
+
31
+
For the number of users and spawn rate, we recommend starting with 20 users and 1 users/second.
32
+
From there, you can keep increasing the number of users to simulate your expected load.
33
+
34
+
Here's an example loadtest for 20 users and a spawn rate of 1 per second:
35
+
36
+

37
+
38
+
After each test, check the local or App Service logs to see if there are any errors.
By default, deployed apps use Application Insights for the tracing of each request, along with the logging of errors.
5
+
6
+
To see the performance data, go to the Application Insights resource in your resource group, click on the "Investigate -> Performance" blade and navigate to any HTTP request to see the timing data.
7
+
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:
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 Python stack traces on the right-hand side.
12
+
13
+
You can also see chart summaries on a dashboard by running the following command:
0 commit comments