azure-search-openai-demo icon indicating copy to clipboard operation
azure-search-openai-demo copied to clipboard

Could we come up a way to deploy the python frontend/backend only?

Open hanwesh opened this issue 1 year ago • 2 comments

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Any log messages given by the failure

Expected/desired behavior

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

azd version?

run azd version and copy paste here.

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

hanwesh avatar Jun 23 '23 10:06 hanwesh

Have you tried running azd deploy? It will just deploy the app code, not do any of the provisioning steps.

pamelafox avatar Jun 23 '23 18:06 pamelafox

The solution I've made to view just the frontend is:

  • navigate to ./app/start.ps1 and add the line: param ([string] $deploy='build') to line 1 (before anything else)
  • scroll to line 57 and replace npm run build with the following code:
if ($deploy -eq "build") {
    Write-Host "Running build environment"
    npm run build
}
elseif ($deploy -eq "dev") {
    Write-Host "Running dev environment"
    npm run dev
}
else {
    Write-Host "Invalid deployment name"
    exit $LASTEXITCODE
}

Now, running start.ps1 normally should be the same, but running 'start.ps1 dev' will use npm run dev instead of npm run build and should update the frontend live. This solution does not work with the backend, however, so asking any questions will result in an error being returned as the answer. azd deploy should work as well for updating the frontend.

wherewith avatar Jun 23 '23 19:06 wherewith

Have you tried running azd deploy? It will just deploy the app code, not do any of the provisioning steps.

Thanks. Could we specific mention it from the installation section?

hanwesh avatar Jul 12 '23 05:07 hanwesh

@hanwesh Good idea, I'll make a PR to update the readme. @wherewith Thanks for sharing. If you find a good setup that enables live reload of the frontend with a functioning backend, please do open a PR.

pamelafox avatar Jul 12 '23 16:07 pamelafox

Readme update in https://github.com/Azure-Samples/azure-search-openai-demo/pull/417

pamelafox avatar Jul 12 '23 16:07 pamelafox