danielchristopher513 / Calculator_Microservices

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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

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.


Languages

Language:Python 60.4%Language:Dockerfile 28.8%Language:HTML 10.9%