Skip to content

Commit 1c5533a

Browse files
updated the document and added the latest code related to search service in main_custom
1 parent 6b97493 commit 1c5533a

File tree

3 files changed

+455
-11
lines changed

3 files changed

+455
-11
lines changed

docs/DeploymentGuide.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -335,16 +335,23 @@ The files for the dev container are located in `/.devcontainer/` folder.
335335
336336
- If you are using `venv`, create and activate your virtual environment for both the frontend and backend folders.
337337
338-
8. **Install requirements - frontend:**
338+
8. **Install requirements - Backend:**
339339
340-
- In each of the frontend and backend folders -
341-
Open a terminal in the `src` folder and run:
340+
- To install the requirement for backend -
341+
Open a terminal in the `src/backend` folder and run:
342342
```bash
343-
pip install -r requirements.txt
343+
pip install uv
344+
uv sync
344345
```
345346
346347
9. **Build the frontend (important):**
347348
349+
- To install the requirement for frontend -
350+
Open a terminal in the `src/frontend` folder and run:
351+
```bash
352+
pip install -r requirements.txt
353+
```
354+
348355
- Before running the frontend server, you must build the frontend to generate the necessary `build/assets` directory.
349356
350357
From the `src/frontend` directory, run:
@@ -356,7 +363,7 @@ The files for the dev container are located in `/.devcontainer/` folder.
356363
357364
10. **Run the application:**
358365
359-
- From the src/backend directory:
366+
- From the src/backend directory activate the virtual environment created through step 8:
360367
361368
```bash
362369
python app_kernel.py
@@ -368,8 +375,21 @@ python app_kernel.py
368375
python frontend_server.py
369376
```
370377
371-
10. Open a browser and navigate to `http://localhost:3000`
372-
11. To see swagger API documentation, you can navigate to `http://localhost:8000/docs`
378+
11. Open a browser and navigate to `http://localhost:3000`
379+
12. To see swagger API documentation, you can navigate to `http://localhost:8000/docs`
380+
381+
## Deploy Your local changes
382+
383+
To Deploy your local changes rename the below files.
384+
385+
1. Rename `azure.yaml` to `azure_custom2.yaml` and `azure_custom.yaml` to `azure.yaml`.
386+
2. Go to `infra` directory
387+
- Remove `main.bicep` to `main_custom2.bicep` and `main_custom.bicep` to `main.bicep`.
388+
389+
Continue with the [deploying steps](#deploying-with-azd).
390+
391+
392+
373393
374394
## Debugging the solution locally
375395

infra/main_custom.bicep

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,22 @@ module containerApp 'br/public:avm/res/app/container-app:0.14.2' = if (container
11081108
name: 'APP_ENV'
11091109
value: 'Prod'
11101110
}
1111+
{
1112+
name: 'AZURE_STORAGE_BLOB_URL'
1113+
value: avmStorageAccount.outputs.serviceEndpoints.blob
1114+
}
1115+
{
1116+
name: 'AZURE_STORAGE_CONTAINER_NAME'
1117+
value: storageContainerName
1118+
}
1119+
{
1120+
name: 'AZURE_SEARCH_ENDPOINT'
1121+
value: searchService.outputs.endpoint
1122+
}
1123+
{
1124+
name: 'AZURE_SEARCH_CONNECTION_NAME'
1125+
value: aiSearchConnectionName
1126+
}
11111127
]
11121128
}
11131129
]
@@ -1274,6 +1290,186 @@ module webSite 'br/public:avm/res/web/site:0.15.1' = if (webSiteEnabled) {
12741290
}
12751291
}
12761292

