- I have created a Dockerfile that sets up a python 3.9 environment, installs dependencies from requirements.txt, exposes the main.py file on port 5050, and runs this main.py file in the /app directory.
- The nginx.config file configures nginx as a reverse proxy with load balancing, forwarding requests to the instances of the Flask app.
- The docker-compose.yml file defines two services (flask application and nginx reverse proxy) with port mapping and dependencies. It sets up a shared network (app-network) between the two services.
- By default round robin algorithm is used for laod balancing the multiple instances of the Flask app, for fair distribution.
I believe that for a multi tenant SaaS like the cron job manager, the weighted round robin algorithm would best suit it's needs. This is because the higher priority jobs will be served more frequently. So this ensures the fair utilization of resources while keeping in mind the priorities.