Fine-tuned TinyBERT with Nginx load balancing, Docker orchestration, and automated CI/CD on AWS
Production-grade sentiment analysis API featuring fine-tuned TinyBERT model, Nginx load balancing, multi-container orchestration, and automated deployment on AWS with zero-downtime scaling capabilities.
[Image: Screenshot of sentiment analysis web interface]
[Image: System architecture showing Nginx → FastAPI → S3 flow]
[Image: CI/CD pipeline diagram: Git → GitHub Actions → ECR → EC2]
[Image: Docker Compose multi-container orchestration diagram]
- TinyBERT optimized for sentiment classification
- Binary classification: Positive/Negative
- Model stored and versioned in AWS S3
- Reverse proxy architecture for production-grade setup
- Automatic request distribution across scaled instances
- Professional separation of concerns
- GitHub Actions for build and deployment
- Automatic image push to AWS ECR
- Zero-downtime deployments on EC2
- Scale API instances with single command:
--scale app=5 - Nginx automatically load balances across all instances
- Ready for production workloads
- Machine Learning: PyTorch, Transformers, TinyBERT
- Backend: FastAPI, Uvicorn
- Infrastructure: Docker, Docker Compose, Nginx
- DevOps & CI/CD: GitHub Actions, AWS (ECR, EC2, S3)
FineTuningBERT/
├── fastapi_app/
│ ├── app.py # FastAPI application with container-info endpoint
│ ├── get_model.py # S3 model downloader
│ ├── requirements.txt # Python dependencies
│ └── templates/
│ └── index.html # Web interface
├── tinybert-sentiment-analysis/
│ └── [Fine-tuned model files]
├── .github/workflows/
│ └── deploy.yml # CI/CD pipeline (build → push → deploy)
├── nginx.conf # Reverse proxy configuration
├── docker-compose.yml # Multi-container orchestration
├── Dockerfile # FastAPI container
├── Dockerfile.nginx # Nginx container
└── .env.example # Environment variables template
Request Flow:
User Request (Port 80)
↓
Nginx Container (Reverse Proxy)
↓
FastAPI Container(s) (Port 8000)
↓
TinyBERT Model (S3)
↓
Sentiment Prediction
CI/CD Pipeline:
Push to Main → Build Image → Push to ECR → Deploy on EC2 → docker-compose up
Local Development:
cp .env.example .env
docker-compose up -d
curl http://localhost/healthDeployment to EC2:
git push origin main # Triggers automated CI/CD👉 Complete Setup & Deployment Guide
- Fine-tuning and deploying transformer models
- Nginx reverse proxy and load balancing architecture
- Docker Compose for multi-container orchestration
- Horizontal scaling with Docker containers
- GitHub Actions CI/CD pipeline automation
- AWS cloud services (ECR, EC2, S3)
- Production-ready application design
- Health checks and monitoring best practices
- Infrastructure as Code principles
- Kubernetes Migration: Scale beyond Docker Compose
- Rate Limiting: Implement rate limiting in Nginx
- Monitoring: Prometheus + Grafana dashboards
- Caching: Redis for prediction caching
- Authentication: OAuth2/JWT for API security
Harsh Patel
📧 code.by.hp@gmail.com
🔗 GitHub • LinkedIn
⭐ If you find this project helpful, please star it!