Auto Shop is made up of 4 individual microservices written in python using the flask framework: Attached below is the architectural breakdown.
- PortalService: The frontend of application storefront allowing you to view order or purchase items
- ProductManagement: Flask API communicating with MongoDB Atlas to fetch all and individual products.
- OrderManagement: Flask API communicating with MongoDB Atlas to store purchased orders and generate orderId upon purchase
- NotificationGateway: Flask API built using Mailjet to send email when purchase is made
- Create Free MongoDB Atlas Account: https://www.mongodb.com/cloud/atlas/register
- Create MongoDB Cluster: https://www.mongodb.com/docs/guides/atlas/cluster/
- Create Free MailJet Account: https://app.mailjet.com/signup?lang=en_US
- Python 3 Installed: https://www.python.org/downloads/
- Fork repository and clone onto your machine
- You will need to store your mongodb username, password, and cluster in the OrderManagement, ProductManagement, and NotificationGateway {service}/src/.env file
MONGO_USERNAME=
MONGO_PASSWORD=
MONGO_CLUSTER=
- You will need to store your Mailjet API Key and Session in your NotificationGateway {service}/src/.env file
MAILJET_API_KEY=
MAILJET_API_SECRET=
MAILJET_SENDER_MAIL=
- Create a virtualenv in the root of the project then activate it
python3 -m venv venv
source venv/bin/activate
- In order to successfully run each microservice, you will need to open 4 terminal windows
- cd into each service and run the following. This will install the required dependencies each service needs into your virtual environment
pip install -r requirements.txt
- run each service with the following
python3 app.py
- Open PortalService in https://127.0.0.1:5001
In the forked repository, you will need to:
- Add DOCKER_USERNAME, and DOCKER_PASSWORD to your Settings > Secrets & Variables > Actions.
- With a push to the main branch, git actions will trigger CI/CD Pipeline to build docker images
- Script can be found in .github/workflows/automation.yaml
The below will create the namespace app with the deployments and services needed to run the application
$ cd kubernetes/
$ kubectl apply -f autoshop-deployment.yaml
To then view the application in the browser run
$ kubectl port-forward svc/portal 5001:5001 -n app
you will need to cd into each service and run
$ opentelemetry-instrument python3 app.py
To run in docker reference the following docker-compose.yaml by running
$ docker-compose up