1293+
1294+
// ========== Storage Account ========== //
1295+
1296+
module privateDnsZonesStorageAccount 'br/public:avm/res/network/private-dns-zone:0.7.0' = if (virtualNetworkEnabled) {
1297+
name: take('avm.res.network.private-dns-zone.storage-account.${solutionPrefix}', 64)
1298+
params: {
1299+
name: 'privatelink.blob.core.windows.net'
1300+
enableTelemetry: enableTelemetry
1301+
virtualNetworkLinks: [
1302+
{
1303+
name: 'vnetlink-storage-account'
1304+
virtualNetworkResourceId: virtualNetwork.outputs.resourceId
1305+
}
1306+
]
1307+
tags: tags
1308+
}
1309+
}
1310+
1311+
var storageAccountName = replace('st${solutionPrefix}', '-', '')
1312+
param storageContainerName string = 'sample-dataset'
1313+
module avmStorageAccount 'br/public:avm/res/storage/storage-account:0.20.0' = {
1314+
name: take('avm.res.storage.storage-account.${storageAccountName}', 64)
1315+
params: {
1316+
name: storageAccountName
1317+
location: solutionLocation
1318+
managedIdentities: { systemAssigned: true }
1319+
minimumTlsVersion: 'TLS1_2'
1320+
enableTelemetry: enableTelemetry
1321+
tags: tags
1322+
accessTier: 'Hot'
1323+
supportsHttpsTrafficOnly: true
1324+
1325+
roleAssignments: [
1326+
{
1327+
principalId: userAssignedIdentity.outputs.principalId
1328+
roleDefinitionIdOrName: 'Storage Blob Data Contributor'
1329+
principalType: 'ServicePrincipal'
1330+
}
1331+
{
1332+
principalId: deployingUserPrincipalId
1333+
roleDefinitionIdOrName: 'Storage Blob Data Contributor'
1334+
principalType: 'User'
1335+
}
1336+
]
1337+
1338+
// WAF aligned networking
1339+
networkAcls: {
1340+
bypass: 'AzureServices'
1341+
defaultAction: virtualNetworkEnabled ? 'Deny' : 'Allow'
1342+
}
1343+
allowBlobPublicAccess: false
1344+
publicNetworkAccess: virtualNetworkEnabled ? 'Disabled' : 'Enabled'
1345+
1346+
// Private endpoints for blob
1347+
privateEndpoints: virtualNetworkEnabled
1348+
? [
1349+
{
1350+
name: 'pep-blob-${solutionPrefix}'
1351+
privateDnsZoneGroup: {
1352+
privateDnsZoneGroupConfigs: [
1353+
{
1354+
name: 'storage-dns-zone-group-blob'
1355+
privateDnsZoneResourceId: privateDnsZonesStorageAccount.outputs.resourceId
1356+
}
1357+
]
1358+
}
1359+
subnetResourceId: virtualNetwork.outputs.subnetResourceIds[0]
1360+
service: 'blob'
1361+
}
1362+
]
1363+
: []
1364+
blobServices: {
1365+
automaticSnapshotPolicyEnabled: true
1366+
containerDeleteRetentionPolicyDays: 10
1367+
containerDeleteRetentionPolicyEnabled: true
1368+
containers: [
1369+
{
1370+
name: storageContainerName
1371+
publicAccess: 'None'
1372+
}
1373+
]
1374+
deleteRetentionPolicyDays: 9
1375+
deleteRetentionPolicyEnabled: true
1376+
lastAccessTimeTrackingPolicyEnabled: true
1377+
}
1378+
}
1379+
}
1380+
1381+
// ========== Search Service ========== //
1382+
1383+
module privateDnsZonesSearchService 'br/public:avm/res/network/private-dns-zone:0.7.0' = if (virtualNetworkEnabled) {
1384+
name: take('avm.res.network.private-dns-zone.search-service.${solutionPrefix}', 64)
1385+
params: {
1386+
name: 'privatelink.search.windows.net'
1387+
enableTelemetry: enableTelemetry
1388+
virtualNetworkLinks: [
1389+
{
1390+
name: 'vnetlink-search-service'
1391+
virtualNetworkResourceId: virtualNetwork.outputs.resourceId
1392+
}
1393+
]
1394+
tags: tags
1395+
}
1396+
}
1397+
1398+
var searchServiceName = 'srch-${solutionPrefix}'
1399+
module searchService 'br/public:avm/res/search/search-service:0.11.1' = {
1400+
name: take('avm.res.search.search-service.${solutionPrefix}', 64)
1401+
params: {
1402+
name: searchServiceName
1403+
authOptions: {
1404+
aadOrApiKey: {
1405+
aadAuthFailureMode: 'http401WithBearerChallenge'
1406+
}
1407+
}
1408+
disableLocalAuth: false
1409+
hostingMode: 'default'
1410+
managedIdentities: {
1411+
systemAssigned: true
1412+
}
1413+
publicNetworkAccess: virtualNetworkEnabled ? 'Disabled' : 'Enabled'
1414+
networkRuleSet: {
1415+
bypass: 'AzureServices'
1416+
}
1417+
partitionCount: 1
1418+
replicaCount: 1
1419+
sku: 'standard'
1420+
tags: tags
1421+
roleAssignments: [
1422+
{
1423+
principalId: userAssignedIdentity.outputs.principalId
1424+
roleDefinitionIdOrName: 'Search Index Data Contributor'
1425+
principalType: 'ServicePrincipal'
1426+
}
1427+
{
1428+
principalId: deployingUserPrincipalId
1429+
roleDefinitionIdOrName: 'Search Index Data Contributor'
1430+
principalType: 'User'
1431+
}
1432+
]
1433+
privateEndpoints: virtualNetworkEnabled
1434+
? [
1435+
{
1436+
name: 'pep-search-${solutionPrefix}'
1437+
privateDnsZoneGroup: {
1438+
privateDnsZoneGroupConfigs: [
1439+
{
1440+
privateDnsZoneResourceId: privateDnsZonesSearchService.outputs.resourceId
1441+
}
1442+
]
1443+
}
1444+
subnetResourceId: virtualNetwork.outputs.subnetResourceIds[0]
1445+
service: 'searchService'
1446+
}
1447+
]
1448+
: []
1449+
}
1450+
}
1451+
1452+
// ========== Search Service - AI Project Connection ========== //
1453+
1454+
var aiSearchConnectionName = 'aifp-srch-connection-${solutionPrefix}'
1455+
var aifSubscriptionId = useExistingFoundryProject ? split(existingFoundryProjectResourceId, '/')[2] : subscription().subscriptionId
1456+
var aifResourceGroup = useExistingFoundryProject ? split(existingFoundryProjectResourceId, '/')[4] : resourceGroup().name
1457+
module aiSearchFoundryConnection 'modules/aifp_search_connection.bicep' = if (aiFoundryAIservicesEnabled) {
1458+
name: take('aifp-srch-connection.${solutionPrefix}', 64)
1459+
scope: resourceGroup(aifSubscriptionId, aifResourceGroup)
1460+
params: {
1461+
aiFoundryProjectName: aiFoundryAiProjectName
1462+
aiFoundryName: aiFoundryAiServicesResourceName
1463+
aifSearchConnectionName: aiSearchConnectionName
1464+
searchServiceResourceId: searchService.outputs.resourceId
1465+
searchServiceLocation: searchService.outputs.location
1466+
searchServiceName: searchService.outputs.name
1467+
}
1468+
dependsOn: [
1469+
aiFoundryAiServices
1470+
]
1471+
}
1472+
12771473
// ============ //
12781474
// Outputs //
12791475
// ============ //
@@ -1283,6 +1479,11 @@ module webSite 'br/public:avm/res/web/site:0.15.1' = if (webSiteEnabled) {
12831479
@description('The default url of the website to connect to the Multi-Agent Custom Automation Engine solution.')
12841480
output webSiteDefaultHostname string = webSite.outputs.defaultHostname
12851481

1482+
output AZURE_STORAGE_BLOB_URL string = avmStorageAccount.outputs.serviceEndpoints.blob
1483+
output AZURE_STORAGE_ACCOUNT_NAME string = storageAccountName
1484+
output AZURE_STORAGE_CONTAINER_NAME string = storageContainerName
1485+
output AZURE_SEARCH_ENDPOINT string = searchService.outputs.endpoint
1486+
output AZURE_SEARCH_NAME string = searchService.outputs.name
12861487

12871488

12881489
output AZURE_CONTAINER_REGISTRY_ENDPOINT string = containerRegistry.outputs.loginServer

0 commit comments

Comments
 (0)