Skip to content

Microservices architecture design built using Python, Rabbitmq, Postgresql, Mongodb to build a video to Mp3 conversion API.

License

Notifications You must be signed in to change notification settings

regiapriandi012/api-convert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Microservices Kubernetes - System Design

Microservices architecture design built using Python, Rabbitmq, Postgresql, Mongodb to build a video to Mp3 conversion API.

animated

API Convert Video to MP3

image

Used Technology

Python RabbitMQ Postgres MongoDB Kubernetes Docker Flask JWT

Configure Kubernetes

  • Configure Auth DB

    $ cd python-microservices-kubernetes
    $ kubectl apply -f postgresql/manifest/
    
  • Configure File DB

    $ cd python-microservices-kubernetes
    $ kubectl apply -f mongodb/manifest/
    
  • Configure Rabbitmq Queue

    $ cd python-microservices-kubernetes
    $ kubectl apply -f rabbit/manifest/
    
  • Configure Auth App

    $ cd python-microservices-kubernetes
    $ kubectl apply -f python/src/auth/manifest/
    
  • Configure Gateway App

    $ cd python-microservices-kubernetes
    $ kubectl apply -f python/src/gateway/manifest/
    
  • Configure Converter App

    $ cd python-microservices-kubernetes
    $ kubectl apply -f python/src/converter/manifest/
    
  • Configure Notification App

    $ cd python-microservices-kubernetes
    $ kubectl apply -f python/src/notification/manifest/
    

Access The Service

  • Gateway (App) > IP:30002

  • Auth DB (Postgresql) -> IP:30003

  • Rabbitmq Manager (Queue) -> IP:30004

  • File DB (Mongodb) -> IP:30005

Add Auth User

--Create Database User
CREATE TABLE user (
    id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    email VARCHAR (255) NOT NULL,
    password VARCHAR (255) NOT NULL
);

--Add Username and Password for User
INSERT INTO user (email, password) VALUES ('you@gmail.com', '123456');

Configure Queue on Rabbitmq

  • Access manager on IP:30004

    Username: guest (default)
    Password: guest (default)
    
  • Add Queues

    image

Testing

  • Login

    $ curl -X POST 192.168.56.2:30002/login -u regiapriandi012@gmail.com:12345
    eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InJlZ2lhcHJpYW5kaTAxMkBnbWFpbC5jb20iLCJleHAiOjE2Njk2MTUxMjEsImlhdCI6MTY2OTUyODcyMSwiYWRtaW4iOnRydWV9.YpNpfTBJLI7u3v6lwDZphGPBnjc83t7m9DkUnTXifpU
    
  • Upload Video

    $ curl -X POST -F 'file=@./video.mp4' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InJlZ2lhcHJpYW5kaTAxMkBnbWFpbC5jb20iLCJleHAiOjE2Njk2MTUxMTIsImlhdCI6MTY2OTUyODcxMiwiYWRtaW4iOnRydWV9.TgMr3Uwk5pnZNrCMWYZfsdkBrTfx2IMnYbET_iwJu-g' 192.168.56.2:30002/upload
    
  • Get Mp3 file ID

    image
  • Download Mp3

    curl --output video.mp3 -X GET -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InJlZ2lhcHJpYW5kaTAxMkBnbWFpbC5jb20iLCJleHAiOjE2Njk2MTUxMTIsImlhdCI6MTY2OTUyODcxMiwiYWRtaW4iOnRydWV9.TgMr3Uwk5pnZNrCMWYZfsdkBrTfx2IMnYbET_iwJu-g' "192.168.56.2:30002/download?fid=63830df2667a14a04a9d99b9"
    
  • Show Mp3 downloaded

    $ ls | grep .mp3
    video.mp3
    

Releases

No releases published

Packages

No packages published