A production-ready MLOps pipeline that demonstrates the complete lifecycle of a machine learning model β from training and experiment tracking to containerization and cloud deployment.
- Architecture
- Features
- Tech Stack
- Quick Start
- API Documentation
- CI/CD Pipeline
- Deployment
- Project Structure
- Screenshots
- Roadmap
βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββ
β GitHub ββββββΆβ GitHub ββββββΆβ Docker ββββββΆβ Render/ β
β Repo β β Actions β β Hub β β AWS β
βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββ
β β β β
βΌ βΌ βΌ βΌ
βββββββββββ βββββββββββ βββββββββββ βββββββββββ
β Code β β Tests β β Build β β Deploy β
β Push β β Train β β Image β β API β
βββββββββββ βββββββββββ βββββββββββ βββββββββββ
β²
β
βββββββββββββββ
β MLflow β
β (Tracking) β
βββββββββββββββ
- π― ML Model Training β RandomForest regression on California Housing dataset
- π Experiment Tracking β Full MLflow integration for parameters, metrics, and artifacts
- π³ Containerization β Multi-stage Docker build for optimized production images
- π CI/CD Pipeline β Automated training, testing, and deployment via GitHub Actions
- π REST API β FastAPI with auto-generated docs, batch predictions, and health checks
- π Monitoring Ready β Prometheus/Grafana hooks for production observability
- βοΈ Cloud Deployed β One-click deployment to Render, AWS, or Railway
| Layer | Technology |
|---|---|
| API Framework | FastAPI |
| ML Framework | Scikit-learn, XGBoost |
| Experiment Tracking | MLflow |
| Containerization | Docker, Docker Compose |
| CI/CD | GitHub Actions |
| Database | PostgreSQL (MLflow backend) |
| Cloud | Render / AWS EC2 / Railway |
| Testing | Pytest |
- Python 3.11+
- Docker & Docker Compose
- Git
git clone https://github.com/SanjayPhilip/modelforge.git
cd modelforge
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtcp .env.example .env
# Edit .env with your credentials (optional for local development)# Train with default parameters
python ml/train.py
# Or with custom hyperparameters
python ml/train.py --n-estimators 200 --max-depth 15# Option A: Direct Python
uvicorn api.main:app --reload
# Option B: Docker Compose (Full stack with MLflow)
cd docker
docker-compose up -d
# Access API: http://localhost:8000
# Access MLflow UI: http://localhost:5000
# Access API Docs: http://localhost:8000/docs# Health check
curl http://localhost:8000/api/v1/health
# Single prediction
curl -X POST "http://localhost:8000/api/v1/predict" \
-H "Content-Type: application/json" \
-d '{"features": [8.3252, 41.0, 6.9841, 1.0238, 322.0, 2.5555, 37.88, -122.23]}'
# Batch prediction
curl -X POST "http://localhost:8000/api/v1/predict/batch" \
-H "Content-Type: application/json" \
-d '{"features": [[8.3252, 41.0, 6.9841, 1.0238, 322.0, 2.5555, 37.88, -122.23], [8.3014, 21.0, 6.2381, 0.9718, 2401.0, 2.1098, 37.86, -122.22]]}'Once running, interactive API documentation is available at:
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
API info and links |
| GET | /health |
Health check with model status |
| GET | /ready |
Kubernetes readiness probe |
| GET | /live |
Kubernetes liveness probe |
| GET | /api/v1/health |
Detailed health check |
| GET | /api/v1/info |
Model metadata |
| POST | /api/v1/predict |
Single prediction |
| POST | /api/v1/predict/batch |
Batch predictions |
Push to PR branch
β
βΌ
GitHub Actions Triggered
β
ββββΆ Install Dependencies
ββββΆ Run Pytest (Unit + Integration)
ββββΆ Train Model
ββββΆ Upload Model Artifact
Push to main branch
β
βΌ
GitHub Actions Triggered
β
ββββΆ Build Docker Image
ββββΆ Push to Docker Hub
ββββΆ Deploy to Render (via webhook)
- Create a Web Service on Render
- Connect your Docker Hub image:
sanjayphilip/modelforge:latest - Set environment variables in Render dashboard
- Add
RENDER_DEPLOY_HOOKto GitHub Secrets for auto-deployment
# SSH into your EC2 instance
ssh -i your-key.pem ubuntu@your-ec2-ip
# Install Docker
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker ubuntu
# Pull and run
docker pull sanjayphilip/modelforge:latest
docker run -d -p 80:8000 --name modelforge sanjayphilip/modelforge:latest- Connect GitHub repo to Railway
- Railway auto-detects Dockerfile
- Add PostgreSQL plugin for MLflow backend
modelforge/
βββ .github/
β βββ workflows/
β βββ train.yml # PR: Train + Test + Evaluate
β βββ deploy.yml # Main: Build + Push + Deploy
βββ api/
β βββ main.py # FastAPI app entry point
β βββ router.py # API route handlers
β βββ schemas.py # Pydantic request/response models
βββ ml/
β βββ train.py # Training script with MLflow
β βββ evaluate.py # Model evaluation utilities
β βββ predict.py # Inference wrapper
β βββ utils.py # Data preprocessing
βββ models/ # Trained models (gitignored)
βββ data/
β βββ raw/ # Raw datasets
β βββ processed/ # Cleaned datasets
βββ notebooks/
β βββ eda.ipynb # Exploratory Data Analysis
βββ tests/
β βββ test_api.py # API endpoint tests
β βββ test_ml.py # ML pipeline tests
βββ docker/
β βββ Dockerfile # Multi-stage build
β βββ docker-compose.yml # Full stack orchestration
βββ requirements.txt
βββ setup.py
βββ .env.example
βββ README.md
MLflow experiment tracking dashboard
- Add Prometheus + Grafana monitoring
- Implement model versioning and A/B testing
- Add data drift detection
- Integrate with AWS SageMaker
- Add authentication to API endpoints
- Build Streamlit frontend for interactive predictions
- Add model explainability (SHAP values)
Sanjay Philip
- GitHub: @SanjayPhilip
- MCA Final Year | Saintgits College of Engineering, Kerala, India
- Passionate about Web Development, AI/ML, and Cybersecurity
This project is licensed under the MIT License.
β Star this repo if you find it useful!