devrajsinh2012 commited on
Commit
c67369f
Β·
1 Parent(s): b84279a

Remove Fly.io and GitHub Actions workflows

Browse files

- Delete all GitHub Actions workflow files
- Remove Fly.io deployment configuration references
- Update TASKS.md and implementation plan to reflect Hugging Face deployment
- Clean up stale CI/CD documentation

.github/workflows/deploy-backend.yml DELETED
@@ -1,61 +0,0 @@
1
- name: Deploy Backend β†’ Fly.io
2
-
3
- on:
4
- push:
5
- branches: [main]
6
- paths:
7
- - 'backend/**'
8
- - 'Dockerfile'
9
- - '.dockerignore'
10
- - 'fly.toml'
11
- - 'Mediapipe_XGBoost/**'
12
- - 'CNN_Autoencoder_LightGBM/**'
13
- - 'CNN_PreTrained/**'
14
-
15
- jobs:
16
- test:
17
- name: Run backend tests
18
- runs-on: ubuntu-latest
19
- steps:
20
- - uses: actions/checkout@v4
21
-
22
- - uses: actions/setup-python@v5
23
- with:
24
- python-version: '3.12'
25
- cache: pip
26
- cache-dependency-path: backend/requirements.txt
27
-
28
- - name: Install deps
29
- run: |
30
- pip install -r backend/requirements.txt
31
- pip install -r backend/requirements-dev.txt
32
-
33
- - name: Run tests
34
- working-directory: backend
35
- env:
36
- KERAS_BACKEND: tensorflow
37
- TF_CPP_MIN_LOG_LEVEL: "3"
38
- CUDA_VISIBLE_DEVICES: ""
39
- TF_ENABLE_ONEDNN_OPTS: "0"
40
- run: pytest tests/ -v --tb=short -q
41
- # Note: tests will be skipped automatically if model .pkl files are absent
42
- # (model artefacts are gitignored). Add them as GitHub Actions artifacts
43
- # or use DVC/GCS to restore them in CI if you want full test coverage.
44
-
45
- deploy:
46
- name: Deploy to Fly.io
47
- needs: test
48
- runs-on: ubuntu-latest
49
- environment: production
50
- concurrency:
51
- group: fly-deploy
52
- cancel-in-progress: true
53
- steps:
54
- - uses: actions/checkout@v4
55
-
56
- - uses: superfly/flyctl-actions/setup-flyctl@master
57
-
58
- - name: Deploy
59
- run: flyctl deploy --remote-only
60
- env:
61
- FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/workflows/deploy-frontend.yml DELETED
@@ -1,45 +0,0 @@
1
- name: Deploy Frontend β†’ Vercel
2
-
3
- on:
4
- push:
5
- branches: [main]
6
- paths:
7
- - 'frontend/**'
8
-
9
- jobs:
10
- build-and-deploy:
11
- name: Build & Deploy
12
- runs-on: ubuntu-latest
13
- environment: production
14
- steps:
15
- - uses: actions/checkout@v4
16
-
17
- - uses: actions/setup-node@v4
18
- with:
19
- node-version: '22'
20
- cache: npm
21
- cache-dependency-path: frontend/package-lock.json
22
-
23
- - name: Install dependencies
24
- working-directory: frontend
25
- run: npm ci
26
-
27
- - name: Type-check
28
- working-directory: frontend
29
- run: npx tsc --project tsconfig.app.json --noEmit
30
-
31
- - name: Build
32
- working-directory: frontend
33
- env:
34
- VITE_WS_URL: ${{ vars.VITE_WS_URL }}
35
- VITE_API_URL: ${{ vars.VITE_API_URL }}
36
- run: npm run build
37
-
38
- - name: Deploy to Vercel
39
- uses: amondnet/vercel-action@v25
40
- with:
41
- vercel-token: ${{ secrets.VERCEL_TOKEN }}
42
- vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
43
- vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
44
- working-directory: frontend
45
- vercel-args: '--prod'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
SanketSetu_ Production-Grade Implementation Plan.md CHANGED
@@ -11,9 +11,9 @@ The system follows a modern microservices-inspired pattern to ensure scalability
11
  | Component | Technology | Role | Hosting (Free Tier) |
12
  | :--- | :--- | :--- | :--- |
13
  | **Frontend** | React + Vite + TS | User interface, webcam capture, real-time feedback | **Vercel** |
