Skip to content
 
 

Repository files navigation

🎧 Microservices Video-to-Audio Converter

Build Status Kind Helm Taskfile Docker RabbitMQ MongoDB PostgreSQL API Ready


🧩 Overview

📺 Demo Video: Deploy Microservices to Kubernetes KIND Cluster
Watch the video

This project demonstrates a complete microservices-based video-to-audio converter built using:

  • Kubernetes (Kind)
  • Helm Charts
  • RabbitMQ
  • PostgreSQL & MongoDB
  • Taskfile for automation
  • Python microservices

The system converts uploaded MP4 videos into MP3 audio and emails the result using a decoupled architecture with queues.

Feature: feature/return-mp3-fid-on-upload. Temp Queue for Returning MP3 File ID on Upload

This branch introduces a temporary reply queue mechanism that allows the upload endpoint to immediately return the generated MP3 file ID (mp3-fid). This streamlines the workflow by making the mp3-fid readily available for use with the download endpoint.


🧰 Devbox Environment

Devbox simplifies your development environment using Nix. A devbox.json is included to help automate setup.

🔧 Why Devbox?

  • Reproducible local development
  • No manual installation of tools
  • Easy provisioning on WSL or new systems

📦 Installed Packages

  • kubectl, kind, helm, task
  • python311, pip, jq, curl, zip, git
  • mongosh, psql, and more

🐧 Install on WSL

curl -fsSL https://get.jetpack.io/devbox | bash
cd your-project-directory/
devbox shell

Add more tools via devbox add <tool>.


🛠️ Taskfile: Automation Made Easy

Taskfile is a YAML-based task runner like Makefile, used here to automate:

  • Cluster creation
  • Helm chart installs
  • Microservice deployment
  • API testing

🔧 Install Task

# macOS
brew install go-task/tap/go-task

# Linux
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d

💡 Common Commands

task kind:01-create-cluster
task helm:install-all
task svc:install-all
task api:test-all

Located in:

kind-installation-and-setup/
Helm_charts/
src/

🧱 KIND Cluster Overview

This project runs locally on a KIND (Kubernetes IN Docker) cluster with a custom configuration to support service exposure, Helm deployments, and local development.

Kind lets you spin up a full Kubernetes cluster inside Docker containers — no need for cloud services or VMs.

If running on windows, make sure Docker Desktop is installed.

🗺️ Cluster Nodes

kind-control-plane
kind-worker
kind-worker2
kind-worker3

Check:

kubectl get nodes -o wide

⚙️ Cluster Creation

Config: kind-installation-and-setup/kind-config.yaml

kind create cluster or
task kind:01-create-cluster

This command:

Pulls a lightweight Kubernetes Docker image from docker hub

Starts a control plane node (as a Docker container)

Sets up kubectl context to point to the new cluster

🌐 Exposed Ports

Service Container NodePort Purpose
API Gateway 5000 30002 Login, upload, download endpoints
PostgreSQL 5432 30003 Used internally by auth-server
RabbitMQ Mgmt UI 15672 30004 Debug queue processing
MongoDB 27017 30005 File storage via GridFS

Exposing services allows local tools (e.g., curl, browsers, psql) to communicate directly for testing/debugging.


⚡ Quickstart in 4 Commands

cd kind-installation-and-setup/
task kind:01-create-cluster

cd ../Helm_charts/
task helm:install-all

cd ../src/
task svc:install-all

task api:test-all

Update .env before running.


🏗️ Architecture

Architecture


📂 Directory Structure

.
├── kind-installation-and-setup/
│   ├── kind-config.yaml
│   └── Taskfile.yml
├── Helm_charts/
│   ├── Postgres/
│   ├── MongoDB/
│   ├── RabbitMQ/
│   └── Taskfile.yml
├── src/
│   ├── auth/
│   ├── gateway/
│   ├── converter/
│   ├── notification/
│   ├── assets/
│   └── Taskfile.yml
├── .env

🧩 Microservice Components

Name Role
auth-server JWT login auth
gateway-server API Gateway for user interaction
converter-module Converts MP4 to MP3 using RabbitMQ
notification Sends email with MP3 file ID
RabbitMQ Message broker
MongoDB Stores files via GridFS
PostgreSQL Stores users, sessions

🔑 API Usage

Login

curl -X POST http://localhost:30002/login -u email:password

Upload

curl -X POST -F 'file=@./video.mp4' -H "Authorization: Bearer <TOKEN>" http://localhost:30002/upload

Download

curl -o audio.mp3 -H "Authorization: Bearer <TOKEN>" "http://localhost:30002/download?fid=<id>"

📧 Email Notification Setup

Configure Gmail via:

  1. Enable 2FA
  2. Create App Password
  3. Add credentials to src/notification/manifest/secret.yaml

🛠️ Helm Usage

Modify values under:

Helm_charts/*/values.yaml

Services:

  • PostgreSQL
  • MongoDB
  • RabbitMQ

🔁 Taskfile Commands Reference

task api:login
task api:upload
task api:download -- FILE_ID=<id>

🧼 Clean Up

cd kind-installation-and-setup/
task kind:04-delete-cluster

🙌 Acknowledgements

Based on: @N4si/microservices-python-app

Enhancements by Rabie:

  • KIND support
  • Taskfile automation
  • Devbox env setup
  • Improved testing by adding temporary queue to receive mp3 id as a return from video upload to be used for downloading, instead of getting the id from the email which broke the testing automation
  • added liveness/readiness probes to svcs to enhance healing and observability
  • added init containers to svc to wait for dbs and rmq to enhance reliability and forcing start ordering
  • added pvc to postgres deploy so config can survive restarts
  • fixed dbs storage config and make it more dynamic by using kind standard provisioner and removed un used storage classes
  • enhanced the microservices codes by added while loop while connecting to rmq to enhance self healing when rmq crashes or restarts
  • added extra mounts in kind to be used for pv/pvcs to simulate permanent storage for dbs and rmq
  • enhanced notification service observability and reliability by checking the success of emailing as well as the existence of credentials
  • enhanced postgres helm chart to add the init.sql to the deployment instead of manual running after deployment
  • Documentation

📮 Contact

Built with ❤️ by Rabie Rabie
📧 [email protected]
🔗 myresume.rabietech.dpdns.org
🐙 GitHub Profile

Open an issue or PR to contribute!

About

Video to audio converter microservices application in Python

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages