What is a Chat service?
A chat service accepts three APIs
Methods:
a. GET /<room>
- returns the static html provided to you, regardless of the room provided.
b. GET /chat/<room>
- returns the full chat in a room, data is load from file /data/<room>.txt
and show the page
c. POST /chat/<room>
- accepts a chat line from a user
/data/<room>.txt
<room>
is the number such as 123 or 1234, etc.
Following is a recommendation on implementation order:
a. Implement Flask app that returns the static html on GET /.
b. Now add new page GET /<room>
will show the same page above.
c. Implement GET /chat/<room>
will show the data loaded from file (create by manual for now).
d. Implement POST /chat/<room>
to save chat data. Check with another room and another browser.
DevOps Section
a. Package application in docker-image
b. Create docker-compose toplogy comprising of:
c. Test and prove that:
d. Make this work with arbitrary scaling, i.e. 1 nginx and several chat servers as defined by docker-compose “scale” parameter.
Note that in the case of –scale, it is good enough if the UI just shows any indication that differs between servers. It does not have to be “friendly”
Bonus Section
Replace the file based storage with a dockerized MySQL.
Implement as much as you can. Goodluck!!!
[Test with docker-container]
[Test with docker-compose]
[Test with docker-compose –scale]