14
- | **Backend API** | FastAPI (Python) | WebSocket management, API gateway, logic | **Fly.io** |
15
- | **Inference Engine** | ONNX Runtime / XGBoost | High-speed model execution | **Fly.io** (Internal) |
16
- | **Storage** | Cloudflare R2 | S3-compatible storage for model weights | **Cloudflare** |
17
  | **Real-time** | WebSockets (WSS) | Low-latency frame-by-frame data transfer | N/A |
18
 
19
  ---
@@ -58,16 +58,12 @@ The frontend is designed to be "cool," responsive, and highly interactive, provi
58
 
59
  ## 4. Deployment & DevOps
60
 
61
- ### 4.1 Continuous Integration/Deployment (CI/CD)
62
- Using **GitHub Actions**, the project will follow a strict deployment pipeline:
63
- 1. **Lint & Test**: Ensure code quality and run unit tests for ML logic.
64
- 2. **Build**: Create optimized production builds for the React app and Dockerize the FastAPI backend.
65
- 3. **Deploy**:
66
- * Frontend automatically pushes to **Vercel**.
67
- * Backend pushes to **Fly.io** using `flyctl`.
68
 
69
  ### 4.2 Scalability & Cost Management
70
- * **Scale-to-Zero**: The backend on Fly.io can be configured to sleep when not in use to preserve free-tier resources.
71
  * **CDN Caching**: Vercel's Edge Network will cache all static assets, ensuring fast load times globally.
72
 
73
  ---
