-
Notifications
You must be signed in to change notification settings - Fork 32
Installation Guide
wiki-sync-bot edited this page Jul 30, 2025
·
3 revisions
Полное руководство по установке и настройке Vidzilla для разработчиков.
- Python 3.11+ (рекомендуется 3.11.13)
- FFmpeg (для обработки видео)
- MongoDB (база данных)
- Git (для клонирования репозитория)
- 4GB RAM (минимум), 8GB+ (рекомендуется)
- 10GB свободного места на диске
-
Telegram Bot Token (от @BotFather)
-
MongoDB Atlas или локальная установка
-
Stripe Account (для платежей, опционально)
# Clone the repository
git clone https://github.com/mirvald-space/Vidzilla.git
cd Vidzilla
# Or clone from alternative source
git clone https://github.com/MauriceWirthApps/TelegramSocialMediaVideoDownloader.git
cd TelegramSocialMediaVideoDownloader# Create virtual environment
python3 -m venv .myebv
source .myebv/bin/activate # Linux/Mac
# .myebv\Scripts\activate # Windows
# Upgrade pip
pip install --upgrade pip
# Install dependencies
pip install -r requirements.txt
pip install -r requirements-dev.txt # For developmentsudo apt update
sudo apt install ffmpeg# Using Homebrew
brew install ffmpeg
# Using MacPorts
sudo port install ffmpeg# Using Chocolatey
choco install ffmpeg
# Or download from https://ffmpeg.org/download.htmlffmpeg -version- Создайте аккаунт на MongoDB Atlas
- Создайте новый кластер
- Получите строку подключения
- Добавьте IP-адрес в whitelist
# Ubuntu/Debian
sudo apt install mongodb
# macOS
brew install mongodb-community
# Start MongoDB
sudo systemctl start mongodb # Linux
brew services start mongodb-community # macOS# Copy environment template
cp .env.example .env
# Edit configuration
nano .env # or your preferred editor# Bot Configuration
BOT_TOKEN=your_telegram_bot_token_here
BOT_USERNAME=@your_bot_username
# Database
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/?retryWrites=true&w=majority
MONGODB_DB_NAME=video_downloader_bot
# API Keys
# Admin Settings
ADMIN_IDS=123456789,987654321
FREE_LIMIT=3# Create required directories
mkdir -p temp_videos/compression
mkdir -p logs
mkdir -p ssl # If using HTTPS webhooks# Development mode
python bot.py
# With logging
python bot.py 2>&1 | tee logs/bot.log
# Background mode
nohup python bot.py > logs/bot.log 2>&1 &# Compression Configuration
COMPRESSION_TARGET_SIZE_MB=45
COMPRESSION_MAX_ATTEMPTS=3
COMPRESSION_QUALITY_LEVELS=28,32,36
COMPRESSION_TIMEOUT_SECONDS=300
COMPRESSION_MAX_CONCURRENT=2
# Performance Tuning
COMPRESSION_FFMPEG_PRESET=medium
COMPRESSION_ENABLE_HARDWARE_ACCEL=false
COMPRESSION_MAX_RESOLUTION=1280,720# Monitoring Configuration
MONITORING_ENABLED=true
MONITORING_CLEANUP_INTERVAL_HOURS=24
MONITORING_MAX_LOG_SIZE_MB=100
MONITORING_DISK_SPACE_WARNING_THRESHOLD=85# Webhook Settings (Production)
WEBHOOK_URL=https://your-domain.com/webhook
WEBHOOK_PATH=/webhook
WEBHOOK_PORT=8443
# SSL Certificate (if using HTTPS)
WEBHOOK_SSL_CERT=ssl/cert.pem
WEBHOOK_SSL_PRIV=ssl/private.keypip install -r requirements-dev.txt# Install pre-commit
pip install pre-commit
# Install hooks
pre-commit install
# Run hooks manually
pre-commit run --all-files# Run all tests
pytest
# Run with coverage
pytest --cov=utils --cov=handlers --cov-report=html
# Run specific test file
pytest tests/test_video_compression.py -v# Format code
black --line-length=100 .
isort --profile black --line-length=100 .
# Lint code
flake8 --max-line-length=100 .
mypy .
# Security check
bandit -r . -f json -o bandit-report.json# Create service file
sudo nano /etc/systemd/system/vidzilla.service[Unit]
Description=Vidzilla Telegram Bot
After=network.target
[Service]
Type=simple
User=vidzilla
WorkingDirectory=/opt/vidzilla
Environment=PATH=/opt/vidzilla/.myebv/bin
ExecStart=/opt/vidzilla/.myebv/bin/python bot.py
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target# Enable and start service
sudo systemctl enable vidzilla
sudo systemctl start vidzilla
sudo systemctl status vidzillaserver {
listen 443 ssl;
server_name your-domain.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/private.key;
location /webhook {
proxy_pass http://localhost:8443;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}# Check FFmpeg installation
which ffmpeg
ffmpeg -version
# Add to PATH if needed
export PATH=$PATH:/usr/local/bin# Test connection
python -c "
import pymongo
client = pymongo.MongoClient('your_mongodb_uri')
print(client.server_info())
"# Fix permissions
chmod +x bot.py
chown -R $USER:$USER temp_videos/# View recent logs
tail -f logs/bot.log
# Search for errors
grep -i error logs/bot.log
# Monitor compression logs
tail -f compression.log# Increase file descriptor limits
echo "* soft nofile 65536" >> /etc/security/limits.conf
echo "* hard nofile 65536" >> /etc/security/limits.conf
# Optimize for video processing
echo "vm.swappiness=10" >> /etc/sysctl.conf// MongoDB indexes
db.users.createIndex({ "user_id": 1 })
db.users.createIndex({ "created_at": 1 })
db.coupons.createIndex({ "code": 1 }, { unique: true })- 🏗️ Architecture Overview - Архитектура проекта
- 🧪 Testing Guide - Руководство по тестированию
- 🚀 Deployment Guide - Развертывание
- ⚙️ Configuration - Детальная конфигурация
| Info | Value |
|---|---|
| 📅 Last Updated | $(date '+%Y-%m-%d %H:%M:%S UTC') |
| 🤖 Sync Method | Automated via GitHub Actions |
| 📝 Source | wiki/ directory |
| ✏️ Edit | Improve documentation |
| 🐛 Issues | Report problems |
🎯 Vidzilla - Social Media Video Downloader Bot
⭐ Star us on GitHub if you find this useful!
- Pages: $(find . -name ".md" -not -name "_" | wc -l)
- Last Sync: $(date '+%Y-%m-%d %H:%M UTC')
🤖 Auto-generated navigation