Homework #6
Coding → Deploy → Code-review
Coding
Preparations
- Install Python programming language v3.8.2: https://www.python.org/downloads/
- Install Docker: https://docs.python.org/3/installing/index.html#basic-usage
- Install Docker-compose: https://docs.docker.com/compose/install/
What you already have after task #5
- Flask web application, which can authenticate user with password:
- Listen on
localhost:5000
- Render authentication form on
http://localhost:5000/
- Return static images and files on
http://localhost:5000/static/<image_name>
- Has secret page for authenticated users on
http://localhost:5000/cabinet
- Listen on
- Valid usernames and passwords are stored in MongoDB database
- Image upload function in cabinet
http://localhost:5000/cabinet/
- Images are being saved to
upload
folder
Basic part
- Create
docker-compose.yml
andDockerfile
to run your application in Docker - Move your sources to
src
directory. Don’t forget to createrequirements.txt
file - In
docker-compose.yml
there are gonna be two containers named:mongodb
,flask-simple
- Setup port forwarding and run
docker-compose up
. Check that website works onhttp://localhost:5000
Optimal part
- Add persistent volume for MongoDB
- Mount
upload
directory toupload
directory insideflask-simple
container
Challenging part
- Add Nginx which will proxy requests to flask application
- Add Redis cache for uploaded images
Deploy
- Register on GitHub: https://github.com/
- Join our organization: https://github.com/itmo-wad/
- You can create new personal repository or use repository for the previous tasks (but don’t remove old files, just append new directories)
- Commit and push your sources to GitHub. And don’t forget to describe shortly what have you done in
README.md
file. Use Markdown format: https://guides.github.com/features/mastering-markdown/
Code-review
- Communicate in Telegram chat
- Help others to complete the assignment