Spaces:
Running
Running
Déploiement Emo Online — GitHub Pages + Hugging Face Spaces
Architecture
| Composant | Hébergement | URL |
|---|---|---|
| Frontend (React) | GitHub Pages + domaine IONOS | https://xeroxytb.com |
| API (FastAPI, LLM, Stripe, agent) | Hugging Face Spaces (Docker) | https://xroxx-emo-online-api.hf.space |
| MongoDB | MongoDB Atlas | cluster EmoCluster |
Gratuit, sans carte bancaire (Fly.io et Koyeb demandent une carte).
1. Domaine custom IONOS → GitHub Pages
DNS chez IONOS (domaine xeroxytb.com)
| Type | Nom / Host | Valeur |
|---|---|---|
| A | @ |
185.199.108.153 |
| A | @ |
185.199.109.153 |
| A | @ |
185.199.110.153 |
| A | @ |
185.199.111.153 |
| CNAME | www |
xeroxytb.github.io |
(Les 4 enregistrements A sont requis pour la racine @ avec GitHub Pages.)
GitHub
- Repo emo-online → Settings → Pages
- Custom domain :
xeroxytb.com - Coche Enforce HTTPS (après validation DNS, ~10 min à 24 h)
- Le fichier
emo/frontend/public/CNAMEcontient déjàxeroxytb.com
Google OAuth (obligatoire après changement de domaine)
Google Cloud Console → client OAuth :
- Origines JS :
https://xeroxytb.com,https://www.xeroxytb.com - Redirect URI (inchangé, côté API) :
https://xroxx-emo-online-api.hf.space/api/auth/google/callback
2. GitHub Pages
Settings → Pages → Source = GitHub Actions
3. Créer le Space Hugging Face (1 fois)
- Compte gratuit : huggingface.co/join (GitHub OK)
- Crée un Space : new-space?sdk=docker
- Owner :
XeroxYTB - Name :
emo-online-api - SDK : Docker
- Visibility : Public
- Owner :
- Token HF : Settings → Access Tokens (Write)
- Secret GitHub :
HF_TOKEN
- Secret GitHub :
3. Secrets du Space HF (Settings → Variables and secrets)
Dans le Space emo-online-api → Settings → Variables and secrets :
| Variable | Valeur |
|---|---|
MONGO_URL |
URI MongoDB Atlas |
DB_NAME |
emo |
EMO_PUBLIC_BACKEND_URL |
https://xroxx-emo-online-api.hf.space |
EMO_FRONTEND_URL |
https://xeroxytb.com |
CORS_ORIGINS |
https://xeroxytb.com,https://www.xeroxytb.com,https://xeroxytb.github.io |
GOOGLE_CLIENT_ID |
Google Console |
GOOGLE_CLIENT_SECRET |
idem |
GROQ_API_KEY |
Groq gratuit (Llama, Gemma) |
HF_TOKEN |
Hugging Face — router + sync Space |
OPENROUTER_API_KEY |
Manquant — openrouter.ai/keys |
DEEPSEEK_API_KEY |
Manquant — platform.deepseek.com |
OPENAI_API_KEY |
ChatGPT (crédits requis) |
ANTHROPIC_API_KEY |
Claude (crédits requis) |
GEMINI_API_KEY |
Gemini (quota free) |
EMO_ADMIN_EMAILS |
ton email |
Ajouter les clés (automatisé)
# 1. Assistant interactif (ouvre les liens, remplit .env)
powershell -ExecutionPolicy Bypass -File scripts\setup-llm-keys.ps1
# 2. Vérifier local + prod
python scripts\check-llm-keys.py
# 3. Pousser vers HF Space
scripts\sync-hf-secrets.bat
Puis Restart le Space : Settings → Restart.
Atlas Network Access : autorise 0.0.0.0/0.
5. Google OAuth
- Origines JS :
https://xeroxytb.com,https://www.xeroxytb.com - Redirect URI :
https://xroxx-emo-online-api.hf.space/api/auth/google/callback
6. Déployer
Push sur main → workflow Deploy :
- Push le code vers le Space HF (si
HF_TOKENconfiguré) - HF rebuild le Docker automatiquement
- Publie le frontend sur GitHub Pages
Test API : https://xroxx-emo-online-api.hf.space/api/health
Important : utilise l’URL *.hf.space, pas la page Hub (huggingface.co/spaces/...).
Dev local
cd emo\backend && start.bat
cd emo\frontend && npm start