Skip to content

Commit

Permalink
Added a majority of the App Service Section
Browse files Browse the repository at this point in the history
  • Loading branch information
densellp committed Aug 15, 2023
1 parent 5e4bbb3 commit baf95ed
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/4-cloud-computing/4.3-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Chapter Goals

1. Dive deeper into the Azure cloud computing platform.
2. Understand Azure specific services such as Azure AD, Storage Accounts, AKS and Virtual Machines.
2. Understand Azure specific services such as Azure AD, Storage Accounts, AKS, Virtual Machines, and App Services.
3. Learn how autoscaling works in Azure using VM Scale Sets.
4. Learn how to build custom Azure VM images with Packer.

Expand Down
95 changes: 95 additions & 0 deletions docs/4-cloud-computing/4.3.7-app-service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
docs/4-cloud-computing/4.3.7-app-service.md:
category: Cloud Computing
estReadingMinutes: 10
exercises:
-
name: Deploy Simple Web Application to App Service
description: Create A Web App and Scale and Monitor
estMinutes: 240
technologies:
- Azure
- Azure App Service
- Azure CLI
---
# Azure App Service

Azure App Service is a fully managed platform for building, deploying, and scaling web apps. It supports various programming languages and frameworks like .NET, Java, Node.js, Python, and more, allowing developers to build web and mobile back-ends with ease. Through Azure App Service, you can integrate with various Azure tools like Azure DevOps for CI/CD and take advantage of built-in features such as custom domains and SSL certificates. It's designed with best practices in mind, providing scalability, robust monitoring, and security, thereby enabling a seamless and efficient app hosting solution.

> [Azure App Service](https://learn.microsoft.com/en-us/azure/app-service/) Documentation
### Exercise 1: Deploy a Java Application

We will be using liatrio's version of the spring-petclinic for this exercise, its a simple java application that deploys a web app for a virtual pet clinic.

1. Fork [Spring-Petclinic](https://github.com/liatrio/spring-petclinic.git). (We will be using this later for Continuous Deployment)

2. Clone your new fork.

```bash
git clone https://github.com/YOUR_NAME/spring-petclinic.git
```

!> There is an official repo for the spring-petclinic, we will not be using that since it contains different build test that may not be useful for our purposes and might break the application on build.

3. Install the maven project and ensure that you can reach the application locally to move onto the next step.

![Spring Petclinic Landing Page](img4/spring-petclinic-1.png ':size=912x400')

#### Deploy the Java App to App Service

1. Read the above documentation about Azure App Service and use Microsofts official [Maven Plugin](https://learn.microsoft.com/en-us/azure/app-service/quickstart-java?tabs=javase&pivots=platform-linux-development-environment-maven) to deploy a java application.
2. Make sure the application you deploy can be reached by copying the domain it gives you at the end and pasting that into your web browser.

?> If you wish, you may change the name of your application in the pom file before you deploy.

### Exercise 2: Deploy a Docker Application

We have seen that the Azure App Service can be useful for deploying a Java application using Azures built in maven plugin, but what if our application doesn't use java? What if it uses something that isn't natively supported by Azure? That's where docker containers come in, they are super versatile and can run a wide range of applications that are otherwise not supported by the Azure App Service natively. In this exercise, we will be taking the spring-petclinic and publish a docker image to be used with the Azure App Service. This will demonstrate a more practical use for App Service, as a majority on Engineers would be using Docker Containers.

#### Build and Publish Docker Image

1. Using the readme in the spring-petclinic repo, build a docker image and publish the image to your desired remote image repository.

?> You might need your credentials if you choose to deploy the application to an image repository other than the ACR

2. Run the container locally and ensure that you can access the application.

3. Using the Azure Docs from earlier, deploy the application to Azure App Service and ensure you can reach the application using the provided domain.

?> App Service listens on port 80 by default

#### Scale Application

Application Scaling in essential in balancing the load and giving the application more resources to execute properly. Azure App Service has this feature built in and we can use the Azure CLI to scale up and scale out our service.

1. Using the Azure CLI, Scale up your application by subscribing to a better service plan

```bash
az appservice -h
```

?> The new service plan can just be the next one up, no need to upgrade to a large machine

2. With the same command as before, scale out the application for more instances to be used. Increase the number of instances from 1 to 2 and verify that the change went live.

#### Monitor Application

Monitoring is a great way for developers to track their applications logs, resource consumption, crash dumps, etc. Azure App Service provides a method for doing this called Azure Monitors. This allows us to connect a monitor to a resource, such as an Azure App Service, and track exactly what we need depending on the application.

1. Follow [this](https://learn.microsoft.com/en-us/azure/app-service/tutorial-troubleshoot-monitor) tutorial on the Azure App Service docs and create a simple monitor for the spring-petclinic and confirm that your monitor is actually tracking logs.

?> Do not use the example they give you in the tutorial, use the spring-petclinic

#### Setup CI/CD and show changes

Continuous Integration and Continuous Deployment are essential for a DevOps Engineer to understand and practice. Using the spring-petclinic application, create a workflow for the fork that does the following:

* Builds and Pushes a Docker image to a container registry
* Deploys docker image to the App Service

Make a simple change to the spring-petclinic application and show that the changes you made will deploy to the App Service using your workflow.

## Deliverables

- Placeholder 0.o
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,19 @@ docs/4-cloud-computing/4.3.6-aks.md:
- Azure Kubernetes Service (AKS)
- Azure Container Registry (ACR)
- Node.js

docs/4-cloud-computing/4.3.7-app-service.md:
category: Cloud Computing
estReadingMinutes: 10
exercises:
-
name: Deploy Simple Web Application to App Service
description: Create A Web App and Scale and Monitor
estMinutes: 240
technologies:
- Azure
- Azure App Service
- Azure CLI
docs/5-software-development-practices/5.1-overview.md:
category: Agile Development
estReadingMinutes: 90
Expand Down
3 changes: 2 additions & 1 deletion docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
- [2.3 - Projects](2-Github/2.3-Projects.md)
- [2.4 - APIs](2-Github/2.4-APIs.md)
- [2.5 - Security](2-Github/2.5-Security.md)

- **Chapter 3**

- [3.0 - Virtual Machines and Containers](3-virtual-machines-containers/3.0-overview.md)
Expand Down Expand Up @@ -66,6 +66,7 @@
- [4.3.4 - Azure with Packer](4-cloud-computing/4.3.4-az-packer.md)
- [4.3.5 - ACI](4-cloud-computing/4.3.5-aci.md)
- [4.3.6 - AKS](4-cloud-computing/4.3.6-aks.md)
- [4.3.7 - App Service](4-cloud-computing/4.3.7-app-service.md)

- **Chapter 5**

Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"dependencies": {
"chart.js": "^4.3.0",
"chartjs-chart-wordcloud": "^4.2.0",
"docsify": "^4.13.0",
"docsify-cli": "^4.4.4",
"docsify": "^4.11.4",
"docsify-cli": "^4.4.2",
"docsify-sidebar-collapse": "^1.3.5",
"gray-matter": "^4.0.3",
"node-stdlib-browser": "^1.2.0"
Expand Down

0 comments on commit baf95ed

Please sign in to comment.