# 👋 START HERE - DĂ©ployer sur HuggingFace Spaces Bienvenue ! Ce fichier vous guide pour dĂ©ployer votre application Virtual Labo Chimique sur HuggingFace Spaces. ## 📍 OĂč Êtes-Vous ? Vous ĂȘtes dans le dossier du projet qui contient tout ce qu'il faut pour dĂ©ployer sur HuggingFace. ``` YOUR_PROJECT/ ├── Dockerfile ← Configuration Docker ├── server.js ← Serveur HTTP (port 7860) ├── package.json ← DĂ©pendances ├── src/ ← Code source ├── public/ ← Assets statiques ├── deploy.sh ← Script de dĂ©ploiement │ ├── 📖 QUICKSTART.md ← ⭐ LISEZ CE FICHIER EN PREMIER ├── README.md ← Documentation gĂ©nĂ©rale ├── DEPLOYMENT.md ← Guide complet de dĂ©ploiement ├── HF_CONFIG.md ← Configuration HuggingFace └── START_HERE.md ← Ce fichier ``` ## 🎯 Votre Objectif DĂ©ployer cette application sur : ``` https://huggingface.co/spaces/rinogeek/VirtualLabo ``` ## 🚀 Trois Options De DĂ©ploiement ### ⚡ Option 1 : Script AutomatisĂ© (PLUS FACILE) ```bash ./deploy.sh ``` Cela va : 1. VĂ©rifier les fichiers 2. Tester le build Docker 3. Committer les changements 4. Pousser vers HuggingFace 5. **Votre app sera live en 5-7 minutes!** ### 🔧 Option 2 : Ligne de Commande ```bash git init git add . git commit -m "Deploy: Virtual Labo Chimique" git remote add origin https://huggingface.co/spaces/rinogeek/VirtualLabo git push origin main ``` ### 📩 Option 3 : Via Interface HuggingFace Web 1. Allez Ă  https://huggingface.co/spaces/rinogeek/VirtualLabo 2. Settings → Linked Repo 3. Connectez votre repository GitHub/GitLab 4. DĂ©ploiement automatique ## ⚠ Avant de Commencer **VĂ©rifiez ces Ă©lĂ©ments :** - ✓ Vous avez un compte HuggingFace - ✓ L'espace existe : https://huggingface.co/spaces/rinogeek/VirtualLabo - ✓ Git est installĂ© : `git --version` - ✓ (Optionnel) Docker : `docker --version` ## 🎓 Guides RecommandĂ©s Pour dĂ©ployer rapidement : 1. **[QUICKSTART.md](QUICKSTART.md)** (5 min) ← **COMMENCEZ ICI** 2. **[DEPLOYMENT.md](DEPLOYMENT.md)** (guide complet) 3. **[HF_CONFIG.md](HF_CONFIG.md)** (configuration) 4. **[README.md](README.md)** (infos gĂ©nĂ©rales) ## 🔐 Configuration des Secrets Si votre app utilise une API (ex: Groq) : 1. Allez Ă  Settings de l'espace 2. Cliquez sur **Secrets** 3. Ajoutez les clĂ©s : - `GROQ_API_KEY=votre_clĂ©` Elles seront disponibles automatiquement comme variables d'environnement. ## đŸ§Ș Test Local (Optionnel) Avant de dĂ©ployer, testez localement : ```bash # Build l'image Docker npm run docker:build # Lance le serveur npm run docker:run # Ouvrir : http://localhost:7860 ``` Si ça marche ici → ça marchera sur HuggingFace ✓ ## 📊 Fichiers Importants | Fichier | UtilitĂ© | |---------|---------| | `Dockerfile` | Configure le conteneur Docker | | `server.js` | Serveur HTTP (port 7860) | | `package.json` | DĂ©pendances npm/bun | | `bun.lockb` | Lock file des dĂ©pendances | | `.dockerignore` | Exclut les fichiers inutiles | | `.env.example` | Variables d'environnement | | `deploy.sh` | Script de dĂ©ploiement | ## 🎼 Commandes Utiles ```bash # DĂ©veloppement local npm run dev # Lancer le dev server # Production npm run build # Builder l'app npm run start # Lancer le serveur prod # Docker npm run docker:build # Build l'image npm run docker:run # Lancer le conteneur npm run docker:compose # Avec docker-compose # DĂ©ploiement npm run deploy # Script auto ./deploy.sh # MĂȘme chose ``` ## 📝 Checklist Avant DĂ©ploiement - [ ] Git est configurĂ© - [ ] Les fichiers de configuration sont prĂ©sents - [ ] Le port 7860 est configurĂ© (✓ dĂ©jĂ  fait) - [ ] `npm run build` fonctionne localement - [ ] Docker fonctionne localement (optionnel) - [ ] Vous avez les secrets (si nĂ©cessaire) - [ ] L'espace HuggingFace existe ## 🚀 DĂ©marrer Maintenant ### La Plus Rapide (RecommandĂ©e) ```bash # 1. PrĂ©parer git init git add . git commit -m "Deploy Virtual Labo" # 2. Configurer le remote git remote add origin https://huggingface.co/spaces/rinogeek/VirtualLabo # 3. DĂ©ployer git push origin main # Attendez 3-5 minutes → App live! 🎉 ``` ### La Plus Facile (Avec Script) ```bash ./deploy.sh # Suivre les instructions ``` ## ⏱ Temps d'Attente | Étape | Temps | |-------|-------| | Push vers HuggingFace | 30 sec | | Build Docker | 3-7 min | | DĂ©marrage du serveur | 1 min | | **TOTAL** | **5-10 min** | AprĂšs cela : **L'app est live!** ✓ ## 📊 Monitoring Pour voir ce qui se passe : 1. Allez Ă  https://huggingface.co/spaces/rinogeek/VirtualLabo 2. Cherchez le badge de status (en haut Ă  droite) 3. Cliquez sur **Build logs** pour les dĂ©tails ### Statuts Possibles - 🟱 **Running** : App live et prĂȘte - 🟡 **Building** : Compilation en cours - 🔮 **Error** : Quelque chose s'est mal passĂ© - âšȘ **Stopped** : App inactive (peut redĂ©marrer) ## 🆘 Ça PĂšte ? ### L'app ne dĂ©marre pas 1. Consultez les logs : Space → Build logs 2. Cherchez les erreurs 3. Comparez avec [DEPLOYMENT.md#dĂ©pannage](DEPLOYMENT.md#dĂ©pannage) ### Le build prend trop longtemps Normal ! Premier build = 5-10 min. Mises Ă  jour suivantes = 2-3 min (cache). ### Erreur "Application Health Check Failed" Augmentez le timeout ou vĂ©rifiez que le serveur dĂ©marre. ## 📞 Besoin d'Aide? 1. **Guide complet** : [DEPLOYMENT.md](DEPLOYMENT.md) 2. **Configuration** : [HF_CONFIG.md](HF_CONFIG.md) 3. **Docs HuggingFace** : https://huggingface.co/spaces/docs 4. **Docker Docs** : https://docs.docker.com ## ✅ Vous Êtes PrĂȘt! Choisissez une option et c'est parti : ```bash # Option 1 : Quickstart (RecommandĂ©) ./deploy.sh # Option 2 : Manuel git init && git add . && git commit -m "Deploy" && \ git remote add origin https://huggingface.co/spaces/rinogeek/VirtualLabo && \ git push origin main ``` ## 🎉 Bravo! AprĂšs le dĂ©ploiement, vous aurez : - ✅ Une app live sur HuggingFace Spaces - ✅ URL publique : https://huggingface.co/spaces/rinogeek/VirtualLabo - ✅ Mise Ă  jour facile via git push - ✅ Scaling automatique - ✅ CORS et sĂ©curitĂ© intĂ©grĂ©s --- ## Navigation - ⭐ **Commencez par** : [QUICKSTART.md](QUICKSTART.md) - 📖 **Guide complet** : [DEPLOYMENT.md](DEPLOYMENT.md) - ⚙ **Configuration** : [HF_CONFIG.md](HF_CONFIG.md) - 📚 **Info gĂ©nĂ©rale** : [README.md](README.md) --- **Vous ĂȘtes maintenant prĂȘt Ă  dĂ©ployer ! Bonne chance! 🚀**