forked from microsoft/promptflow
-
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.
[Doc & sample] Refine deploy docs & samples (microsoft#280)
# Description Please add an informative description that covers that changes made by the pull request and link all relevant issues. # All Promptflow Contribution checklist: - [ ] **The pull request does not introduce [breaking changes]** - [ ] **CHANGELOG is updated for new features, bug fixes or other significant changes.** - [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).** ## General Guidelines and Best Practices - [ ] Title of the pull request is clear and informative. - [ ] There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, [see this page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [ ] Pull request includes test coverage for the included changes. --------- Signed-off-by: Brynn Yin <[email protected]> Co-authored-by: Clement Wang <[email protected]> Co-authored-by: Clement Wang <[email protected]>
- Loading branch information
1 parent
76cd643
commit e1cdb37
Showing
25 changed files
with
588 additions
and
44 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
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,24 +1,81 @@ | ||
# Deploy to Azure App Service | ||
|
||
[Azure App Service](https://learn.microsoft.com/azure/app-service/) is an HTTP-based service for hosting web applications, REST APIs, and mobile back ends. | ||
Promptflow has provided scripts (`deploy.sh` for bash and `deploy.ps1` for powershell) to help deploy the docker image to Azure App Service. | ||
The scripts (`deploy.sh` for bash and `deploy.ps1` for powershell) under [this folder](https://github.com/microsoft/promptflow/tree/main/examples/tutorials/flow-deploy/azure-app-service) are here to help deploy the docker image to Azure App Service. | ||
|
||
This example demos how to deploy [web-classification](https://github.com/microsoft/promptflow/tree/main/examples/flows/standard/web-classification/) deploy a flow using Azure App Service. | ||
|
||
## Build a flow as docker format app | ||
|
||
Use the command below to build a flow as docker format app: | ||
|
||
Example command to use bash script: | ||
```bash | ||
bash deploy.sh -i <image_tag> -r "promptflow.azurecr.io" -g <resource_group> | ||
pf flow build --source ../../flows/standard/web-classification --output build --format docker | ||
``` | ||
|
||
Note that all dependent connections must be created before building as docker. | ||
|
||
## Deploy with Azure App Service | ||
The two scripts will do the following things: | ||
1. Create a resource group if not exists. | ||
2. Build and push the image to docker registry. | ||
3. Create an app service plan with the give sku. | ||
4. Create an app with specified name, set the deployment container image to the pushed docker image. | ||
5. Set up the environment variables for the app. | ||
|
||
::::{tab-set} | ||
:::{tab-item} Bash | ||
Example command to use bash script: | ||
```shell | ||
bash deploy.sh --path build -i <image_tag> --name my_app_23d8m -r <docker registery> -g <resource_group> | ||
``` | ||
See the full parameters by `bash deploy.sh -h`. | ||
::: | ||
:::{tab-item} PowerShell | ||
Example command to use powershell script: | ||
```powershell | ||
.\deploy.ps1 -i <image_tag> -r "promptflow.azurecr.io" -g <resource_group> | ||
.\deploy.ps1 -i <image_tag> --Name my_app_23d8m -r <docker registery> -g <resource_group> | ||
``` | ||
See the full parameters by `.\deploy.ps1 -h`. | ||
::: | ||
:::: | ||
|
||
Note that the `name` will produce a unique FQDN as AppName.azurewebsites.net. | ||
|
||
|
||
See the full parameters by `bash deploy.sh -h` or `.\deploy.ps1 -h`. | ||
## View and test the web app | ||
The web app can be found via [azure portal](https://ms.portal.azure.com/) | ||
|
||
 | ||
|
||
After the app created, you will need to go to https://ms.portal.azure.com/ find the app and set up the environment variables | ||
at (Settings>Configuration) or (Settings>Environment variables), then restart the app. | ||
|
||
 | ||
|
||
The app can be tested by sending a POST request to the endpoint or browse the test page. | ||
::::{tab-set} | ||
:::{tab-item} Bash | ||
```bash | ||
curl https://<name>.azurewebsites.net/score --data '{"url":"https://play.google.com/store/apps/details?id=com.twitter.android"}' -X POST -H "Content-Type: application/json" | ||
``` | ||
::: | ||
:::{tab-item} PowerShell | ||
```powershell | ||
Invoke-WebRequest -URI https://<name>.azurewebsites.net/score -Body '{"url":"https://play.google.com/store/apps/details?id=com.twitter.android"}' -Method POST -ContentType "application/json" | ||
``` | ||
::: | ||
:::{tab-item} Test Page | ||
Browse the app at Overview and see the test page: | ||
|
||
 | ||
::: | ||
:::: | ||
|
||
Tips: | ||
- Reach deployment logs at (Deployment>Deployment Central) and app logs at (Monitoring>Log stream). | ||
- Reach advanced deployment tools at https://$name.scm.azurewebsites.net/. | ||
- Reach more details about app service at https://learn.microsoft.com/azure/app-service/. | ||
|
||
## Next steps | ||
- Try the example [here](https://github.com/microsoft/promptflow/blob/main/examples/tutorials/flow-deploy/azure-app-service). |
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Binary file added
BIN
+107 KB
examples/flows/chat/chat-with-pdf/assets/chat_with_pdf_test_endpoint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.