Spaces:
Sleeping
Sleeping
Tripagra commited on
Commit ·
cef122e
1
Parent(s): 2e93666
Simplify: Deploy frontend only to Vercel, backend to Render/Railway
Browse files- BACKEND_DEPLOY.md +54 -0
- vercel.json +1 -7
BACKEND_DEPLOY.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Backend Deployment Guide
|
| 2 |
+
|
| 3 |
+
The backend cannot be deployed to Vercel due to Python dependency issues (faiss-cpu compatibility).
|
| 4 |
+
|
| 5 |
+
## Option 1: Deploy Backend to Render (Recommended)
|
| 6 |
+
|
| 7 |
+
1. Go to [render.com](https://render.com) and sign in
|
| 8 |
+
2. Click "New +" → "Web Service"
|
| 9 |
+
3. Connect your GitHub repository
|
| 10 |
+
4. Configure:
|
| 11 |
+
- **Name**: `escalation-api-backend`
|
| 12 |
+
- **Runtime**: Python 3
|
| 13 |
+
- **Build Command**: `pip install -r requirements.txt`
|
| 14 |
+
- **Start Command**: `uvicorn src.main:app --host 0.0.0.0 --port $PORT`
|
| 15 |
+
5. Add Environment Variables:
|
| 16 |
+
- `GOOGLE_API_KEY`: Your Gemini API key
|
| 17 |
+
6. Deploy
|
| 18 |
+
|
| 19 |
+
Your backend will be at: `https://escalation-api-backend.onrender.com`
|
| 20 |
+
|
| 21 |
+
## Option 2: Deploy Backend to Railway
|
| 22 |
+
|
| 23 |
+
1. Go to [railway.app](https://railway.app) and sign in
|
| 24 |
+
2. Click "New Project" → "Deploy from GitHub repo"
|
| 25 |
+
3. Select your repository
|
| 26 |
+
4. Add environment variables in the Variables tab
|
| 27 |
+
5. Railway auto-deploys
|
| 28 |
+
|
| 29 |
+
Your backend will be at: `https://your-app.up.railway.app`
|
| 30 |
+
|
| 31 |
+
## Update Frontend
|
| 32 |
+
|
| 33 |
+
After deploying the backend, update the frontend environment variable in Vercel:
|
| 34 |
+
|
| 35 |
+
1. Go to Vercel Dashboard → Your Project → Settings → Environment Variables
|
| 36 |
+
2. Add/Update: `VITE_API_URL` = `https://your-backend-url.onrender.com`
|
| 37 |
+
3. Redeploy frontend
|
| 38 |
+
|
| 39 |
+
## Local Development
|
| 40 |
+
|
| 41 |
+
### Backend:
|
| 42 |
+
```bash
|
| 43 |
+
pip install -r requirements.txt
|
| 44 |
+
uvicorn src.main:app --reload
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
### Frontend:
|
| 48 |
+
```bash
|
| 49 |
+
cd frontend
|
| 50 |
+
npm install
|
| 51 |
+
npm run dev
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
Set `VITE_API_URL=http://localhost:8000` in `frontend/.env`
|
vercel.json
CHANGED
|
@@ -1,10 +1,4 @@
|
|
| 1 |
{
|
| 2 |
"buildCommand": "cd frontend && npm install && npm run build",
|
| 3 |
-
"outputDirectory": "frontend/dist"
|
| 4 |
-
"functions": {
|
| 5 |
-
"api/**/*.py": {
|
| 6 |
-
"runtime": "@vercel/python",
|
| 7 |
-
"maxDuration": 10
|
| 8 |
-
}
|
| 9 |
-
}
|
| 10 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"buildCommand": "cd frontend && npm install && npm run build",
|
| 3 |
+
"outputDirectory": "frontend/dist"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
}
|