File size: 2,882 Bytes
532e19f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# 🚀 Render Deployment Fix

## הבעיה
Render ממשיך להריץ `gunicorn app:app` אבל gunicorn לא מותקן (הסרנו אותו).

## ✅ הפתרון (3 דקות)

### אופציה 1: עדכון ידני (מהיר!)

1. **לך ל-Render Dashboard** → בחר את השירות שלך

2. **Settings** → **Build & Deploy**

3. **Start Command** - החלף ל:
   ```bash
   uvicorn app:app --host 0.0.0.0 --port $PORT
   ```

4. **Save Changes**

5. **Manual Deploy** → **Deploy latest commit**

---

### אופציה 2: מחיקה ויצירה מחדש (נקי!)

#### שלב 1: מחק את השירות הישן
- Settings → Danger Zone → **Delete Web Service**

#### שלב 2: צור שירות חדש
1. **New** → **Web Service**
2. **Repository**: `refaelz1/LegacyInterview`
3. **Name**: `legacy-code-challenge`
4. **Runtime**: Python 3
5. **Build Command**:
   ```bash
   apt-get update && apt-get install -y git && pip install -r requirements.txt
   ```
6. **Start Command**:
   ```bash
   uvicorn app:app --host 0.0.0.0 --port $PORT
   ```
7. **Environment Variables**:
   - `PORT` = `10000`
   - `OPENAI_API_KEY` = (leave empty - users will provide)

8. **Create Web Service**

---

## 📝 מה אמור לקרות אחרי התיקון

### Build Logs:
```
==> Installing dependencies from ./requirements.txt
Collecting uvicorn[standard]
  ✓ Installed uvicorn successfully
==> Build successful 🎉
```

### Deploy Logs:
```
==> Deploying...
==> Running 'uvicorn app:app --host 0.0.0.0 --port $PORT'
🚀 Starting Legacy Code Challenge on port 10000...
🔐 No API key found — login page will be shown
INFO:     Started server process [68]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:10000 (Press CTRL+C to quit)
==> Your service is live 🎉
```

---

## 🧪 בדיקה

1. פתח את ה-URL שRender נתן לך
2. אמור לראות **Login Page** עם:
   - שדה "Your Name"
   - שדה "OpenAI API Key"
   - כפתור "Continue"

3. אם אתה מקומי (.env עם API key), תראה ישר את **Setup Page**

---

## ⚙️ קבצים רלוונטיים

- `requirements.txt` - מכיל `uvicorn[standard]`
- `app.py` - חושף `app = demo.app` לuvicorn
- `Procfile` - `web: uvicorn app:app --host 0.0.0.0 --port $PORT`
- `render.yaml` - הגדרות אוטומטיות (אבל Render מתעלם מזה לפעמים)

---

## 🐛 Troubleshooting

### שגיאה: `bash: uvicorn: command not found`
**פתרון**: Clear build cache ב-Settings

### שגיאה: `TypeError: FastAPI.__call__() missing 1 required positional argument`
**פתרון**: אתה עדיין מריץ gunicorn - עדכן Start Command!

### שגיאה: `git: command not found`
**פתרון**: הוסף `apt-get update && apt-get install -y git` ל-Build Command