This article serves as a guide to setting up a web app service in Azure using the Command Line Interface (CLI) and provides step-by-step instructions on how to scale up and scale out within the Azure web app environment.
Tools Required
- Install Azure CLI
- Github Account
- Install Gitbash
STEP 1. Login to Azure from the command line
Open a command line of your choice. For this exercise I will be using Git Bash.
- Type the command az login and hit enter Once you hit the 'enter' it will prompt you to choose the azure account you wish to sign into. Select the appropriate account.
STEP 2. CREATE A RESOURCE GROUP
A resource group organizes your resources. Create one by using this command :az group create --name group name --location region
from the above image, you can clearly see that the resource group has been successfully created.
STEP 3. CREATE AN APP SERVICE APP
The App Service plan determines the web app's pricing and scale. You can create it by using the command: az appservice plan create --name --resource-group --sku F1
STEP 4. CREATE A WEB APP
You can do this by using the command: az webapp create --name name of your webapp --resource-group resource group name --plan plan name hit enter. After hitting the enter buttton, it automatically creates a webapp on your azure portal.
STEP 5. Deploy your code
Go to your Github account and click on the repository that contains your website files (HTML, CSS and JavaScript)
Click on code button and copy the URL on display
Go back to the PowerShell and type the following command
az webapp deployment source config --name webapp name --resource-group resource group name --repo-url the url you copied from GitHub --branch branch of the repo --manual-integration
This command deploys your web application instantly
Access your web app
Go to the Azure portal and view the App Service plan and Web app application.
- click on the web application icon to overview the page. On the Overview page, you will find the Default domain, which serves as the URL for your website. You can copy and share it to allow others to access your site.
Additionally, the page displays details such as the App Service Plan and the repository link from GitHub, which is the source of your website's content.
To view deployment details, click on Deployment Center in the left-hand menu under the Deployment section.
SCALING UP AND SCALING OUT
In most cases, after deploying your web application, it’s necessary to scale up before moving to production. This ensures your application has adequate capacity to maintain high availability and fault tolerance.
If your application is expected to experience heavy traffic, it’s crucial to enable scaling out to handle increased demand as needed.
SCALE UP
Scaling up involves enhancing an existing system by adding more resources to achieve the desired level of performance. This typically includes increasing the RAM and storage capacity of the current machine.
In azure web application services, we can achieve this by
Navigate to the App Service Plan and click on your plan to open the Overview page. Next, select Scale Up (App Service Plan) from the left-hand menu under Settings. Choose your desired capacity from the Production tiers and click the Select button to apply the changes.
Click Upgrade to upgrade to your chosen capacity.
SCALE OUT
Scaling out, which can also be called horizontal scaling, involves adding more resources such as servers to your system. This helps distribute the workload across multiple machines, thereby enhancing performance and increasing storage capacity.
In Azure App Services, you can manage scaling through your App Service Plan by navigating to the Overview page.
Click on Scale Out (App Service Plan).
Choose one of the scaling options: Manual, Automatic, or Rule-based.
For automatic scaling, adjust the Maximum Burst by dragging the slider until you reach your desired maximum.
- Click SAVE to effect your changes
By following these steps, we successfully deployed our web application and scaled it to the desired capacity to ensure optimal performance.
Top comments (0)