This is a FastApi implementation of the video to mp3 converter system demonstrated at Kantan Coding
- Gateway
- Gateway to the system for handling all incoming requests from clients.
- Stores uploaded videos in a MongoDB database.
- Puts a message in RabbitMQ when a video is uploaded.
- users-service
- Responsible for user registration and user authentication.
- Stores user data in a MySql database.
- Converter-Service
- Consumes message from RabbitMQ to get video file ID and downloads the video.
- Converts the video to mp3 and stores in MongoDB.
- Puts a message in RabbitMQ with the mp3 file ID.
- Notification-Service
- Consumes message from RabbitMQ to get mp3 file ID.
- Sends email to the client with the mp3 file ID.
- Client can then send a request to the Api-Gateway with the mp3 file id along with his/her jwt to download the mp3.
- Required envs
Create a .env file in project root with the values from example.env file - Run docker compose
Or run in detached mode
$ docker compose up
$ docker compose up -d
- Visit for Api Docs
http://0.0.0.0:5000/docs
- Cleanup
$ docker compose down -v $ sudo rm -rf volMongo/ volMysql/ volRabbit/
Deploy to Kubernetes Cluster (minikube)
- Build your images and push them to dockerhub
- Set them appropriately in the deployment yaml files like so
apiVersion: apps/v1 ... spec: ... template: ... containers: - image: nahid111/py-micro-users
- Populate envs properly
MYSQL_HOST=mysql-service RABBITMQ_HOST=rabbitmq MONGODB_URL=mongodb://<YOUR_USER>:<YOUR_PASSWORD>@mongodb-service:27017/
- Change permission for deployment scripts
$ chmod +x deployment.sh $ chmod +x cleanup.sh
- Run
./deployment.sh
- Use the minikube service url outputted in the terminal
|-----------|---------------|-------------|---------------------------| | NAMESPACE | NAME | TARGET PORT | URL | |-----------|---------------|-------------|---------------------------| | default |gateway-service| 5000 | http://192.168.49.2:30312 | |-----------|---------------|-------------|---------------------------|
- For cleaning up, run
./cleanup.sh