-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from ntrogh/ntrogh-azd
Add azd deployment option
- Loading branch information
Showing
1,422 changed files
with
2,084 additions
and
321,309 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,31 +1,46 @@ | ||
# WebApp with Cosmos DB | ||
|
||
A sample webapp deployed on app service with cosmos db as database. It counts the number of visitors visiting the page and inserts the same into a sample collection in Cosmos DB. | ||
|
||
### Installation | ||
A sample web app deployed on Azure App Service with a Cosmos DB database. The app counts the number of visitors visiting the page and inserts the same number of entries into a sample collection in Cosmos DB. | ||
|
||
1. In your terminal window, log into Azure and set a subscription(subscription which would contain the webapp) : | ||
This sample application is used in the [Azure Load Testing tutorial about identifying performance bottlenecks](https://learn.microsoft.com/azure/load-testing/tutorial-identify-bottlenecks-azure-portal). | ||
|
||
az login | ||
az account set -s mySubscriptionName | ||
## Deployment | ||
|
||
2. Clone the sample application's source repository. The sample application is a Node.js app consisting of an Azure App Service web component and a Cosmos DB database. The repo also contains a PowerShell script that deploys the sample app to your Azure subscription. | ||
To deploy the sample application to Azure, you'll use the Azure Developer CLI (azd). Check out the [Azure Dev CLI documentation for more instructions on using the CLI](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/get-started). | ||
|
||
git clone https://github.com/Azure-Samples/nodejs-appsvc-cosmosdb-bottleneck.git | ||
1. Run the following command to initialize the project. | ||
|
||
3. Deploy the sample app using the PowerShell script. (Tip: macOS users can install PowerShell [here](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-macos?view=powershell-7.1)) | ||
```bash | ||
azd init --template https://github.com/Azure-Samples/nodejs-appsvc-cosmosdb-bottleneck/tree/azd | ||
``` | ||
|
||
cd SampleApp | ||
.\deploymentscript.ps1 | ||
This command will clone the code to your current folder and prompt you for the following information: | ||
|
||
4. You will be prompted to supply a unique application name and a location (default is `eastus`). A resource group for the resources would be created with the same name. | ||
5. Once deployment is complete, browse to the running sample application with your browser. | ||
- `Environment Name`: This will be used as a prefix for the resource group that will be created to hold all Azure resources. This name should be unique within your Azure subscription. | ||
|
||
https://<app_name>.azurewebsites.net | ||
## **Clean up resources** | ||
1. Run the following command to build a deployable copy of your application, provision the template's infrastructure to Azure and also deploy the application code to those newly provisioned resources. | ||
```bash | ||
azd up | ||
``` | ||
This command will prompt you for the following information: | ||
- `Azure Subscription`: The Azure Subscription where your resources will be deployed. | ||
- `Azure Location`: The Azure location where your resources will be deployed. | ||
> NOTE: This may take a while to complete as it executes three commands: `azd package` (builds a deployable copy of your application), `azd provision` (provisions Azure resources), and `azd deploy` (deploys application code). You will see a progress indicator as it packages, provisions and deploys your application. | ||
1. Once deployment is complete, you can browse to the running sample application. | ||
https://<app_name>.azurewebsites.net | ||
## Clean up resources | ||
You may want to delete the resources to avoid to continue incurring charges. Use the `az group delete` command to remove the resource group and all related resources. | ||
az group delete --name myResourceGroup | ||
```bash | ||
azd down | ||
``` | ||
Similarly, you can utilize the **Delete resource group** toolbar button on the sample application's resource group to remove all the resources. | ||
Alternately, you can use the **Delete resource group** toolbar button in the Azure portal on the sample application's resource group to remove all the resources. |
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,10 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json | ||
|
||
name: nodejs-appsvc-cosmosdb-bottleneck | ||
metadata: | ||
template: [email protected] | ||
services: | ||
web: | ||
project: ./src | ||
language: js | ||
host: appservice |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.