Zkt22/z3
2022-05-22 21:31:35 +00:00
..
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 fix double quotes 2022-05-22 16:39:20 +05:30
README.md Update 'z3/README.md' 2022-05-22 21:31:35 +00:00
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, generally known as Azure, is a cloud computing service provided by Microsoft. It provides over two hundred cloud products and services developed to address today's concerns. This cloud was applied to deploy our fruit-app application on the cloud.

Here is a list of used services:

  • Resource group: Azure Resource Groups (ARGs) are logical groups of Azure services. It is used to organise a collection of services in order to manage them more easily.

  • Azure App Service: Platform as a Solution (Platform as a service) is a service that allows you to design, maintain, and deploy organisation scaled web apps without having to handle the network technology.

  • 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 - Create a local image of our application.

2- Construct a resource group to group our application services so that they can be managed as a single entity afterwards.

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

4- Tag and upload the previously produced photos to the ACR registry.

5 - Create and provide access to an Identity service so that we may use it to extract our photos from the web app service later.

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

7 - Create the webapp service for our application (we used the —acr-identity argument to provide the previously built Identity role and a docker-compose to run for the application) as well as giving 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