|
Download DEPLOY.md from luci18/animebot: direct link, hf CLI and curl.
- Browser
- Download file 3.66 kB
-
https://huggingface.co/luci18/animebot/resolve/main/DEPLOY.md
- Command line
-
hf download hf://luci18/animebot/DEPLOY.md
-
curl -L -o DEPLOY.md https://huggingface.co/luci18/animebot/resolve/main/DEPLOY.md
3.66 kB
π Deploy to GitHub + Hugging Face
Quick Start
1. Initialize & Push to GitHub
Windows:
setup-github.bat
Linux/Mac:
bash setup-github.sh
2. Manual GitHub Push
# Replace with your actual repo
git remote add origin https://github.com/YOUR_USERNAME/anime-encoder-bot.git
git push -u origin main
3. Create Hugging Face Space
- Go to: https://huggingface.co/new-space
- Owner: Select your username
- Space Name:
anime-encoder-bot - SDK: Select
Docker - Space Hardware:
CPU Basic(free) orGPUfor faster encoding - Click Create Space
4. Configure GitHub Secrets
In your GitHub repo, go to Settings > Secrets and variables > Actions:
Add this secret:
| Secret Name | Value | Example |
|---|---|---|
HF_SPACE_ID |
Your space ID | itzmelucifer/anime-encoder-bot |
β HF_TOKEN is already configured in the workflow file.
OR Push Directly (No GitHub needed):
push-hf.bat
Enter your space ID when prompted.
5. Hugging Face Environment Variables
In your Space, go to Settings > Variables:
API_ID=your_api_id
API_HASH=your_api_hash
BOT_TOKEN=your_bot_token
OWNER_ID=your_telegram_id
MONGO_URI=mongodb+srv://...
ADMIN_USERNAME=admin
ADMIN_PASSWORD_HASH=bcrypt_hash
FLASK_SECRET_KEY=random_secret
FFMPEG_PATH=ffmpeg
FFPROBE_PATH=ffprobe
6. Deploy
Once secrets are set, every push to GitHub will auto-deploy to Hugging Face!
Manual deploy trigger:
- Go to Actions tab in GitHub
- Click Deploy to Hugging Face
- Click Run workflow
π Setup Checklist
- GitHub repository created
- Code pushed to GitHub
- Hugging Face Space created (Docker SDK)
- GitHub secrets:
HF_TOKEN,HF_SPACE_ID - Hugging Face environment variables set
- First deployment successful
π§ Troubleshooting
Git push fails?
git pull origin main --rebase
git push -u origin main
Hugging Face deploy fails?
- Check GitHub Actions logs
- Verify HF_TOKEN is correct
- Check HF_SPACE_ID format (must be
username/space-name)
Bot not starting?
- Check Hugging Face logs in Space
- Verify all env variables are set
- Check MongoDB connection string is accessible from Hugging Face
MongoDB Connection Issues?
If using MongoDB Atlas, whitelist Hugging Face IPs:
- Go to MongoDB Atlas β Network Access
- Add IP:
0.0.0.0/0(allow all - not recommended for production) - Or use specific Hugging Face egress IPs
π File Structure for Hugging Face
.
βββ bot/ # Telegram bot code
βββ .github/workflows/ # Auto-deploy
βββ Dockerfile # Container config
βββ requirements.txt # Python deps
βββ README.md # Space docs
βββ space.md # Hugging Face config
π Useful Links
- GitHub: https://github.com/new
- Hugging Face Tokens: https://huggingface.co/settings/tokens
- New Space: https://huggingface.co/new-space
- HF Docker Docs: https://huggingface.co/docs/hub/spaces-sdks-docker
π‘ Tips
- Free hosting: Hugging Face CPU Basic is free
- GPU encoding: Upgrade to GPU hardware for faster encoding
- Persistence: Hugging Face spaces are ephemeral - use MongoDB for data
- Sleep: Free spaces sleep after inactivity - bot will reconnect automatically
π Success!
Your bot will be live at:
https://huggingface.co/spaces/YOUR_USERNAME/anime-encoder-bot
Web admin panel:
https://huggingface.co/spaces/YOUR_USERNAME/anime-encoder-bot