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!
196 lines
5.5 KiB
Markdown
196 lines
5.5 KiB
Markdown
# 🛡️ Safe Docker Setup for Existing Ultroid Users
|
|
|
|
## 🎯 Problem Solved
|
|
|
|
You have an existing Ultroid bot setup and want to try Docker without risking your current configuration. This solution creates a completely isolated Docker environment.
|
|
|
|
## ✅ Safety Features
|
|
|
|
### 🔒 **Complete Isolation**
|
|
- **Different container names**: `ultroid-docker-*` (won't conflict)
|
|
- **Different ports**: Redis 6380, MongoDB 27018 (your existing services safe)
|
|
- **Separate network**: `ultroid-docker-network`
|
|
- **Isolated volumes**: All data stored separately
|
|
- **Independent configuration**: Uses `docker-ultroid/.env`
|
|
|
|
### 🛡️ **Zero Risk to Existing Setup**
|
|
- ✅ Won't touch your existing `.env` file
|
|
- ✅ Won't modify session files
|
|
- ✅ Won't interfere with running bot
|
|
- ✅ Won't change any existing configurations
|
|
- ✅ Won't use same database connections
|
|
- ✅ Won't conflict with existing processes
|
|
|
|
## 🚀 Usage Options
|
|
|
|
### Option 1: Automatic Safe Mode (Recommended)
|
|
```bash
|
|
# The scripts automatically detect existing setup
|
|
./quick-start.sh
|
|
# Will automatically switch to safe mode if existing bot detected
|
|
```
|
|
|
|
### Option 2: Manual Safe Setup
|
|
```bash
|
|
# Explicitly use safe setup
|
|
chmod +x safe-docker-setup.sh
|
|
./safe-docker-setup.sh
|
|
```
|
|
|
|
### Option 3: Choose During Deployment
|
|
```bash
|
|
# Regular deployment script with safety prompts
|
|
./docker-deploy.sh
|
|
# Will ask what to do if existing setup detected
|
|
```
|
|
|
|
## 📁 File Structure Created
|
|
|
|
```
|
|
Ultroid/ # Your existing files (untouched)
|
|
├── .env # Your existing config (untouched)
|
|
├── resources/session/ # Your existing sessions (untouched)
|
|
├── ...existing files... # Everything stays the same
|
|
│
|
|
└── docker-ultroid/ # New isolated Docker environment
|
|
├── .env # Docker-specific config
|
|
├── docker-compose.yml # Isolated services
|
|
├── manage.sh # Docker management
|
|
├── downloads/ # Docker downloads
|
|
├── uploads/ # Docker uploads
|
|
├── logs/ # Docker logs
|
|
├── resources/session/ # Docker sessions
|
|
└── README.md # Docker instructions
|
|
```
|
|
|
|
## 🎮 Management Commands
|
|
|
|
### Your Existing Bot (Unchanged)
|
|
```bash
|
|
# Continue using your existing bot normally
|
|
python3 -m pyUltroid # Still works
|
|
# Or however you normally start it
|
|
```
|
|
|
|
### Docker Bot (New, Isolated)
|
|
```bash
|
|
cd docker-ultroid
|
|
|
|
./manage.sh start # Start Docker bot
|
|
./manage.sh stop # Stop Docker bot
|
|
./manage.sh restart # Restart Docker bot
|
|
./manage.sh logs # View Docker logs
|
|
./manage.sh status # Check Docker status
|
|
./manage.sh shell # Access Docker container
|
|
./manage.sh backup # Backup Docker database
|
|
./manage.sh clean # Remove Docker environment
|
|
```
|
|
|
|
## 📊 Port Differences
|
|
|
|
| Service | Your Existing | Docker Version | Conflict? |
|
|
|---------|---------------|----------------|-----------|
|
|
| Redis | 6379 (if used) | 6380 | ❌ No |
|
|
| MongoDB | 27017 (if used) | 27018 | ❌ No |
|
|
| Bot Process | `pyUltroid` | `ultroid-docker-bot` | ❌ No |
|
|
|
|
## 🔄 Running Both Side by Side
|
|
|
|
You can safely run both your existing bot and the Docker bot simultaneously:
|
|
|
|
```bash
|
|
# Terminal 1: Your existing bot
|
|
python3 -m pyUltroid
|
|
|
|
# Terminal 2: Docker bot
|
|
cd docker-ultroid && ./manage.sh start
|
|
```
|
|
|
|
Both will work independently without any conflicts!
|
|
|
|
## 🧪 Testing Docker Safely
|
|
|
|
### Step 1: Setup Docker Version
|
|
```bash
|
|
./safe-docker-setup.sh
|
|
cd docker-ultroid
|
|
nano .env # Add same credentials as your main bot
|
|
```
|
|
|
|
### Step 2: Test Docker Bot
|
|
```bash
|
|
./manage.sh start
|
|
./manage.sh logs # Check if it starts properly
|
|
```
|
|
|
|
### Step 3: Compare Performance
|
|
- Test features in Docker version
|
|
- Compare with your existing setup
|
|
- Decide which you prefer
|
|
|
|
### Step 4: Choose Your Setup
|
|
```bash
|
|
# Keep both (they don't conflict)
|
|
# Or remove Docker version:
|
|
./manage.sh clean
|
|
cd .. && rm -rf docker-ultroid
|
|
```
|
|
|
|
## 🎯 Benefits of This Approach
|
|
|
|
### ✅ **Risk-Free Testing**
|
|
- Try Docker without losing your current setup
|
|
- Easy to remove if you don't like it
|
|
- No data loss possible
|
|
|
|
### ✅ **Side-by-Side Comparison**
|
|
- Run both setups simultaneously
|
|
- Compare performance and features
|
|
- Gradual migration if desired
|
|
|
|
### ✅ **Independent Environments**
|
|
- Different configurations for different uses
|
|
- Separate databases and logs
|
|
- Isolated troubleshooting
|
|
|
|
## 🚨 Safety Guarantees
|
|
|
|
### What Will NEVER Happen:
|
|
- ❌ Your existing `.env` won't be modified
|
|
- ❌ Your session files won't be touched
|
|
- ❌ Your running bot won't be stopped
|
|
- ❌ Your database won't be affected
|
|
- ❌ Your downloads/uploads won't be moved
|
|
- ❌ Your configurations won't change
|
|
|
|
### What WILL Happen:
|
|
- ✅ New isolated Docker environment created
|
|
- ✅ Separate configuration files
|
|
- ✅ Different ports used
|
|
- ✅ Independent data storage
|
|
- ✅ Easy removal if not wanted
|
|
|
|
## 🆘 Emergency Removal
|
|
|
|
If you want to completely remove the Docker setup:
|
|
|
|
```bash
|
|
cd docker-ultroid
|
|
./manage.sh clean # Stop and remove containers
|
|
cd ..
|
|
rm -rf docker-ultroid # Remove entire Docker directory
|
|
```
|
|
|
|
Your original bot setup remains completely untouched!
|
|
|
|
## 🎉 Result
|
|
|
|
You get:
|
|
- 🛡️ **100% safety** for your existing setup
|
|
- 🐳 **Full Docker experience** with isolated environment
|
|
- 🔄 **Option to run both** setups simultaneously
|
|
- 🧪 **Risk-free testing** of Docker features
|
|
- 🗑️ **Easy removal** if not satisfied
|
|
|
|
**Your existing bot continues working exactly as before, with zero risk!**
|