Skip to content

fix: update the local development scripts, readme and custom deployment pre provision hook#813

Open
Ragini-Microsoft wants to merge 6 commits intodevfrom
rc-localsetupupdate
Open

fix: update the local development scripts, readme and custom deployment pre provision hook#813
Ragini-Microsoft wants to merge 6 commits intodevfrom
rc-localsetupupdate

Conversation

@Ragini-Microsoft
Copy link
Copy Markdown
Collaborator

@Ragini-Microsoft Ragini-Microsoft commented Apr 16, 2026

Purpose

This pull request introduces several improvements to local development scripts, deployment automation, and environment setup to streamline the developer experience and make deployment processes more robust. The changes focus on better handling of environment files, enhanced automation for prerequisites, improved deployment hooks, and cleanup of legacy scripts.

Key changes include:

Local Development Script Improvements

  • Updated both PowerShell (scripts/local_dev.ps1) and Bash (scripts/local_dev.sh) scripts to prefer .env.sample over .env.template for generating .env files, and improved logic for generating, refreshing, and falling back to .env if missing. The scripts now prompt users to refresh .env from Azure resources and automatically run setup steps if prerequisites (like virtual environments or dependencies) are missing. [1] [2] [3] [4] [5] [6]

  • Enhanced backend and frontend start functions to use Push-Location/Pop-Location for safer directory changes and to suppress benign shutdown errors, improving robustness and user experience. [1] [2] [3]

  • Improved the "start all" workflow to display colored, prefixed output for backend and frontend logs, and to handle job failures more gracefully. [1] [2]

  • Added a help command to the Bash script for easier discovery of available commands. [1] [2]

Deployment Automation Enhancements

  • Refined Azure deployment hooks in azure_custom.yaml to better detect and handle first deployments, ACR (Azure Container Registry) image existence, and ACI (Azure Container Instance) redeployments. The hooks now clear container instance names and skip deployments as appropriate, and restart ACI to ensure new images are picked up. [1] [2] [3] [4]

Environment and Documentation Updates

  • Added missing environment variable samples (COSMOSDB_ACCOUNT_NAME, RESOURCE_GROUP_NAME) to .env.sample for clarity and completeness. [1] [2]

  • Updated documentation to clarify that deploying local changes is an advanced operation.

Cleanup

  • Removed legacy startup scripts (src/start.sh, src/start.cmd) in favor of the improved local development scripts. [1] [2]

Minor Fixes

  • Corrected the PYTHONPATH export in the Bash script to use the backend directory instead of the source directory.

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

Ragini-Microsoft and others added 2 commits April 13, 2026 14:53
These files were not referenced anywhere in the codebase.
Local development is handled by scripts/local_dev.ps1 and scripts/local_dev.sh.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the local development experience by making the PowerShell and Bash dev scripts more “self-healing” (auto-setup / auto-env generation), improving service output handling, and updating the local dev documentation accordingly.

Changes:

  • Update local_dev.ps1 / local_dev.sh to auto-run setup steps when prerequisites are missing and improve process output labeling/handling.
  • Fix Bash PYTHONPATH to point at the backend directory for correct module resolution.
  • Expand/refresh the local development setup guide and remove unused legacy start scripts.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
