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.
Microsoft Azure, generally known as Azure, is a cloud computing service provided by Microsoft. It provides over two hundredcloud products and services developed to address today's concerns. This cloud was applied to deploy our fruit-app application on the cloud.
- **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.
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.
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](https://www.azuredevopslabs.com/labs/vstsextend/docker/)
[Create web app in azure](https://docs.microsoft.com/en-us/azure/devops/pipelines/apps/cd/deploy-docker-webapp?view=azure-devops&tabs=java%2Cyaml)
[Docker compose options for azure](https://docs.microsoft.com/en-us/azure/app-service/configure-custom-container?pivots=container-linux#docker-compose-options)
[Azure Mysql Service](https://azure.microsoft.com/en-us/services/mysql/#overview)
[Azure web app Commands](https://docs.microsoft.com/en-us/cli/azure/webapp?view=azure-cli-latest)