Zkt22/z3
2022-05-22 16:26:06 +05:30
..
fruitapp-main final ass 2022-05-22 16:10:18 +05:30
images final ass 2022-05-22 16:10:18 +05:30
src final ass 2022-05-22 16:10:18 +05:30
az-docker-compose.yml change registry name 2022-05-22 16:26:06 +05:30
prepare-app.sh change registry name 2022-05-22 16:26:06 +05:30
README.md final ass 2022-05-22 16:10:18 +05:30
stop-app.sh final ass 2022-05-22 16:10:18 +05:30

Fruit app

Overview of the APP

The application consist of two parts, an API and a front end. The application displays 5 fruits which are seeded to the database at the startup. The get API provides the list of fruits. Anyone can like a fruit. In this case the count of like will be increased.

homepage

Technology used

  • Flask (Backend Rest API)
  • Angular (Frontend)
  • MySQL - as persistent database
  • Azure
  • Docker

prerequist:

Azure public Cloud :

Microsoft Azure is a cloud computing service operated by Microsoft, often referred to as Azure. it offers more than 200 cloud products and services designed to solve todays challenges. We used this cloud to deploy our fruit-app application in the cloud.

Here is a list of used services:

  • Resource group: Azure Resource Groups are logical collections of azure service. it is used to group a collection of services to easy manage them.

  • Azure App Service: categorized as Platform as a Service, provides a service that allows you to build, manage, and deploy enterprise-grade scaled web apps without managing the underlying infrastructure.

  • ACR: Azure Container registry of Docker images to store our images.

  • Mysql Database: One of zure services to create/manage databases (like mysql or postgresql).

  • Identity Access management(IAM): is a web service that helps securely control access to Azure resources. We use IAM to control who is authenticated (signed in) and authorized (has permissions) to use resources.

Folder structure:

Description of the folder structure:

  • src: contain the application code
  • prepare-app.sh: Script to build the docker image for the application and deploy the app to the azure cloud using commands
  • stop-app.sh Script to stop and remove the app
  • README.md: Documentation file
  • az-docker-compose.yml: Docker compose for the webapp for azure configuration.

Methode of communication:

For the communication between:

  • Mysql-backend: The credentials for mysql are passed to the backend application as environement variables.

  • frontend-backend: For the connection between the frontend and backend, we used the nginx base image for our frontend image. Also ConfigMap is used to store nginx configuration file to forward all the /api request to the backend service.

How to prepare, run, pause and delete the application.

Prepare the app

Now to prepare the application you have to run the command :


sh prepare-app.sh

the script which will create a resource group named 'suhailgroup' and will add all the required services for our application to run.

To stop the app

The stop-app.sh script will remove the resources group and all the created services related to that group.

Workflow:

Here is our deployment workflow:

1 - Build our application image locally.

2- Creat the resource group to group our application service in order to be able later to manage them as unit.

3- Creat a azure container registry to store our application image.

4- Tag the previous built images and push them to the created ACR registry.

5 - Creat and grand acrpull permission to a Identity service in order to use it later to pull our images from the web app service.

6- Creating Mysql database and padate the firewall rule to allow external access to database.

7 - Creat the webapp service for our application( we used the --acr-identity arguement to pass the Identity role we created prevouisly created and a docker-compose to run for the application) and also passing the environment variables for database access to that webapp containers .

How to view the application on the web.

The application is accessible through: https://suhail5742.azurewebsites.net/

Restart the service on failure:

In order to have a heigh availibiity for our application, we added the restart docker option ,to restart our containers if they exits due to an error:


restart: on-failure:5

resources:

Deploy docker image to azure webapp Create web app in azure Docker compose options for azure
Azure Mysql Service
Azure web app Commands
Azure identity management