@@ -95,5 +91,5 @@ Using **GitHub Actions**, the project will follow a strict deployment pipeline:
95
  [1] [FastAPI Documentation](https://fastapi.tiangolo.com/) - High-performance web framework for building APIs.
96
  [2] [MediaPipe Hands](https://developers.google.com/mediapipe/solutions/vision/hand_landmarker) - Real-time hand landmark detection.
97
  [3] [Framer Motion](https://www.framer.com/motion/) - A production-ready motion library for React.
98
- [4] [Fly.io Free Tier](https://fly.io/docs/about/pricing/) - Details on free-tier resource allocation.
99
  [5] [Vercel Deployment](https://vercel.com/docs/deployments/overview) - Global CDN and hosting for frontend applications.
 
11
  | Component | Technology | Role | Hosting (Free Tier) |
12
  | :--- | :--- | :--- | :--- |
13
  | **Frontend** | React + Vite + TS | User interface, webcam capture, real-time feedback | **Vercel** |
14
+ | **Backend API** | FastAPI (Python) | WebSocket management, API gateway, logic | **Hugging Face Spaces** |
15
+ | **Inference Engine** | ONNX Runtime / XGBoost | High-speed model execution | **Hugging Face Spaces** |
16
+ | **Storage** | Hugging Face Model Hub | Model weights and assets | **Hugging Face** |
17
  | **Real-time** | WebSockets (WSS) | Low-latency frame-by-frame data transfer | N/A |
18
 
19
  ---
 
58
 
59
  ## 4. Deployment & DevOps
60
 
61
+ ### 4.1 Deployment Strategy
62
+ 1. **Frontend**: Manually push to **Vercel** using Vercel CLI or GitHub integration (when needed).
63
+ 2. **Backend**: Manually deploy to **Hugging Face Spaces** using Git push or Hugging Face Hub CLI.
 
 
 
 
64
 
65
  ### 4.2 Scalability & Cost Management
66
+ * **Auto-scaling**: Hugging Face Spaces manages resource allocation automatically with free-tier CPU instances.
67
  * **CDN Caching**: Vercel's Edge Network will cache all static assets, ensuring fast load times globally.
68
 
69
  ---
 
91
  [1] [FastAPI Documentation](https://fastapi.tiangolo.com/) - High-performance web framework for building APIs.
92
  [2] [MediaPipe Hands](https://developers.google.com/mediapipe/solutions/vision/hand_landmarker) - Real-time hand landmark detection.
93
  [3] [Framer Motion](https://www.framer.com/motion/) - A production-ready motion library for React.
94
+ [4] [Hugging Face Spaces](https://huggingface.co/docs/hub/spaces) - Free-tier hosting for ML applications.
95
  [5] [Vercel Deployment](https://vercel.com/docs/deployments/overview) - Global CDN and hosting for frontend applications.
TASKS.md CHANGED
@@ -40,7 +40,7 @@ SanketSetu/
40
  β”‚ β”œβ”€β”€ weights/ ← Symlink or copy of model pkl files
41
  β”‚ β”œβ”€β”€ requirements.txt
42
  β”‚ β”œβ”€β”€ Dockerfile
43
- β”‚ └── fly.toml
44
  β”‚
45
  β”œβ”€β”€ frontend/ ← Vite + React + TS
46
  β”‚ β”œβ”€β”€ src/
@@ -217,25 +217,16 @@ SanketSetu/
217
  - [x] Add `.dockerignore` (excludes `.venv`, `node_modules`, `*.pth`, tests)
218
  - [ ] Test locally: `docker build -t sanketsetu-backend . && docker run -p 8000:8000 sanketsetu-backend`
219
 
220
- ### 3.2 Fly.io Configuration
221
- - [x] Create `fly.toml` (repo root, region=maa, port 8000, shared-cpu-2x)
222
  - [x] Note: Keras/TF will increase Docker image size β€” use `tensorflow-cpu` to keep slim
223
- - [ ] Set secrets via `flyctl secrets set` for any API keys
224
- - [ ] Run: `flyctl deploy --dockerfile Dockerfile`
225
 
226
  ### 3.3 Vercel Frontend Deployment
227
  - [x] Create `frontend/vercel.json` with SPA rewrite + WASM Content-Type header
228
  - [x] Add `VITE_WS_URL` and `VITE_API_URL` to Vercel environment variables (via CI vars)
229
  - [ ] Ensure `@mediapipe/tasks-vision` WASM files are served correctly (add to `public/`)
230
 
231
- ### 3.4 GitHub Actions CI/CD
232
- - [x] Create `.github/workflows/deploy-backend.yml`
233
- - Triggers on push to `main` when `backend/**` changes
234
- - Steps: checkout β†’ setup Python β†’ run tests β†’ `flyctl deploy`
235
- - [x] Create `.github/workflows/deploy-frontend.yml`
236
- - Triggers on push to `main` when `frontend/**` changes
237
- - Steps: checkout β†’ `npm ci` β†’ tsc β†’ `npm run build` β†’ Vercel CLI deploy
238
-
239
  ---
240
 
241
  ## Phase 4 β€” Testing & Hardening
 
40
  β”‚ β”œβ”€β”€ weights/ ← Symlink or copy of model pkl files
41
  β”‚ β”œβ”€β”€ requirements.txt
42
  β”‚ β”œβ”€β”€ Dockerfile
43
+
44
  β”‚
45
  β”œβ”€β”€ frontend/ ← Vite + React + TS
46
  β”‚ β”œβ”€β”€ src/
 
217
  - [x] Add `.dockerignore` (excludes `.venv`, `node_modules`, `*.pth`, tests)
218
  - [ ] Test locally: `docker build -t sanketsetu-backend . && docker run -p 8000:8000 sanketsetu-backend`
219
 
220
+ ### 3.2 Hugging Face Spaces Configuration
221
+ - [x] Create Hugging Face Spaces repository for backend deployment
222
  - [x] Note: Keras/TF will increase Docker image size β€” use `tensorflow-cpu` to keep slim
223
+ - [ ] Push Docker image to Hugging Face Container Registry
 
224
 
225
  ### 3.3 Vercel Frontend Deployment
226
  - [x] Create `frontend/vercel.json` with SPA rewrite + WASM Content-Type header
227
  - [x] Add `VITE_WS_URL` and `VITE_API_URL` to Vercel environment variables (via CI vars)
228
  - [ ] Ensure `@mediapipe/tasks-vision` WASM files are served correctly (add to `public/`)
229
 
 
 
 
 
 
 
 
 
230
  ---
231
 
232
  ## Phase 4 β€” Testing & Hardening
backend/app/__pycache__/config.cpython-312.pyc CHANGED
Binary files a/backend/app/__pycache__/config.cpython-312.pyc and b/backend/app/__pycache__/config.cpython-312.pyc differ
 
backend/app/__pycache__/main.cpython-312.pyc CHANGED
Binary files a/backend/app/__pycache__/main.cpython-312.pyc and b/backend/app/__pycache__/main.cpython-312.pyc differ
 
backend/app/__pycache__/schemas.cpython-312.pyc CHANGED
Binary files a/backend/app/__pycache__/schemas.cpython-312.pyc and b/backend/app/__pycache__/schemas.cpython-312.pyc differ