Breaking down monoliths πͺ¨βοΈ
Microservices-based Calculator Application
This is a microservices-based calculator application that allows users to perform various arithmetic operations. The application is built using Flask and Flask-RESTful and consists of multiple services that are orchestrated using Docker Compose. The frontend of the application is built using HTML and JavaScript.
Services
The application consists of the following services:
- Addition Service: This service provides the functionality to add two numbers.
- Subtraction Service: This service provides the functionality to subtract two numbers.
- Multiplication Service: This service provides the functionality to multiply two numbers.
- Division Service: This service provides the functionality to divide two numbers.
- GCD Service: This service provides the functionality to calculate the Greatest Common Divisor of two numbers.
- LCM Service: This service provides the functionality to calculate the Least Common Multiple of two numbers.
- Modulus Service: This service provides the functionality to calculate the remainder of two numbers after division.
- Exponent Service: This service provides the functionality to calculate the result of a power operation.
- Greater Than Service: This service provides the functionality to check if the first value is greater than the second value.
- Less Than Service: This service provides the functionality to check if the first value is less than the second value.
- Equal Service: This service provides the functionality to check if the first value is equal to the second value.
Requirements:
- docker and docker-compose. Follow the guides based on your operating system.
- Internet. Pull docker image
python:3.8-alpine
beforehand to avoid connectivity issues.
Initial directory structure
βββ README.md
βββ docs
β βββ <documentation related images/files>
βββ microservices
β βββ Docker-compose.yaml
β βββ landing
β β βββ app
β β β βββ app.py
β β β βββ requirements.txt
β β β βββ templates
β β β βββ index.html
β β βββ Dockerfile
β β
Initial Monolith architecture diagram
Converted to Microservices-based architecture diagram
Build & Run
# under the microservices directory
# NOTE: For any code changes to be reflected, the build command must be rerun, and then up
docker-compose build
# run without the -d flag incase you want to observe the logs
docker-compose u
To stop the services in detached mode
docker-compose down