#!/bin/bash echo "========================================" echo " SPOTIFY LE 2 - INSTALLATION AUTO" echo "========================================" echo "" # Fonction pour vérifier les commandes check_command() { if ! command -v $1 &> /dev/null; then echo "[ERREUR] $1 n'est pas installé!" return 1 fi return 0 } # Vérifications echo "[1/6] Vérification des prérequis..." check_command python3 || exit 1 check_command git || exit 1 check_command docker || exit 1 check_command docker-compose || exit 1 echo "[OK] Tous les prérequis sont installés!" echo "" echo "[2/6] Démarrage de l'infrastructure (PostgreSQL + Redis)..." cd docker docker-compose up -d if [ $? -ne 0 ]; then echo "[ERREUR] Erreur lors du démarrage de Docker." exit 1 fi echo "[OK] Infrastructure démarrée!" echo "" echo "[3/6] Installation des dépendances Backend..." cd ../backend # Créer venv si n'existe pas if [ ! -d "venv" ]; then echo "Création de l'environnement virtuel Python..." python3 -m venv venv fi # Activer venv et installer source venv/bin/activate echo "Installation des packages Python..." pip install --upgrade pip -q pip install -r requirements.txt -q echo "[OK] Backend prêt!" echo "" echo "[4/6] Configuration du Backend..." if [ ! -f ".env" ]; then echo "Création du fichier .env..." cp .env.example .env echo "[ATTENTION] Éditez backend/.env et changez SECRET_KEY!" fi echo "[OK] Backend configuré!" echo "" echo "[5/6] Initialisation de la base de données..." echo "Création des tables..." python -c "from app.core.database import init_db; import asyncio; asyncio.run(init_db())" echo "[OK] Base de données prête!" echo "" echo "[6/6] Installation des dépendances Frontend..." cd ../frontend echo "Installation des packages Flutter..." flutter pub get -q if [ $? -ne 0 ]; then echo "[ERREUR] Erreur lors de flutter pub get." echo "Vérifiez que Flutter est bien installé: https://docs.flutter.dev/get-started/install" exit 1 fi echo "[OK] Frontend prêt!" echo "" echo "========================================" echo " INSTALLATION TERMINÉE !" echo "========================================" echo "" echo "Pour démarrer l'application:" echo " ./START.sh" echo "" echo "Ou manuellement:" echo " Terminal 1 (Backend): cd backend && source venv/bin/activate && uvicorn app.main:app --reload" echo " Terminal 2 (Frontend): cd frontend && flutter run" echo ""