@woai
commited on
Commit
·
4cfc8a2
1
Parent(s):
6bf65c9
📄 Add Quick Start guide and Linux deployment scripts - QUICK_START_WINDOWS.md for 5-minute setup, deploy.sh and update.sh for Linux/Ubuntu servers, Complete cross-platform deployment support
Browse files- QUICK_START_WINDOWS.md +50 -0
- deploy.sh +205 -0
- update.sh +81 -0
QUICK_START_WINDOWS.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ⚡ Quick Start - Windows
|
| 2 |
+
|
| 3 |
+
Быстрое развертывание YouTube Metadata Extractor на Windows за 5 минут.
|
| 4 |
+
|
| 5 |
+
## 🚀 Супер быстрый старт (1 команда)
|
| 6 |
+
|
| 7 |
+
1. **Откройте PowerShell как Администратор** (Win+X → Windows PowerShell (Admin))
|
| 8 |
+
|
| 9 |
+
2. **Выполните одну команду:**
|
| 10 |
+
```powershell
|
| 11 |
+
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser; cd $env:USERPROFILE; git clone https://huggingface.co/spaces/dzianisBY/YouTube_Creator_MetaData YouTube; cd YouTube; .\deploy.ps1
|
| 12 |
+
```
|
| 13 |
+
|
| 14 |
+
## 📝 Что дальше?
|
| 15 |
+
|
| 16 |
+
### 1. Добавьте API ключи
|
| 17 |
+
Отредактируйте файл `%USERPROFILE%\YouTube\.env`:
|
| 18 |
+
```env
|
| 19 |
+
YOUTUBE_API_KEY=ваш_youtube_api_ключ
|
| 20 |
+
TELEGRAM_TOKEN=ваш_telegram_bot_токен
|
| 21 |
+
GEMINI_API_KEY=ваш_gemini_api_ключ
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
### 2. Перезапустите службы
|
| 25 |
+
```powershell
|
| 26 |
+
Restart-Service YouTube-API, YouTube-Bot
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
### 3. Проверьте работу
|
| 30 |
+
- API: http://localhost:8080
|
| 31 |
+
- Статус служб: `Get-Service YouTube-*`
|
| 32 |
+
|
| 33 |
+
## 🔄 Обновление
|
| 34 |
+
```powershell
|
| 35 |
+
cd $env:USERPROFILE\YouTube
|
| 36 |
+
.\update.ps1
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
## 📞 Если что-то пошло не так
|
| 40 |
+
1. Проверьте логи: `Get-EventLog -LogName Application -Source YouTube*`
|
| 41 |
+
2. Читайте полную инструкцию: [DEPLOYMENT_WINDOWS.md](DEPLOYMENT_WINDOWS.md)
|
| 42 |
+
3. Запустите вручную для диагностики:
|
| 43 |
+
```powershell
|
| 44 |
+
cd $env:USERPROFILE\YouTube
|
| 45 |
+
.\.venv\Scripts\Activate.ps1
|
| 46 |
+
python main.py
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
---
|
| 50 |
+
💡 **Совет**: Сначала получите все API ключи, потом запускайте развертывание!
|
deploy.sh
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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| 4 |
+
# This script deploys the project on a remote Ubuntu server
|
| 5 |
+
|
| 6 |
+
echo "🚀 Starting deployment of YouTube Metadata Extractor..."
|
| 7 |
+
|
| 8 |
+
# Configuration
|
| 9 |
+
PROJECT_DIR="$HOME/YouTube"
|
| 10 |
+
REPO_URL="https://huggingface.co/spaces/dzianisBY/YouTube_Creator_MetaData"
|
| 11 |
+
PYTHON_ENV="$PROJECT_DIR/.venv"
|
| 12 |
+
|
| 13 |
+
# Colors for output
|
| 14 |
+
GREEN='\033[0;32m'
|
| 15 |
+
YELLOW='\033[1;33m'
|
| 16 |
+
RED='\033[0;31m'
|
| 17 |
+
NC='\033[0m' # No Color
|
| 18 |
+
|
| 19 |
+
# Function to print colored output
|
| 20 |
+
print_status() {
|
| 21 |
+
echo -e "${GREEN}✅ $1${NC}"
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
print_warning() {
|
| 25 |
+
echo -e "${YELLOW}⚠️ $1${NC}"
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
print_error() {
|
| 29 |
+
echo -e "${RED}❌ $1${NC}"
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
# Check if running on Ubuntu/Debian
|
| 33 |
+
if ! command -v apt &> /dev/null; then
|
| 34 |
+
print_error "This script is designed for Ubuntu/Debian systems"
|
| 35 |
+
exit 1
|
| 36 |
+
fi
|
| 37 |
+
|
| 38 |
+
# Update system packages
|
| 39 |
+
print_status "Updating system packages..."
|
| 40 |
+
sudo apt update && sudo apt upgrade -y
|
| 41 |
+
|
| 42 |
+
# Install required system packages
|
| 43 |
+
print_status "Installing system dependencies..."
|
| 44 |
+
sudo apt install -y python3 python3-pip python3-venv git curl nginx
|
| 45 |
+
|
| 46 |
+
# Create project directory
|
| 47 |
+
print_status "Setting up project directory..."
|
| 48 |
+
mkdir -p "$PROJECT_DIR"
|
| 49 |
+
cd "$PROJECT_DIR"
|
| 50 |
+
|
| 51 |
+
# Clone or update repository
|
| 52 |
+
if [ -d ".git" ]; then
|
| 53 |
+
print_status "Updating existing repository..."
|
| 54 |
+
git pull origin main
|
| 55 |
+
else
|
| 56 |
+
print_status "Cloning repository..."
|
| 57 |
+
git clone "$REPO_URL" .
|
| 58 |
+
fi
|
| 59 |
+
|
| 60 |
+
# Create virtual environment
|
| 61 |
+
print_status "Setting up Python virtual environment..."
|
| 62 |
+
python3 -m venv "$PYTHON_ENV"
|
| 63 |
+
source "$PYTHON_ENV/bin/activate"
|
| 64 |
+
|
| 65 |
+
# Install Python dependencies
|
| 66 |
+
print_status "Installing Python dependencies..."
|
| 67 |
+
pip install --upgrade pip
|
| 68 |
+
pip install -r requirements.txt
|
| 69 |
+
pip install -r telegram_requirements.txt
|
| 70 |
+
|
| 71 |
+
# Create .env file template if it doesn't exist
|
| 72 |
+
if [ ! -f ".env" ]; then
|
| 73 |
+
print_warning "Creating .env template file..."
|
| 74 |
+
cat > .env << EOF
|
| 75 |
+
# YouTube API Configuration
|
| 76 |
+
YOUTUBE_API_KEY=your_youtube_api_key_here
|
| 77 |
+
|
| 78 |
+
# Telegram Bot Configuration
|
| 79 |
+
TELEGRAM_TOKEN=your_telegram_bot_token_here
|
| 80 |
+
|
| 81 |
+
# MCP Server Configuration
|
| 82 |
+
MCP_BASE_URL=https://youtube-bot.tuttech.net/api/mcp
|
| 83 |
+
|
| 84 |
+
# Gemini AI Configuration
|
| 85 |
+
GEMINI_API_KEY=your_gemini_api_key_here
|
| 86 |
+
|
| 87 |
+
# Server Configuration
|
| 88 |
+
HOST=0.0.0.0
|
| 89 |
+
PORT=8080
|
| 90 |
+
EOF
|
| 91 |
+
print_warning "Please edit .env file with your actual API keys!"
|
| 92 |
+
print_warning "File location: $PROJECT_DIR/.env"
|
| 93 |
+
fi
|
| 94 |
+
|
| 95 |
+
# Create systemd service files
|
| 96 |
+
print_status "Creating systemd service files..."
|
| 97 |
+
|
| 98 |
+
# API Server service
|
| 99 |
+
sudo tee /etc/systemd/system/youtube-api.service > /dev/null << EOF
|
| 100 |
+
[Unit]
|
| 101 |
+
Description=YouTube MCP API Server
|
| 102 |
+
After=network.target
|
| 103 |
+
|
| 104 |
+
[Service]
|
| 105 |
+
Type=simple
|
| 106 |
+
User=$USER
|
| 107 |
+
WorkingDirectory=$PROJECT_DIR
|
| 108 |
+
Environment=PATH=$PYTHON_ENV/bin
|
| 109 |
+
ExecStart=$PYTHON_ENV/bin/python main.py
|
| 110 |
+
Restart=always
|
| 111 |
+
RestartSec=10
|
| 112 |
+
|
| 113 |
+
[Install]
|
| 114 |
+
WantedBy=multi-user.target
|
| 115 |
+
EOF
|
| 116 |
+
|
| 117 |
+
# Telegram Bot service
|
| 118 |
+
sudo tee /etc/systemd/system/youtube-bot.service > /dev/null << EOF
|
| 119 |
+
[Unit]
|
| 120 |
+
Description=YouTube Telegram Bot
|
| 121 |
+
After=network.target youtube-api.service
|
| 122 |
+
|
| 123 |
+
[Service]
|
| 124 |
+
Type=simple
|
| 125 |
+
User=$USER
|
| 126 |
+
WorkingDirectory=$PROJECT_DIR
|
| 127 |
+
Environment=PATH=$PYTHON_ENV/bin
|
| 128 |
+
ExecStart=$PYTHON_ENV/bin/python run_telegram_bot.py
|
| 129 |
+
Restart=always
|
| 130 |
+
RestartSec=10
|
| 131 |
+
|
| 132 |
+
[Install]
|
| 133 |
+
WantedBy=multi-user.target
|
| 134 |
+
EOF
|
| 135 |
+
|
| 136 |
+
# Reload systemd and enable services
|
| 137 |
+
print_status "Enabling systemd services..."
|
| 138 |
+
sudo systemctl daemon-reload
|
| 139 |
+
sudo systemctl enable youtube-api.service
|
| 140 |
+
sudo systemctl enable youtube-bot.service
|
| 141 |
+
|
| 142 |
+
# Configure Nginx (optional)
|
| 143 |
+
print_status "Configuring Nginx..."
|
| 144 |
+
sudo tee /etc/nginx/sites-available/youtube-api > /dev/null << EOF
|
| 145 |
+
server {
|
| 146 |
+
listen 80;
|
| 147 |
+
server_name localhost;
|
| 148 |
+
|
| 149 |
+
location / {
|
| 150 |
+
proxy_pass http://127.0.0.1:8080;
|
| 151 |
+
proxy_set_header Host \$host;
|
| 152 |
+
proxy_set_header X-Real-IP \$remote_addr;
|
| 153 |
+
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
| 154 |
+
proxy_set_header X-Forwarded-Proto \$scheme;
|
| 155 |
+
proxy_connect_timeout 60s;
|
| 156 |
+
proxy_send_timeout 60s;
|
| 157 |
+
proxy_read_timeout 60s;
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
EOF
|
| 161 |
+
|
| 162 |
+
# Enable Nginx site
|
| 163 |
+
sudo ln -sf /etc/nginx/sites-available/youtube-api /etc/nginx/sites-enabled/
|
| 164 |
+
sudo nginx -t && sudo systemctl reload nginx
|
| 165 |
+
|
| 166 |
+
# Start services
|
| 167 |
+
print_status "Starting services..."
|
| 168 |
+
sudo systemctl start youtube-api.service
|
| 169 |
+
sudo systemctl start youtube-bot.service
|
| 170 |
+
|
| 171 |
+
# Check service status
|
| 172 |
+
print_status "Checking service status..."
|
| 173 |
+
sleep 5
|
| 174 |
+
|
| 175 |
+
if systemctl is-active --quiet youtube-api.service; then
|
| 176 |
+
print_status "YouTube API Server is running"
|
| 177 |
+
else
|
| 178 |
+
print_error "YouTube API Server failed to start"
|
| 179 |
+
sudo systemctl status youtube-api.service
|
| 180 |
+
fi
|
| 181 |
+
|
| 182 |
+
if systemctl is-active --quiet youtube-bot.service; then
|
| 183 |
+
print_status "YouTube Telegram Bot is running"
|
| 184 |
+
else
|
| 185 |
+
print_error "YouTube Telegram Bot failed to start"
|
| 186 |
+
sudo systemctl status youtube-bot.service
|
| 187 |
+
fi
|
| 188 |
+
|
| 189 |
+
print_status "Deployment completed!"
|
| 190 |
+
echo ""
|
| 191 |
+
echo "📋 Next steps:"
|
| 192 |
+
echo "1. Edit $PROJECT_DIR/.env with your API keys"
|
| 193 |
+
echo "2. Restart services: sudo systemctl restart youtube-api youtube-bot"
|
| 194 |
+
echo "3. Check logs: sudo journalctl -f -u youtube-api -u youtube-bot"
|
| 195 |
+
echo ""
|
| 196 |
+
echo "🔗 Service URLs:"
|
| 197 |
+
echo "- API Server: http://localhost:8080"
|
| 198 |
+
echo "- Health Check: http://localhost:8080/health"
|
| 199 |
+
echo ""
|
| 200 |
+
echo "📱 Service Management:"
|
| 201 |
+
echo "- Start: sudo systemctl start youtube-api youtube-bot"
|
| 202 |
+
echo "- Stop: sudo systemctl stop youtube-api youtube-bot"
|
| 203 |
+
echo "- Restart: sudo systemctl restart youtube-api youtube-bot"
|
| 204 |
+
echo "- Status: sudo systemctl status youtube-api youtube-bot"
|
| 205 |
+
echo "- Logs: sudo journalctl -f -u youtube-api -u youtube-bot"
|
update.sh
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# 🔄 YouTube Metadata Extractor - Update Script
|
| 4 |
+
# This script updates the project on a remote server
|
| 5 |
+
|
| 6 |
+
echo "🔄 Updating YouTube Metadata Extractor..."
|
| 7 |
+
|
| 8 |
+
# Configuration
|
| 9 |
+
PROJECT_DIR="$HOME/YouTube"
|
| 10 |
+
|
| 11 |
+
# Colors for output
|
| 12 |
+
GREEN='\033[0;32m'
|
| 13 |
+
YELLOW='\033[1;33m'
|
| 14 |
+
RED='\033[0;31m'
|
| 15 |
+
NC='\033[0m' # No Color
|
| 16 |
+
|
| 17 |
+
# Function to print colored output
|
| 18 |
+
print_status() {
|
| 19 |
+
echo -e "${GREEN}✅ $1${NC}"
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
print_warning() {
|
| 23 |
+
echo -e "${YELLOW}⚠️ $1${NC}"
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
print_error() {
|
| 27 |
+
echo -e "${RED}❌ $1${NC}"
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
# Check if project directory exists
|
| 31 |
+
if [ ! -d "$PROJECT_DIR" ]; then
|
| 32 |
+
print_error "Project directory not found: $PROJECT_DIR"
|
| 33 |
+
print_error "Please run deploy.sh first to set up the project"
|
| 34 |
+
exit 1
|
| 35 |
+
fi
|
| 36 |
+
|
| 37 |
+
cd "$PROJECT_DIR"
|
| 38 |
+
|
| 39 |
+
# Stop services
|
| 40 |
+
print_status "Stopping services..."
|
| 41 |
+
sudo systemctl stop youtube-api.service youtube-bot.service
|
| 42 |
+
|
| 43 |
+
# Pull latest changes
|
| 44 |
+
print_status "Pulling latest changes from repository..."
|
| 45 |
+
git pull origin main
|
| 46 |
+
|
| 47 |
+
# Activate virtual environment and update dependencies
|
| 48 |
+
print_status "Updating Python dependencies..."
|
| 49 |
+
source .venv/bin/activate
|
| 50 |
+
pip install --upgrade pip
|
| 51 |
+
pip install -r requirements.txt
|
| 52 |
+
pip install -r telegram_requirements.txt
|
| 53 |
+
|
| 54 |
+
# Start services
|
| 55 |
+
print_status "Starting services..."
|
| 56 |
+
sudo systemctl start youtube-api.service youtube-bot.service
|
| 57 |
+
|
| 58 |
+
# Check service status
|
| 59 |
+
print_status "Checking service status..."
|
| 60 |
+
sleep 5
|
| 61 |
+
|
| 62 |
+
if systemctl is-active --quiet youtube-api.service; then
|
| 63 |
+
print_status "YouTube API Server is running"
|
| 64 |
+
else
|
| 65 |
+
print_error "YouTube API Server failed to start"
|
| 66 |
+
sudo systemctl status youtube-api.service
|
| 67 |
+
fi
|
| 68 |
+
|
| 69 |
+
if systemctl is-active --quiet youtube-bot.service; then
|
| 70 |
+
print_status "YouTube Telegram Bot is running"
|
| 71 |
+
else
|
| 72 |
+
print_error "YouTube Telegram Bot failed to start"
|
| 73 |
+
sudo systemctl status youtube-bot.service
|
| 74 |
+
fi
|
| 75 |
+
|
| 76 |
+
print_status "Update completed!"
|
| 77 |
+
echo ""
|
| 78 |
+
echo "📋 Useful commands:"
|
| 79 |
+
echo "- Check logs: sudo journalctl -f -u youtube-api -u youtube-bot"
|
| 80 |
+
echo "- Service status: sudo systemctl status youtube-api youtube-bot"
|
| 81 |
+
echo "- Restart services: sudo systemctl restart youtube-api youtube-bot"
|