This repository is for an assigment given by the
Refinitiv
devops crew.
This repository contains a python flask
application
and an nginx
configuration as a load balancer.
-
A user sends an HTTP request for the exposed address of
nginx
with the uri/api/ip
to receive the ip address from one of the applications. -
The
nginx
load balancer will forward the request to one of the application written in the configuration file in around-robin
fashion. -
When an application receives the request, It will return a json with the requested data. Exmaple:
{ "ip-address" : "172.17.0.3" }
To deploy the environment, there is a shell
script in the main
repository directory named deploy_refinitiv_app.sh
. You need to
run it as root in order to deploy docker containers.
To test the environment, there are two options:
-
Use the
test_refinitiv_app.sh
shell script to test the results returned from the applications. -
Open up a web browser and go to
http://localhost:8080/
. This will open the main page of an application with a simple explanation on how to use it.
URI Endpoint | Returned Value |
---|---|
/ | Will return the main page with URI explanation like this |
/ip | Will return the host ip address |
/time | Will return the current date & time |
/api/ip | Will return the host ip address in JSON format |
/api/time | Will return the current date & time in JSON format |