scripts/local_dev.ps1 Adds auto-setup/env generation, safer directory handling, and job output labeling for backend/frontend.
scripts/local_dev.sh Adds auto-setup/env generation, fixes PYTHONPATH, and improves help discoverability.
docs/LocalDevelopmentSetup.md Major rewrite/expansion of local setup instructions and env var reference.
src/start.sh Removed unused legacy startup script.
src/start.cmd Removed unused legacy startup script.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/local_dev.ps1
Comment thread scripts/local_dev.ps1
Comment thread scripts/local_dev.ps1 Outdated
Comment on lines +499 to +501
if (-not (Test-Path ".env")) {
Write-Warning ".env file not found. Generating from Azure resources..."
Invoke-EnvGeneration
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Start-All calls Invoke-EnvGeneration when .env is missing, but Invoke-EnvGeneration’s non-azd fallback only copies from .env.template (which doesn’t exist in this repo; there is .env.sample). If azd isn’t available, Start-All will proceed without a .env and then role assignment helpers will fail with less actionable errors. After Invoke-EnvGeneration, explicitly verify that .env exists (or copy from .env.sample) and stop with a clear next-step message if it still doesn’t.

Suggested change
if (-not (Test-Path ".env")) {
Write-Warning ".env file not found. Generating from Azure resources..."
Invoke-EnvGeneration
$envFile = Join-Path $ProjectRoot ".env"
$envSampleFile = Join-Path $ProjectRoot ".env.sample"
if (-not (Test-Path $envFile)) {
Write-Warning ".env file not found. Generating from Azure resources..."
Invoke-EnvGeneration
if (-not (Test-Path $envFile) -and (Test-Path $envSampleFile)) {
Write-Warning "Invoke-EnvGeneration did not create .env. Copying .env.sample to .env as a fallback..."
Copy-Item $envSampleFile $envFile
Write-Info "Created .env from .env.sample. Update the file with your local values if needed."
}
if (-not (Test-Path $envFile)) {
throw "Failed to create .env. Run '.\scripts\local_dev.ps1 -Command env' to generate it from Azure resources, or create '.env' manually from '.env.sample' and rerun the script."
}

Copilot uses AI. Check for mistakes.
Comment thread scripts/local_dev.sh Outdated
# Auto-run env generation if .env is missing
if [ ! -f ".env" ]; then
print_warning ".env file not found. Generating from Azure resources..."
generate_env
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

start_all auto-runs generate_env when .env is missing, but generate_env’s non-azd fallback only copies from .env.template (this repo has .env.sample, not .env.template). If azd isn’t installed, start_all continues without a .env and later role assignment helpers will fail with less actionable errors. After generate_env, re-check that .env exists (or copy from .env.sample) and exit with a clear message if it still doesn’t.

Suggested change
generate_env
generate_env
if [ ! -f ".env" ] && [ -f ".env.sample" ]; then
print_warning "generate_env did not create .env. Falling back to .env.sample..."
cp ".env.sample" ".env"
fi
if [ ! -f ".env" ]; then
print_error "Unable to create .env. Please run './local_dev.sh env' or create '$PROJECT_ROOT/.env' manually (you can start from .env.sample if available)."
exit 1
fi

Copilot uses AI. Check for mistakes.
Comment thread docs/LocalDevelopmentSetup.md Outdated
Comment on lines +61 to +62
sudo apt update && sudo apt install python3.11 python3.11-venv git curl nodejs npm -y

Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Linux prerequisite command installs nodejs/npm from the default apt repositories, which often does not provide Node.js 18+ (the stated minimum). Update these instructions to install a Node 18+ source (e.g., NodeSource repo or nvm), or clarify the minimum supported distro versions where apt provides Node 18+.

Suggested change
sudo apt update && sudo apt install python3.11 python3.11-venv git curl nodejs npm -y
sudo apt update && sudo apt install python3.11 python3.11-venv git curl ca-certificates -y
# Install Node.js 18.x from NodeSource
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install nodejs -y

Copilot uses AI. Check for mistakes.
Comment thread docs/LocalDevelopmentSetup.md
Comment thread docs/LocalDevelopmentSetup.md
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/local_dev.sh Outdated
Comment thread docs/LocalDevelopmentSetup.md Outdated
Comment thread docs/LocalDevelopmentSetup.md
Comment thread docs/LocalDevelopmentSetup.md
Comment thread docs/LocalDevelopmentSetup.md Outdated
Comment thread docs/LocalDevelopmentSetup.md Outdated
@Ragini-Microsoft Ragini-Microsoft changed the title fix: update the local development scripts and readme fix: update the local development scripts, readme and custom deployment pre provision hook Apr 16, 2026
@Ragini-Microsoft Ragini-Microsoft marked this pull request as ready for review April 16, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants