Convert a monolith architecture based docker-compose application into a microservices based architecture.
- docker and docker-compose. Follow the guides based on your operating system.
- Internet. Pull docker image
python:3.8-alpinebeforehand to avoid connectivity issues.
├── README.md
├── docs
│ └── <documentation related images/files>
├── microservices
│ ├── Docker-compose.yaml
│ ├── landing
│ │ ├── app
│ │ │ ├── app.py
│ │ │ ├── requirements.txt
│ │ │ └── templates
│ │ │ └── index.html
│ │ └── Dockerfile
│ │
# under the microservices directory
docker-compose -f Docker-compose.yaml up --build
access the html page in localhost:5050
docker-compose down
-
- Dockerfiles help building images using a given set of instructions. You can learn about the basics of Dockerfiles here. Use this document to understand the meaning of certain keywords used by Dockerfiles.
- Dockerfiles help building images using a given set of instructions. You can learn about the basics of Dockerfiles here. Use this document to understand the meaning of certain keywords used by Dockerfiles.
-
- By default, Python considers all input as string. The types are checked in the
app.pyof every microservice - Fix the type of the two variable values received from
index.html
- Avoid the crash by handling the exceptions raised in the landing-service app.
- By default, Python considers all input as string. The types are checked in the
-
- The four arithmetic functions if they reside under landing-service and the landing-service were to become unavailable for whatever reason, the four functions would be unavailable as well.
- The
Docker-compose.yamlis updated to recognize the flask applications as separate services. TheDocker-compose.yamldefines the port number and network alias that will be used bylanding-serviceto communicate within the entire architecture
add: Takes two numbers as arguments and returns their sumsubtract: Takes two numbers as arguments and returns their differencemultiply: Takes two numbers as arguments and returns their productdivision: Takes two numbers as arguments and returns their quotientgcd: Takes two numbers as arguments and returns their Greatest Common Divisorlcm: Takes two numbers as arguments and returns their Least Common Multiplemodulus: Returns the remainder of two numbers after division. Referenceexponent: Returns the result of the arithmetic operation abgreater_than: ReturnTrueif the first value is greater than the second elseFalseless_than: returnTrueif the first value is less than the second elseFalseequal: returnTrueif the first value is equal to the second elseFalse
├── <name of the service>
│ ├── Dockerfile # same as landing/Dockerfile
│ ├── app
│ │ ├── app.py
│ │ └── requirements.txt
│ │

