{"id":31765110,"url":"https://github.com/ai-art-dev99/mlops-capstone","last_synced_at":"2026-04-09T18:39:55.509Z","repository":{"id":318694059,"uuid":"1072332833","full_name":"ai-art-dev99/mlops-capstone","owner":"ai-art-dev99","description":"End-to-end MLOps: training → MLflow → containerized FastAPI → Helm+HPA → Prom/Grafana → drift checks → CI/CD with GitHub Actions","archived":false,"fork":false,"pushed_at":"2025-10-08T16:09:08.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-08T18:36:18.762Z","etag":null,"topics":["autoscaling","cicd","docker","drift-detection","fastapi","github-actions","gke","grafana","helm","k6","kubernetes","machine-learning","mlflow","mlops","model-serving","monitoring","prometheus","terraform"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ai-art-dev99.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-08T15:17:29.000Z","updated_at":"2025-10-08T16:11:33.000Z","dependencies_parsed_at":"2025-10-08T18:36:22.246Z","dependency_job_id":null,"html_url":"https://github.com/ai-art-dev99/mlops-capstone","commit_stats":null,"previous_names":["ai-art-dev99/mlops-capstone"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ai-art-dev99/mlops-capstone","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ai-art-dev99%2Fmlops-capstone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ai-art-dev99%2Fmlops-capstone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ai-art-dev99%2Fmlops-capstone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ai-art-dev99%2Fmlops-capstone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ai-art-dev99","download_url":"https://codeload.github.com/ai-art-dev99/mlops-capstone/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ai-art-dev99%2Fmlops-capstone/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002382,"owners_count":26083356,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autoscaling","cicd","docker","drift-detection","fastapi","github-actions","gke","grafana","helm","k6","kubernetes","machine-learning","mlflow","mlops","model-serving","monitoring","prometheus","terraform"],"created_at":"2025-10-10T00:13:16.039Z","updated_at":"2025-10-10T00:13:18.045Z","avatar_url":"https://github.com/ai-art-dev99.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MLOps Capstone (End-to-End)\n\n**Training → MLflow → Containerized FastAPI Serving → Helm + HPA → Prometheus/Grafana → Drift Checks → CI/CD**\n\n[![CI/CD](https://img.shields.io/github/actions/workflow/status/ai-art-dev99/mlops-capstone/ci-cd.yml?branch=main)](https://github.com/ai-art-dev99/mlops-capstone/actions)\n[![Container](https://img.shields.io/badge/container-GHCR-blue)](https://github.com/users/ai-art-dev99/packages/container/package/mlops-capstone)\n[![License](https://img.shields.io/badge/license-Apache--2.0-green)](LICENSE)\n\n\u003e Cloud-agnostic project that demonstrates production-minded model deployment and ops. Works on any Kubernetes (kind/minikube/GKE/EKS/AKS); Terraform modules included for GKE Autopilot.\n\n---\n\n## ✨ What this shows\n- **Model training** (Adult income) with **MLflow** metrics \u0026 artifacts  \n- **Serving**: FastAPI (`/predict`, `/health`, `/metrics`) in a **Docker** image  \n- **Kubernetes deploy** via **Helm** with **HPA** (autoscaling)  \n- **Observability**: Prometheus metrics + Grafana dashboard JSON  \n- **Data drift** check via a **CronJob** (simple categorical shift)  \n- **CI/CD**: GitHub Actions → build \u0026 push to GHCR → deploy on release tag  \n- **IaC**: Terraform to create a **GKE Autopilot** cluster and install workloads\n\n---\n\n## 🧭 Architecture\n\n```\n            +------------------+\n            |   MLflow (UI)    |  \u003c-- optional Helm chart\n            +---------+--------+\n                      ^\n                      | metrics/artifacts\n+---------+  train    |\n| dataset | --------\u003e |                         +------------------+\n+----+----+           |                         |  Prometheus      |\n     |                |                         +----+-------------+\n     |                v                              ^\n     |      +--------------------+                   | scrapes /metrics\n     |      |  Train \u0026 Log (py)  |                   |\n     |      +---------+----------+                   |\n     |                | artifacts                    |\n     |                v                              |\n     |      +--------------------+                   |\n     |      | Dockerized FastAPI |\u003c------------------+\n     |      +----+-----------+---+    Service        |\n     |           |           |        +--------------v-----+\n     |        /predict    /metrics    |  K8s (Helm + HPA)  |\n     |                                 +-------------------+\n```\n\n---\n\n## 🚀 Quickstart (Local)\n\n```bash\n# 1) Setup\npython -m venv .venv \u0026\u0026 source .venv/bin/activate\npip install -r requirements.txt\n\n# 2) Train (sample or full OpenML dataset)\npython model/train.py --dataset sample     # fast\n# python model/train.py --dataset full     # downloads via OpenML\n\n# 3) Save drift baseline\npython monitoring/save_baseline.py\n\n# 4) Run the API\nuvicorn app.main:app --host 0.0.0.0 --port 8000\n\n# 5) Try it\ncurl -X POST http://localhost:8000/predict   -H \"content-type: application/json\" -d @sample_payload.json\n\n# 6) Metrics\ncurl http://localhost:8000/metrics\n```\n\n**Optional MLflow locally**\n```bash\ndocker compose -f ops/docker-compose.mlflow.yml up -d\n# UI: http://localhost:5000\n```\n\n**Docker**\n```bash\ndocker build -t mlops-capstone:latest .\ndocker run --rm -p 8000:8000 mlops-capstone:latest\n```\n\n**k6 load test**\n```bash\nk6 run ops/loadtest/k6-smoke.js\n```\n\n---\n\n## ☁️ Deploy to Kubernetes\n\nInstall the Prometheus/Grafana stack (optional but recommended):\n```bash\nhelm repo add prometheus-community https://prometheus-community.github.io/helm-charts\nhelm upgrade --install kube-prometheus-stack prometheus-community/kube-prometheus-stack   -n monitoring --create-namespace\n```\n\nDeploy the app:\n```bash\nhelm upgrade --install capstone ./deploy/helm/app   -n mlops --create-namespace   --set image.repository=ghcr.io/ai-art-dev99/mlops-capstone   --set image.tag=latest\n```\n\nEnable Ingress (edit `deploy/helm/app/values.yaml`):\n```yaml\ningress:\n  enabled: true\n  className: nginx\n  hosts:\n    - host: domain.com\n      paths:\n        - path: /\n          pathType: Prefix\n```\n\n---\n\n## 🧱 Repo Layout\n\n```\n.\n├── app/                     # FastAPI service\n├── model/                   # Training + artifacts\n├── monitoring/              # Drift job + baseline script\n├── deploy/helm/app          # App Helm chart (ServiceMonitor + CronJob)\n├── deploy/helm/mlflow       # MLflow Helm chart (optional)\n├── infra/gke                # Terraform: GKE Autopilot cluster\n├── infra/workloads          # Terraform: Helm releases (prom stack + app)\n├── ops/dashboards           # Grafana dashboard JSON\n├── ops/loadtest             # k6 scripts\n├── .github/workflows        # CI/CD\n├── sample_payload.json\n└── requirements.txt\n```\n\n---\n\n## 🔧 Configuration\n\n**Environment variables (service)**\n- `MODEL_PATH` (default `model/artifacts/model.pkl`)\n- `ENCODER_PATH` (default `model/artifacts/encoder.pkl`)\n- `REQUEST_LOG` (default `ops/data/live_requests.jsonl`)\n\n**Helm values (common overrides)**\n```bash\n--set image.repository=ghcr.io/ai-art-dev99/mlops-capstone\n--set image.tag=v0.1.0\n--set autoscaling.maxReplicas=10\n```\n\n---\n\n## 📈 Observability\n\n- **Metrics:** Prometheus scrapes `/metrics` (request count \u0026 latency histograms).\n- **Dashboard:** import `ops/dashboards/api-overview.json` into Grafana.\n- **Drift:** a CronJob runs `monitoring/drift_job.py` nightly; adjust threshold via Helm values.\n\n---\n\n## 🔄 CI/CD\n\n- **On push:** run tests, build \u0026 push image to GHCR.  \n- **On GitHub Release:** deploy the Helm chart using the tagged image.\n\n**Required repo secrets**\n- `GITHUB_TOKEN` (automatically available for GHCR)\n- `KUBE_CONFIG` (base64-encoded kubeconfig) if you want the pipeline to deploy\n\n---\n\n## 🛡️ Security \u0026 Prod Notes\n\n- Non-root Docker user, health/readiness probes, small base image.  \n- Use a private registry + image pull secrets for private clusters.  \n- Add network policies \u0026 pod security standards in production.  \n- Secrets: mount via cloud secret manager / sealed-secrets (not included here).\n\n---\n\n## 🧭 Roadmap\n\n- [ ] Canary/shadow deploys (Argo Rollouts)  \n- [ ] Slack alert for drift (webhook)  \n- [ ] Feature store \u0026 model registry promotion gates  \n- [ ] Load test thresholds enforced in CI\n\n---\n\n## 📜 License\nApache-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fai-art-dev99%2Fmlops-capstone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fai-art-dev99%2Fmlops-capstone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fai-art-dev99%2Fmlops-capstone/lists"}