96 lines
3.5 KiB
Markdown
96 lines
3.5 KiB
Markdown
|
# Product manager
|
|||
|
|
|||
|
## Overview of the APP
|
|||
|
|
|||
|
This is a product management application for admin. Here you can upload, edit, delete products. Probably a front-end
|
|||
|
will show these products to the user if future.
|
|||
|
|
|||
|
_Edit functionality is not implemented at this moment_
|
|||
|
|
|||
|
![homepage](images/product-manager-homepage.png?raw=true 'System Architecture')
|
|||
|
|
|||
|
## Requirements
|
|||
|
|
|||
|
The basic system requirements are as follows
|
|||
|
|
|||
|
- Any OS, preferably Linux
|
|||
|
- Docker
|
|||
|
- Azure cloud
|
|||
|
|
|||
|
## Architecture
|
|||
|
|
|||
|
![System design diagram](images/product-manager.jpg?raw=true 'System Architecture')
|
|||
|
|
|||
|
## Technology used
|
|||
|
|
|||
|
- Django (Backend Rest API)
|
|||
|
- React (Frontend)
|
|||
|
- Postgres - as persistent database
|
|||
|
- Docker
|
|||
|
|
|||
|
## Azure public Cloud :
|
|||
|
|
|||
|
Azure cloud , it's a platform with more than 200 products and cloud services designed to help bring new solutions to life—to solve today’s challenges and create the future. We used this cloud to deploy the product manager application. 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.
|
|||
|
|
|||
|
- **ACR**: A registry to store Docker images in azure cloud.
|
|||
|
|
|||
|
- **Postgres Database**: One of azure services to manage postgresql databases.
|
|||
|
|
|||
|
- **Container**: It is a service that enables developers to deploy containers without having to provision or manage any underlying infrastructure.
|
|||
|
|
|||
|
## Folder structure:
|
|||
|
|
|||
|
Description of the folder structure:
|
|||
|
|
|||
|
- **README.md**: Documentation file
|
|||
|
- **src**: the root folder for the app source code.
|
|||
|
- **prepare-app.sh**: Script to build/tag/push our docker images and for deploying the app to the azure cloud using commands.
|
|||
|
- **stop-app.sh** Script to stop and remove the app from azure.
|
|||
|
|
|||
|
## Methode of communication:
|
|||
|
|
|||
|
For the communication between:
|
|||
|
|
|||
|
- Backend and database: The credentials for database are passed to the backend application as environement variables.
|
|||
|
|
|||
|
- Frontend and backend: For the connection between the frontend and backend, we used the nginx base image for our frontend image and we configured it to redirect all the api request to the backend url.
|
|||
|
|
|||
|
## Run/stop the app
|
|||
|
|
|||
|
### Prepare the app
|
|||
|
|
|||
|
The script will build/tag/push our docker images and deploy the app to the azure cloud using commands.
|
|||
|
|
|||
|
```
|
|||
|
sh prepare-app.sh
|
|||
|
```
|
|||
|
|
|||
|
### To stop the app
|
|||
|
|
|||
|
The `stop-app.sh` script will remove the resource group and all the services linked to that group.
|
|||
|
|
|||
|
## Viewing the app
|
|||
|
|
|||
|
The link for the application will be print in the end of the prepare-app script.
|
|||
|
|
|||
|
## Workflow:
|
|||
|
|
|||
|
1- I create resource group to group our application service in order to be able to manage them as unit.
|
|||
|
|
|||
|
2- I Create a azure container registry to store my application images.
|
|||
|
|
|||
|
3- I build,tag and push my application frontend backend images to the prevouis created registry.
|
|||
|
|
|||
|
4- I Create Postgresql database and update the firewall rule to allow external access to database.
|
|||
|
|
|||
|
5- I create the containers services(front/back) for the application and pass all the necessary env variables.
|
|||
|
|
|||
|
## Resources:
|
|||
|
|
|||
|
- [Building and Running Container Images with ACR, ACI and the Azure CLI](https://markheath.net/post/build-container-images-with-acr)
|
|||
|
- [Azure web app Commands](https://docs.microsoft.com/en-us/cli/azure/webapp?view=azure-cli-latest)
|
|||
|
- [Deploying postgres to azuer](https://docs.microsoft.com/en-us/azure/postgresql/tutorial-design-database-using-azure-cli).
|
|||
|
- [Deploying a container instance using the Azure CLI](https://www.testpreptraining.com/tutorial/deploying-a-container-instance-using-the-azure-cli/)
|