Best Flask open-source libraries and packages

Flask SokcetIO Kafka DockerCompose

Horizontal scaling of WebSockets using KAFKA, FLASK, and SOCKET.IO
Updated 1 month ago

Flask Kafka Python

Horizontal scaling of websockets using KAFKA

  • Tech Stack : Flask, Kafka and Socket.IO
$ First change the path in start.sh file

To start the Kafka and Python server

$ ./start.sh -u

To stop the Kafka and Python server

$ ./start.sh -d

Good to go!

Optional (Not neccessary) - For educatiional purpose :p

To add the Docker network:

  • this is need for kafka broker to communicate with python servers
$ docker network rm kafka-network
  • Spin up the local single-node Kafka cluster (will run in the background):
$ docker-compose -f docker-compose.yml up -d
  • Check the cluster is up and running (wait for "started" to show up):
$ docker-compose -f docker-compose.yml logs -f broker | grep "started"
  • Start the Python Producer and Consumer server (will run in the background):
$ docker-compose -f prod-consumer-docker/docker-compose.yml up -d

Stopping

To stop the Python Producer and Consumer server:

$ docker-compose -f prod-consumer-docker/docker-compose.yml down -v

To stop the Kafka cluster:

$ docker-compose -f docker-compose.yml down -v

To remove the Docker network:

$ docker network rm kafka-network