- Corrected undefined variable 'x' in funcs.py. - Refactored configuration loading in funcs.py for clarity and to resolve Pylint errors. - Changed logging f-strings to %-style formatting across multiple files. - Added encoding='utf-8' to open() calls. - Replaced list comprehensions used for side-effects with for-loops. - Made some broad exception catches more specific. - Added check=True to subprocess.run() calls in loader.py. - Corrected function signature parameter orders (e.g., *args placement). - Removed some unused variables and imports. - Added Pylint disable comments for known false positives (e.g., no-member for psycopg2.errors and base class methods). - Improved error handling and logging in funcs.py for startup sequences. - Addressed dependency installation issues by commenting out 'pokedex' (unavailable on PyPI) and correcting case for 'SpeechRecognition' in requirements.txt.
7.1 KiB
7.1 KiB
🐳 Ultroid Docker Deployment
Complete Docker-based deployment solution for Ultroid Telegram UserBot with all dependencies, databases, and services included.
⚡ Quick Start
# 1. Clone repository
git clone https://github.com/TeamUltroid/Ultroid.git
cd Ultroid
# 2. One-command deployment
chmod +x quick-start.sh && ./quick-start.sh
That's it! The script will guide you through session generation and deployment.
🎯 What's Included
📦 Complete Docker Stack
- Ultroid Bot - Main userbot service
- Redis Database - Primary data storage (recommended)
- MongoDB - Alternative database option
- Session Generator - Multiple methods for session creation
🔧 Management Tools
- Automated deployment -
docker-deploy.sh - Session generation -
generate-session.sh - Easy commands -
Makefilewith shortcuts - Health monitoring - Built-in status checks
📚 Documentation
- Docker Guide -
DOCKER_DEPLOYMENT.md - Deployment Summary -
DEPLOYMENT_SUMMARY.md - Environment Template -
.env.sample
🚀 Deployment Methods
Method 1: Quick Start (Recommended)
./quick-start.sh
Method 2: Step by Step
# Generate session
./generate-session.sh
# Configure environment
cp .env.sample .env
nano .env
# Deploy
./docker-deploy.sh
Method 3: Manual Commands
# Build and start
make build
make start
# Or using docker-compose directly
docker-compose up -d
📋 Prerequisites
- Docker & Docker Compose
- Telegram API credentials (my.telegram.org)
- Session string (generated automatically)
🔑 Session String Generation
Choose your preferred method:
1. Telegram Bot (Easiest)
- Go to @SessionGeneratorBot
- Follow the prompts
2. Docker Method
./generate-session.sh
# Select option 1 (Docker)
3. Online Method
- Visit Replit Session Generator
- Fork and run
4. Local Method
wget -O session.py https://git.io/JY9JI && python3 session.py
⚙️ Configuration
Required Variables (.env)
SESSION=your_session_string_here
API_ID=your_api_id
API_HASH=your_api_hash
Database Options
Redis (Default)
REDIS_URI=redis://redis:6379
REDIS_PASSWORD=ultroid123
MongoDB
MONGO_URI=mongodb://ultroid:ultroid123@mongodb:27017/ultroid?authSource=admin
External Database
DATABASE_URL=postgresql://user:pass@host:port/db
Optional Features
BOT_TOKEN= # Assistant bot
LOG_CHANNEL= # Logging channel
OWNER_ID= # Your user ID
HEROKU_API_KEY= # For updates
TZ=Asia/Kolkata # Set your desired timezone (e.g., Europe/London, America/New_York)
🎮 Management Commands
Using Makefile (Recommended)
make help # Show all commands
make start # Start services
make stop # Stop services
make restart # Restart bot
make logs # View logs
make shell # Access container
make backup # Backup database
make update # Update and restart
make health # Health check
make stats # Resource usage
Using Docker Compose
docker-compose up -d # Start
docker-compose down # Stop
docker-compose logs -f ultroid # Logs
docker-compose restart ultroid # Restart
docker-compose exec ultroid bash # Shell (Note: Container runs as 'ultroid' user, WORKDIR is /home/ultroid/app)
🔍 Monitoring & Troubleshooting
Check Status
make status # Service overview
make health # Health check
make logs # Recent logs
Common Issues
Services not starting
make status
docker-compose logs ultroid
Database connection issues
make redis-cli # Access Redis
make mongo-cli # Access MongoDB
Bot not responding
make logs # Check for errors
make restart # Restart bot
📊 Features & Benefits
✅ Complete Solution
- All 188+ plugins/addons included
- Google Drive integration ready
- Media processing (images, videos, audio)
- Web scraping capabilities
- Database persistence
- Automated backups
✅ Production Ready
- Auto-restart on failure
- Health monitoring
- Volume persistence
- Easy updates
- Resource monitoring
- Security isolation
✅ Easy Management
- One-command deployment
- Simple update process
- Built-in backup system
- Comprehensive logging
- Shell access for debugging
🔄 Updates
Automatic Updates
make update # Pull, build, restart
Manual Updates
git pull
docker-compose build
docker-compose up -d
💾 Backup & Restore
Create Backup
make backup # Creates timestamped backup
Restore Backup
# Copy backup file to container
docker cp backup.rdb ultroid-redis:/data/dump.rdb
docker-compose restart redis
🌐 External Access
Database Access
- Redis:
localhost:6379 - MongoDB:
localhost:27017
Volume Mounts
./downloads → /home/ultroid/app/downloads
./uploads → /home/ultroid/app/uploads
./logs → /home/ultroid/app/logs
./resources → /home/ultroid/app/resources
# .env and credentials.json are also mounted into /home/ultroid/app/
🆚 Comparison with Other Methods
| Feature | Docker | Traditional | Heroku |
|---|---|---|---|
| Setup Time | 5 minutes | 30+ minutes | 10 minutes |
| Dependencies | Automated | Manual | Automated |
| Database | Included | External setup | Add-on required |
| Updates | One command | Complex | Auto |
| Isolation | Full | None | Full |
| Cost | Free | Free | Limited free |
📞 Support & Resources
- Repository: TeamUltroid/Ultroid
- Telegram: @UltroidSupport
- Session Bot: @SessionGeneratorBot
- Documentation: Official Docs
📄 Files Overview
📁 Ultroid/
├── 🐳 docker-compose.yml # Service orchestration
├── 🐳 Dockerfile # Container definition
├── 🚀 quick-start.sh # One-command deployment
├── 🚀 docker-deploy.sh # Advanced deployment
├── 🔑 generate-session.sh # Session generator
├── ⚙️ .env.sample # Environment template
├── 📖 DOCKER_DEPLOYMENT.md # Complete guide
├── 📋 DEPLOYMENT_SUMMARY.md # Summary
├── 🔧 Makefile # Easy commands
└── 📚 README_DOCKER.md # This file
🎉 Success Indicators
Your deployment is successful when:
- ✅
make statusshows all services running - ✅
make logsshows no critical errors - ✅ Bot responds to
.alivecommand - ✅ All plugins load without issues
- ✅ Database connection is stable
🚀 Ready to deploy Ultroid with Docker!
Start with ./quick-start.sh for the easiest experience.