Initial commit
This commit is contained in:
281
omop/CHANGEMENTS_PORT_4400.md
Normal file
281
omop/CHANGEMENTS_PORT_4400.md
Normal file
@@ -0,0 +1,281 @@
|
||||
# 🔄 Changements - Port 4400 et Script run.sh
|
||||
|
||||
## Résumé des modifications
|
||||
|
||||
✅ **Port frontend changé** : 3000 → 4400
|
||||
✅ **Nouveau script** : `run.sh` (complet avec vérifications)
|
||||
✅ **Script existant** : `start_web.sh` (mis à jour)
|
||||
✅ **CORS** : Ajout du port 4400
|
||||
✅ **Documentation** : Mise à jour
|
||||
|
||||
---
|
||||
|
||||
## Fichiers modifiés
|
||||
|
||||
### 1. Frontend - Port 4400
|
||||
|
||||
**`frontend/vite.config.js`** :
|
||||
```javascript
|
||||
server: {
|
||||
port: 4400, // Changé de 3000 à 4400
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
**`frontend/src/api/client.js`** :
|
||||
```javascript
|
||||
const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:8000/api'
|
||||
// Maintenant configurable via variable d'environnement
|
||||
```
|
||||
|
||||
### 2. Backend - CORS
|
||||
|
||||
**`src/api/main.py`** :
|
||||
```python
|
||||
allow_origins=[
|
||||
"http://localhost:4400", # Nouveau port
|
||||
"http://localhost:3000", # Ancien port (rétrocompatibilité)
|
||||
"http://localhost:5173" # Port Vite alternatif
|
||||
]
|
||||
```
|
||||
|
||||
### 3. Scripts
|
||||
|
||||
**`run.sh`** (NOUVEAU) :
|
||||
- Script complet avec vérifications
|
||||
- Messages colorés
|
||||
- Logs dans fichiers
|
||||
- Gestion d'erreurs avancée
|
||||
- Arrêt propre
|
||||
|
||||
**`start_web.sh`** (MODIFIÉ) :
|
||||
- Port frontend mis à jour : 4400
|
||||
- Reste simple et rapide
|
||||
|
||||
### 4. Configuration
|
||||
|
||||
**`frontend/.env.example`** (NOUVEAU) :
|
||||
```bash
|
||||
VITE_API_URL=http://localhost:8000/api
|
||||
```
|
||||
|
||||
### 5. Documentation
|
||||
|
||||
**Fichiers mis à jour** :
|
||||
- `START_HERE.md` - Port 4400 + nouveau script
|
||||
- `QUICK_START_WEB.md` - À mettre à jour
|
||||
- `README_WEB_INTERFACE.md` - À mettre à jour
|
||||
|
||||
**Nouveau fichier** :
|
||||
- `RUN_SCRIPT_GUIDE.md` - Guide complet du script run.sh
|
||||
|
||||
---
|
||||
|
||||
## Nouveaux ports
|
||||
|
||||
| Service | Ancien Port | Nouveau Port | URL |
|
||||
|---------|-------------|--------------|-----|
|
||||
| Frontend | 3000 | **4400** | http://localhost:4400 |
|
||||
| API | 8000 | 8000 | http://localhost:8000 |
|
||||
| Docs API | 8000 | 8000 | http://localhost:8000/docs |
|
||||
|
||||
---
|
||||
|
||||
## Utilisation
|
||||
|
||||
### Option 1 : Script complet (recommandé)
|
||||
|
||||
```bash
|
||||
cd omop
|
||||
./run.sh
|
||||
```
|
||||
|
||||
**Avantages** :
|
||||
- ✅ Vérifications complètes (Python, Node, PostgreSQL)
|
||||
- ✅ Installation automatique des dépendances
|
||||
- ✅ Messages colorés et clairs
|
||||
- ✅ Logs dans fichiers (`logs/api.log`, `logs/frontend.log`)
|
||||
- ✅ Gestion d'erreurs avancée
|
||||
- ✅ Arrêt propre avec Ctrl+C
|
||||
|
||||
### Option 2 : Script simple
|
||||
|
||||
```bash
|
||||
cd omop
|
||||
./start_web.sh
|
||||
```
|
||||
|
||||
**Avantages** :
|
||||
- ✅ Démarrage rapide
|
||||
- ✅ Simple et léger
|
||||
- ✅ Installation automatique des dépendances
|
||||
|
||||
---
|
||||
|
||||
## Accès à l'interface
|
||||
|
||||
**Nouvelle URL** : http://localhost:4400
|
||||
|
||||
**Ancienne URL** : ~~http://localhost:3000~~ (ne fonctionne plus)
|
||||
|
||||
---
|
||||
|
||||
## Migration
|
||||
|
||||
Si tu utilisais l'ancien port 3000 :
|
||||
|
||||
1. **Aucune action requise** - Le port a changé automatiquement
|
||||
2. **Mets à jour tes bookmarks** : http://localhost:4400
|
||||
3. **Utilise le nouveau script** : `./run.sh`
|
||||
|
||||
---
|
||||
|
||||
## Vérification
|
||||
|
||||
Pour vérifier que tout fonctionne :
|
||||
|
||||
```bash
|
||||
# 1. Lancer la stack
|
||||
./run.sh
|
||||
|
||||
# 2. Vérifier l'API
|
||||
curl http://localhost:8000/health
|
||||
|
||||
# 3. Vérifier le frontend
|
||||
curl http://localhost:4400
|
||||
|
||||
# 4. Ouvrir dans le navigateur
|
||||
xdg-open http://localhost:4400 # Linux
|
||||
open http://localhost:4400 # macOS
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Logs
|
||||
|
||||
Les logs sont maintenant dans des fichiers :
|
||||
|
||||
```bash
|
||||
# Logs API
|
||||
tail -f logs/api.log
|
||||
|
||||
# Logs Frontend
|
||||
tail -f logs/frontend.log
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Port 4400 déjà utilisé
|
||||
|
||||
```bash
|
||||
# Trouver le processus
|
||||
lsof -i :4400
|
||||
|
||||
# Tuer le processus
|
||||
kill -9 <PID>
|
||||
```
|
||||
|
||||
### Erreur CORS
|
||||
|
||||
Si tu as des erreurs CORS, vérifie que `src/api/main.py` contient :
|
||||
```python
|
||||
allow_origins=["http://localhost:4400", ...]
|
||||
```
|
||||
|
||||
### Le frontend ne démarre pas
|
||||
|
||||
```bash
|
||||
# Réinstaller les dépendances
|
||||
cd frontend
|
||||
rm -rf node_modules package-lock.json
|
||||
npm install
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Rétrocompatibilité
|
||||
|
||||
Le backend accepte toujours les requêtes depuis :
|
||||
- ✅ http://localhost:4400 (nouveau)
|
||||
- ✅ http://localhost:3000 (ancien)
|
||||
- ✅ http://localhost:5173 (Vite alternatif)
|
||||
|
||||
Mais le frontend ne démarre plus sur le port 3000.
|
||||
|
||||
---
|
||||
|
||||
## Résumé des changements
|
||||
|
||||
| Élément | Avant | Après |
|
||||
|---------|-------|-------|
|
||||
| Port frontend | 3000 | **4400** |
|
||||
| Script principal | `start_web.sh` | `run.sh` (nouveau) |
|
||||
| Logs | Console | Fichiers (`logs/*.log`) |
|
||||
| Vérifications | Basiques | Complètes |
|
||||
| Messages | Simples | Colorés |
|
||||
| CORS | Port 3000 | Ports 3000, 4400, 5173 |
|
||||
|
||||
---
|
||||
|
||||
## Documentation
|
||||
|
||||
**Nouveau guide** : `RUN_SCRIPT_GUIDE.md`
|
||||
- Guide complet du script `run.sh`
|
||||
- Troubleshooting détaillé
|
||||
- Exemples d'utilisation
|
||||
|
||||
**Fichiers mis à jour** :
|
||||
- `START_HERE.md` - Port 4400
|
||||
- `frontend/vite.config.js` - Port 4400
|
||||
- `src/api/main.py` - CORS port 4400
|
||||
- `start_web.sh` - Port 4400
|
||||
|
||||
---
|
||||
|
||||
## Commandes rapides
|
||||
|
||||
```bash
|
||||
# Démarrer (recommandé)
|
||||
./run.sh
|
||||
|
||||
# Démarrer (simple)
|
||||
./start_web.sh
|
||||
|
||||
# Arrêter
|
||||
Ctrl+C
|
||||
|
||||
# Consulter les logs
|
||||
tail -f logs/api.log
|
||||
tail -f logs/frontend.log
|
||||
|
||||
# Accéder à l'interface
|
||||
http://localhost:4400
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ✅ Checklist de migration
|
||||
|
||||
- [x] Port frontend changé : 4400
|
||||
- [x] Script `run.sh` créé
|
||||
- [x] Script `start_web.sh` mis à jour
|
||||
- [x] CORS mis à jour
|
||||
- [x] Documentation mise à jour
|
||||
- [x] Guide `RUN_SCRIPT_GUIDE.md` créé
|
||||
- [x] Fichier `.env.example` créé
|
||||
- [x] Rétrocompatibilité CORS maintenue
|
||||
|
||||
**Tout est prêt ! 🚀**
|
||||
|
||||
---
|
||||
|
||||
## Prochaines étapes
|
||||
|
||||
1. **Teste le nouveau script** : `./run.sh`
|
||||
2. **Ouvre l'interface** : http://localhost:4400
|
||||
3. **Consulte le guide** : `RUN_SCRIPT_GUIDE.md`
|
||||
4. **Mets à jour tes bookmarks** : Port 4400
|
||||
|
||||
**Bon développement ! 🎉**
|
||||
Reference in New Issue
Block a user