fix: messages installation et serveur statique production

1. Messages finaux install scripts
   - Mise en avant de ./start.sh (recommandé)
   - Méthode manuelle en alternatif
   - Port production corrigé (3000 au lieu de 5173)

2. Serveur statique production (server/index.js)
   - Sert client/dist/ si build existe
   - Route / serve index.html en production
   - Mode dev : retourne info API JSON
   - Permet ./start.sh mode prod fonctionnel

Fix issues identifiés : messages obsolètes + production non fonctionnelle.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-05-27 14:39:02 +02:00
parent 1050369469
commit 79cda9653b
3 changed files with 60 additions and 29 deletions
+12 -8
View File
@@ -317,19 +317,23 @@ print_summary() {
echo " ✅ Installation terminée !" echo " ✅ Installation terminée !"
echo "========================================" echo "========================================"
echo "" echo ""
echo "📝 Prochaines étapes :" echo "🚀 Démarrage rapide :"
echo "" echo ""
echo "1. Démarrer le serveur :" echo " # Mode développement (recommandé)"
echo " cd $PROJECT_ROOT/server" echo " ./start.sh --dev"
echo " npm run dev"
echo "" echo ""
echo "2. Démarrer le client (autre terminal) :" echo " # Mode production"
echo " cd $PROJECT_ROOT/client" echo " ./start.sh"
echo " npm run dev"
echo "" echo ""
echo "3. Accéder à l'application :" echo "📝 OU manuellement (deux terminaux) :"
echo ""
echo " Terminal 1 : cd $PROJECT_ROOT/server && npm run dev"
echo " Terminal 2 : cd $PROJECT_ROOT/client && npm run dev"
echo ""
echo "🌐 Accès après démarrage :"
echo " • Développement local : http://localhost:5173" echo " • Développement local : http://localhost:5173"
echo " • Depuis autre appareil (WiFi) : http://${NETWORK_IP}:5173" echo " • Depuis autre appareil (WiFi) : http://${NETWORK_IP}:5173"
echo " • Production : http://${NETWORK_IP}:3000"
echo "" echo ""
echo "💡 Configuration réseau :" echo "💡 Configuration réseau :"
echo " IP serveur détectée : ${NETWORK_IP}" echo " IP serveur détectée : ${NETWORK_IP}"
+13 -7
View File
@@ -82,7 +82,7 @@ echo ""
# Installer dépendances serveur # Installer dépendances serveur
echo "📦 Installation dépendances serveur..." echo "📦 Installation dépendances serveur..."
cd ../server cd ./server
npm install npm install
echo -e "${GREEN}✅ Dépendances serveur installées${NC}" echo -e "${GREEN}✅ Dépendances serveur installées${NC}"
echo "" echo ""
@@ -152,17 +152,23 @@ echo ""
echo "==================================" echo "=================================="
echo -e "${GREEN}✅ Installation terminée !${NC}" echo -e "${GREEN}✅ Installation terminée !${NC}"
echo "" echo ""
echo "📝 Prochaines étapes :" echo "🚀 Démarrage rapide :"
echo "" echo ""
echo " 1. Démarrer le serveur :" echo " # Mode développement (recommandé)"
echo " cd server && npm run dev" echo " ./start.sh --dev"
echo "" echo ""
echo " 2. Démarrer le client (nouveau terminal) :" echo " # Mode production"
echo " cd client && npm run dev" echo " ./start.sh"
echo "" echo ""
echo " 3. Accéder à l'application :" echo "📝 OU manuellement (deux terminaux) :"
echo ""
echo " Terminal 1 : cd server && npm run dev"
echo " Terminal 2 : cd client && npm run dev"
echo ""
echo "🌐 Accès après démarrage :"
echo " • Développement local : https://localhost:5173" echo " • Développement local : https://localhost:5173"
echo " • Depuis autre appareil (WiFi) : https://${NETWORK_IP}:5173" echo " • Depuis autre appareil (WiFi) : https://${NETWORK_IP}:5173"
echo " • Production : http://${NETWORK_IP}:3000"
echo "" echo ""
echo "💡 Configuration réseau :" echo "💡 Configuration réseau :"
echo " IP serveur détectée : ${NETWORK_IP}" echo " IP serveur détectée : ${NETWORK_IP}"
+25 -4
View File
@@ -187,6 +187,19 @@ app.use((req, res, next) => {
next(); next();
}); });
// ========== Servir fichiers statiques client (production) ==========
// En production, servir le build client depuis ../client/dist
import { existsSync } from 'fs';
const clientDistPath = join(__dirname, '..', 'client', 'dist');
if (existsSync(clientDistPath)) {
log('info', `📦 Serveur statique activé : ${clientDistPath}`);
app.use(express.static(clientDistPath));
} else {
log('debug', '📦 Pas de build client (mode dev)');
}
// ========== Routes Admin ========== // ========== Routes Admin ==========
// Monter les routes admin sous /admin // Monter les routes admin sous /admin
@@ -331,20 +344,28 @@ app.get('/health', (req, res) => {
/** /**
* GET / * GET /
* Info serveur * Info serveur OU client PWA (si build existe)
*/ */
app.get('/', (req, res) => { app.get('/', (req, res) => {
// Si build client existe, servir index.html
const indexPath = join(clientDistPath, 'index.html');
if (existsSync(indexPath)) {
res.sendFile(indexPath);
} else {
// Sinon, afficher info API
res.json({ res.json({
name: 'PTT Live Server', name: 'PTT Live Server',
version: '0.1.0', version: '0.2.0',
phase: 'Phase 1 - MVP', mode: 'development',
endpoints: [ endpoints: [
'GET /config - Configuration groupes', 'GET /config - Configuration groupes',
'GET /groups - Liste des groupes', 'GET /groups - Liste des groupes',
'POST /token - Générer token client', 'POST /token - Générer token client',
'GET /health - Health check' 'GET /health - Health check',
'GET /admin - Interface administration'
] ]
}); });
}
}); });
// ========== Démarrage ========== // ========== Démarrage ==========