forked from Azure-Samples/azure-search-openai-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Existing resources, tenant id, codespaces/linux support (Azure-Sample…
…s#25) * Update prepdocs hook to use AzureDeveloperCliCredential * Using tenant id as argument for prepdocs * Allow existing resources * Update readme and add roles.ps1 * Add links to roles * remove comment * Initial codespaces support * Add linux scripts, update azure.yaml * Create venv for backend * Readme updates * Add az cli to devcotnainer for roles script * Add codespaces option to readme * Minor readme and script updates * Fix up prepdocs.sh * Remove python detection and update .sh env load * Add troubleshooting * Update scripts to use pip/python from venv * Update ps to use -m * Add azd login * Readme update with screenshots * Add gitattributes * Make .sh impls consistent * Removing second tenant id * support lin/win from prepdocs hook * Update template version * unwanted * update start.ps1 * windows * windows * py3 fix * patch * win * Tweak pre-reqs --------- Co-authored-by: Victor Vazquez <[email protected]>
- Loading branch information
Showing
22 changed files
with
450 additions
and
132 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
ARG VARIANT=bullseye | ||
FROM --platform=amd64 mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT} | ||
RUN export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get update && apt-get install -y xdg-utils \ | ||
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* | ||
RUN curl -fsSL https://aka.ms/install-azd.sh | bash |
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,37 @@ | ||
{ | ||
"name": "Azure Developer CLI", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"args": { | ||
"VARIANT": "bullseye" | ||
} | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/python:1": { | ||
"version": "os-provided" | ||
}, | ||
"ghcr.io/devcontainers/features/node:1": { | ||
"version": "16", | ||
"nodeGypDependencies": false | ||
}, | ||
"ghcr.io/devcontainers/features/powershell:1.1.0": {}, | ||
"ghcr.io/devcontainers/features/azure-cli:1.0.8": {} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-azuretools.azure-dev", | ||
"ms-azuretools.vscode-bicep", | ||
"ms-python.python" | ||
] | ||
} | ||
}, | ||
"forwardPorts": [ | ||
5000 | ||
], | ||
"postCreateCommand": "", | ||
"remoteUser": "vscode", | ||
"hostRequirements": { | ||
"memory": "8gb" | ||
} | ||
} |
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 @@ | ||
*.sh text eol=lf |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Azure az webapp deployment details | ||
.azure | ||
*_env | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
|
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
azure-identity==1.12.0 | ||
azure-identity==1.13.0b3 | ||
Flask==2.2.2 | ||
langchain==0.0.78 | ||
openai==0.26.4 | ||
|
This file was deleted.
Oops, something went wrong.
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,74 @@ | ||
Write-Host "" | ||
Write-Host "Loading azd .env file from current environment" | ||
Write-Host "" | ||
|
||
foreach ($line in (& azd env get-values)) { | ||
if ($line -match "([^=]+)=(.*)") { | ||
$key = $matches[1] | ||
$value = $matches[2] -replace '^"|"$' | ||
Set-Item -Path "env:\$key" -Value $value | ||
} | ||
} | ||
|
||
if ($LASTEXITCODE -ne 0) { | ||
Write-Host "Failed to load environment variables from azd environment" | ||
exit $LASTEXITCODE | ||
} | ||
|
||
|
||
Write-Host 'Creating python virtual environment "backend/backend_env"' | ||
$pythonCmd = Get-Command python -ErrorAction SilentlyContinue | ||
if (-not $pythonCmd) { | ||
# fallback to python3 if python not found | ||
$pythonCmd = Get-Command python3 -ErrorAction SilentlyContinue | ||
} | ||
Start-Process -FilePath ($pythonCmd).Source -ArgumentList "-m venv ./backend/backend_env" -Wait -NoNewWindow | ||
|
||
Write-Host "" | ||
Write-Host "Restoring backend python packages" | ||
Write-Host "" | ||
|
||
Set-Location backend | ||
$venvPythonPath = "./backend_env/scripts/python.exe" | ||
if (Test-Path -Path "/usr") { | ||
# fallback to Linux venv path | ||
$venvPythonPath = "./backend_env/bin/python" | ||
} | ||
|
||
Start-Process -FilePath $venvPythonPath -ArgumentList "-m pip install -r requirements.txt" -Wait -NoNewWindow | ||
if ($LASTEXITCODE -ne 0) { | ||
Write-Host "Failed to restore backend python packages" | ||
exit $LASTEXITCODE | ||
} | ||
|
||
Write-Host "" | ||
Write-Host "Restoring frontend npm packages" | ||
Write-Host "" | ||
Set-Location ../frontend | ||
npm install | ||
if ($LASTEXITCODE -ne 0) { | ||
Write-Host "Failed to restore frontend npm packages" | ||
exit $LASTEXITCODE | ||
} | ||
|
||
Write-Host "" | ||
Write-Host "Building frontend" | ||
Write-Host "" | ||
npm run build | ||
if ($LASTEXITCODE -ne 0) { | ||
Write-Host "Failed to build frontend" | ||
exit $LASTEXITCODE | ||
} | ||
|
||
Write-Host "" | ||
Write-Host "Starting backend" | ||
Write-Host "" | ||
Set-Location ../backend | ||
Start-Process http://127.0.0.1:5000 | ||
|
||
Start-Process -FilePath $venvPythonPath -ArgumentList "./app.py" -Wait -NoNewWindow | ||
|
||
if ($LASTEXITCODE -ne 0) { | ||
Write-Host "Failed to start backend" | ||
exit $LASTEXITCODE | ||
} |
Oops, something went wrong.