Files
Ultroid-fork/README_DOCKER.md
Cursor User 7f1ba3cdc3 Add comprehensive Docker deployment with safety features
Features:
- Complete Ubuntu dependency resolution in requirements.txt
- Safe Docker deployment that preserves existing bash startup setups
- Isolated Docker environment (docker-ultroid/) with different ports
- Automatic detection of existing bot configurations
- Session generation scripts for Docker deployment
- Health check and diagnostic tools
- Comprehensive documentation and deployment guides

 Safety:
- Detects existing 'bash startup' method and creates isolated environment
- Uses different ports (8081) to avoid conflicts
- Separate volumes and configs for Docker deployment
- Both bash startup and Docker can run side by side
- No interference with existing bot setups

 Files added/updated:
- requirements.txt (all missing dependencies)
- Docker setup (Dockerfile, docker-compose.yml, .env.sample)
- Deployment scripts (ubuntu_setup.sh, docker-deploy.sh, quick-start.sh)
- Safety scripts (safe-docker-setup.sh with isolation logic)
- Management tools (Makefile, health_check.sh, generate-session.sh)
- Documentation (SAFE_DOCKER_GUIDE.md, DOCKER_DEPLOYMENT.md, etc.)

Ready for production Ubuntu server deployment!
2025-06-18 20:42:10 +02:00

6.8 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 - Makefile with shortcuts
  • Health monitoring - Built-in status checks

📚 Documentation

  • Docker Guide - DOCKER_DEPLOYMENT.md
  • Deployment Summary - DEPLOYMENT_SUMMARY.md
  • Environment Template - .env.sample

🚀 Deployment Methods

./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)

2. Docker Method

./generate-session.sh
# Select option 1 (Docker)

3. Online Method

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

🎮 Management Commands

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

🔍 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     → Bot downloads
./uploads       → Bot uploads  
./logs          → Application logs
./resources     → Bot resources

🆚 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

📄 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 status shows all services running
  • make logs shows no critical errors
  • Bot responds to .alive command
  • All plugins load without issues
  • Database connection is stable

🚀 Ready to deploy Ultroid with Docker!

Start with ./quick-start.sh for the easiest experience.