A Python microservices application for video processing, including conversion to MP3, speech-to-text transcription, and OpenAI translation services.
- Docker
- kubectl
- minikube
- PostgreSQL (running on localhost:5432)
- MongoDB (running on localhost:27017)
Create/update Kubernetes secrets for the required credentials:
auth-secret:POSTGRES_PASSWORD,JWT_SECRETnotification-secret:GMAIL_ADDRESS,GMAIL_PASSWORDopenai-secret:OPENAI_API_KEY
Example:
apiVersion: v1
kind: Secret
metadata:
name: auth-secret
type: Opaque
stringData:
POSTGRES_PASSWORD: 'your-db-password'
JWT_SECRET: 'your-jwt-secret'-
Start Minikube:
make start
-
Enable ingress addon (required for host-based URLs):
minikube addons enable ingress -
Build images:
make build-all
-
Deploy services:
make deploy-all
-
Start tunnel (in another terminal):
make tunnel
-
Add local host mappings:
127.0.0.1 mp3converter.com rabbitmq-manager.com -
Access:
- Gateway: http://mp3converter.com
- RabbitMQ Management: http://rabbitmq-manager.com
All API requests go through the gateway at http://mp3converter.com.
Get a JWT token first:
TOKEN=$(curl -sS -X POST http://mp3converter.com/login \
-u "you@example.com:your-password")
echo "Token length: ${#TOKEN}"- Auth: User authentication and authorization (port 5000)
curl -i -X POST http://mp3converter.com/login \
-u "you@example.com:your-password"- Gateway: Main API gateway and request routing (port 8080)
curl -i http://mp3converter.com/- Converter: Video to MP3 conversion service
curl -i -X POST http://mp3converter.com/upload \
-H "Authorization: Bearer $TOKEN" \
-F "file=@/path/to/video-file"- Transcriber: Speech-to-text transcription service
curl -i -X POST http://mp3converter.com/transcribe \
-H "Authorization: Bearer $TOKEN" \
-F "file=@/path/to/audio-or-video-file"- Translator: AI-powered text translation using OpenAI GPT
curl -i -X POST http://mp3converter.com/translate \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"text":"Hello world","targetLang":"fr"}'curl -i -X POST http://mp3converter.com/translate \
-H "Authorization: Bearer $TOKEN" \
-F "file=@/path/to/audio-or-video-file" \
-F "targetLang=fr"-
Notification: Email notification service Triggered asynchronously after successful conversion; no direct gateway endpoint.
-
RabbitMQ: Message queue for service communication Access management UI at
http://rabbitmq-manager.com.
Download converted MP3 by file id:
curl -i -X GET "http://mp3converter.com/download?fid=<MP3_FILE_ID>" \
-H "Authorization: Bearer $TOKEN" \
-o output.mp3