initializare
This commit is contained in:
264
deployment/windows/QUICK_START.md
Normal file
264
deployment/windows/QUICK_START.md
Normal file
@@ -0,0 +1,264 @@
|
||||
# 🚀 Quick Start - BTGO Telegram Bot pe VM Windows
|
||||
|
||||
Ghid rapid pentru deployment în 5 minute.
|
||||
|
||||
## ✅ Pre-requisites Checklist
|
||||
|
||||
- [ ] Windows Server/Desktop cu GUI (pentru browser vizibil)
|
||||
- [ ] Python 3.11+ instalat în PATH
|
||||
- [ ] Cont Administrator pe Windows
|
||||
- [ ] Bot Telegram creat cu @BotFather
|
||||
- [ ] Credențiale BTGO (LOGIN_ID + PAROLA)
|
||||
|
||||
---
|
||||
|
||||
## 📥 Pas 1: Clone Repository (pe VM)
|
||||
|
||||
```batch
|
||||
cd E:\proiecte
|
||||
git clone <repo-url> btgo-playwright
|
||||
cd btgo-playwright
|
||||
```
|
||||
|
||||
Sau copiază manualmente folderul pe VM.
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ Pas 2: Configurare `.env`
|
||||
|
||||
```batch
|
||||
REM Copiază template
|
||||
copy .env.example .env
|
||||
|
||||
REM Editează cu Notepad
|
||||
notepad .env
|
||||
```
|
||||
|
||||
**Configurare minimă necesară:**
|
||||
|
||||
```ini
|
||||
# TELEGRAM
|
||||
TELEGRAM_BOT_TOKEN=123456:ABC-DEF... # De la @BotFather
|
||||
TELEGRAM_ALLOWED_USER_IDS=123456789 # Telegram User ID-ul tău
|
||||
|
||||
# BTGO
|
||||
LOGIN_ID=your_btgo_username
|
||||
PAROLA=your_btgo_password
|
||||
|
||||
# SCRAPER
|
||||
HEADLESS=false # ⚠️ CRITICAL: NU schimba în true!
|
||||
```
|
||||
|
||||
**Cum afli User ID-ul tău:**
|
||||
|
||||
```batch
|
||||
REM După ce ai setat TELEGRAM_BOT_TOKEN în .env
|
||||
python get_telegram_chat_id.py
|
||||
REM Trimite un mesaj bot-ului în Telegram
|
||||
REM Script-ul va afișa User ID-ul
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Pas 3: Deploy Automat
|
||||
|
||||
**Right-click pe `deploy.ps1` → "Run with PowerShell" (ca Administrator)**
|
||||
|
||||
SAU din PowerShell Administrator:
|
||||
```powershell
|
||||
cd deployment\windows\scripts
|
||||
.\deploy.ps1
|
||||
```
|
||||
|
||||
**Scriptul va instala:**
|
||||
- ✅ Dependențe Python
|
||||
- ✅ Playwright browsers
|
||||
- ✅ Serviciu Windows
|
||||
- ✅ Auto-start la boot
|
||||
|
||||
**Durată:** ~2-3 minute
|
||||
|
||||
---
|
||||
|
||||
## ✅ Pas 4: Verificare
|
||||
|
||||
### 1. Verifică serviciul rulează
|
||||
|
||||
```batch
|
||||
sc query BTGOTelegramBot
|
||||
```
|
||||
|
||||
**Output așteptat:**
|
||||
```
|
||||
STATE : 4 RUNNING
|
||||
```
|
||||
|
||||
### 2. Verifică logs
|
||||
|
||||
```batch
|
||||
deployment\windows\scripts\view_logs.bat
|
||||
```
|
||||
|
||||
Sau direct:
|
||||
```batch
|
||||
type logs\telegram_bot_stdout.log
|
||||
```
|
||||
|
||||
**Ar trebui să vezi:**
|
||||
```
|
||||
[2025-11-06 10:15:23] [INFO] Bot inițializat. Useri autorizați: [123456789]
|
||||
[2025-11-06 10:15:23] [INFO] Bot pornit. Așteaptă comenzi...
|
||||
```
|
||||
|
||||
### 3. Testează în Telegram
|
||||
|
||||
1. Deschide Telegram
|
||||
2. Caută bot-ul tău (numele setat la @BotFather)
|
||||
3. Trimite `/start`
|
||||
|
||||
**Răspuns așteptat:**
|
||||
```
|
||||
🤖 BTGO Scraper Trigger Bot
|
||||
|
||||
Comenzi disponibile:
|
||||
• /scrape - Rulează scraper-ul
|
||||
• /status - Status sistem
|
||||
• /help - Ajutor
|
||||
```
|
||||
|
||||
4. Trimite `/scrape` pentru test complet
|
||||
|
||||
**Flow 2FA:**
|
||||
- Bot răspunde: "🤖 BTGO Scraper pornit... Așteaptă 2FA pe telefon!"
|
||||
- Primești notificare pe telefon în George App
|
||||
- Aprobi 2FA
|
||||
- Bot trimite fișierele (solduri + tranzacții CSV)
|
||||
|
||||
---
|
||||
|
||||
## 🎉 Gata!
|
||||
|
||||
Serviciul rulează acum non-stop pe VM. La reboot, pornește automat.
|
||||
|
||||
---
|
||||
|
||||
## 📋 Comenzi Utile Day-to-Day
|
||||
|
||||
### Meniu Interactiv (Cel mai ușor!)
|
||||
|
||||
```powershell
|
||||
# Right-click → "Run with PowerShell" (ca Admin)
|
||||
deployment\windows\scripts\menu.ps1
|
||||
```
|
||||
|
||||
### Comenzi Directe PowerShell
|
||||
|
||||
```powershell
|
||||
# Status rapid
|
||||
.\status.ps1
|
||||
|
||||
# Restart serviciu (după modificări cod)
|
||||
.\restart_service.ps1
|
||||
|
||||
# View logs live
|
||||
.\view_logs.ps1
|
||||
|
||||
# Oprește serviciu
|
||||
Stop-Service BTGOTelegramBot
|
||||
|
||||
# Pornește serviciu
|
||||
Start-Service BTGOTelegramBot
|
||||
|
||||
# Restart serviciu
|
||||
Restart-Service BTGOTelegramBot
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Update Cod (după modificări)
|
||||
|
||||
```powershell
|
||||
# Pe VM
|
||||
cd E:\proiecte\btgo-playwright
|
||||
git pull
|
||||
|
||||
# Restart serviciu (PowerShell)
|
||||
deployment\windows\scripts\restart_service.ps1
|
||||
|
||||
# SAU folosește meniul interactiv
|
||||
deployment\windows\scripts\menu.ps1
|
||||
# → Selectează opțiunea 6 (Restart)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🐛 Troubleshooting Rapid
|
||||
|
||||
### Serviciul nu pornește
|
||||
|
||||
```batch
|
||||
# Verifică logs
|
||||
type logs\telegram_bot_stderr.log
|
||||
```
|
||||
|
||||
**Erori comune:**
|
||||
|
||||
**"ModuleNotFoundError":**
|
||||
```batch
|
||||
python -m pip install -r requirements.txt
|
||||
deployment\windows\scripts\restart_service.bat
|
||||
```
|
||||
|
||||
**"TELEGRAM_BOT_TOKEN nu este setat":**
|
||||
- Verifică `.env` există și conține token-ul
|
||||
- Token-ul trebuie pe o singură linie, fără spații extra
|
||||
|
||||
**"Access Denied" în browser:**
|
||||
- Verifică `HEADLESS=false` în `.env`
|
||||
- Nu folosi Docker/headless mode
|
||||
|
||||
### Bot nu răspunde în Telegram
|
||||
|
||||
1. **Verifică serviciul:**
|
||||
```batch
|
||||
sc query BTGOTelegramBot
|
||||
```
|
||||
|
||||
2. **Testează manual:**
|
||||
```batch
|
||||
REM Oprește serviciul
|
||||
net stop BTGOTelegramBot
|
||||
|
||||
REM Rulează manual pentru debug
|
||||
python telegram_trigger_bot.py
|
||||
|
||||
REM Trimite /start în Telegram
|
||||
REM Vezi output-ul direct în terminal
|
||||
```
|
||||
|
||||
3. **Verifică firewall:**
|
||||
- Bot-ul trebuie să acceseze `api.telegram.org` (port 443)
|
||||
|
||||
### Scraper-ul timeout-ează la 2FA
|
||||
|
||||
În `.env`:
|
||||
```ini
|
||||
TIMEOUT_2FA_SECONDS=600 # Crește la 10 minute
|
||||
```
|
||||
|
||||
Apoi restart:
|
||||
```batch
|
||||
deployment\windows\scripts\restart_service.bat
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📞 Ajutor Suplimentar
|
||||
|
||||
- **README complet:** `deployment\windows\README.md`
|
||||
- **Setup Telegram:** `TELEGRAM_BOT_SETUP.md`
|
||||
- **Documentație proiect:** `CLAUDE.md`
|
||||
|
||||
---
|
||||
|
||||
**Enjoy! 🎉**
|
||||
Reference in New Issue
Block a user