docs(vm201): add btgo-playwright Windows service documentation
Document the BT George scraper running on VM 201: - Python + Playwright SDK (HEADLESS=false required for WAF bypass) - Windows Service deploy with Telegram notifications - Cross-references in proxmox/README.md and vm201-windows/README.md Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -62,6 +62,7 @@ proxmox/
|
|||||||
│ ├── docs/
|
│ ├── docs/
|
||||||
│ │ ├── vm201-certificat-letsencrypt-iis.md
|
│ │ ├── vm201-certificat-letsencrypt-iis.md
|
||||||
│ │ ├── vm201-dokploy-infrastructure.md # Arhitectură Dokploy + domenii
|
│ │ ├── vm201-dokploy-infrastructure.md # Arhitectură Dokploy + domenii
|
||||||
|
│ │ ├── vm201-btgo-playwright-service.md # Scraper BT George (Playwright Python)
|
||||||
│ │ ├── vm201-troubleshooting-backup-nfs.md
|
│ │ ├── vm201-troubleshooting-backup-nfs.md
|
||||||
│ │ └── vm201-troubleshooting-pana-curent-2026-01-11.md
|
│ │ └── vm201-troubleshooting-pana-curent-2026-01-11.md
|
||||||
│ ├── iis-configs/ # web.config pentru site-uri IIS
|
│ ├── iis-configs/ # web.config pentru site-uri IIS
|
||||||
@@ -306,12 +307,14 @@ ssh claude@100.95.55.51
|
|||||||
|
|
||||||
### VM 201 - Windows 11
|
### VM 201 - Windows 11
|
||||||
**Director:** `vm201-windows/`
|
**Director:** `vm201-windows/`
|
||||||
**IP:** DHCP | **Host:** pvemini | **Rol:** Reverse proxy IIS, client aplicații
|
**IP:** DHCP | **Host:** pvemini | **Rol:** Reverse proxy IIS, client aplicații, scraper BT George
|
||||||
|
|
||||||
| Fișier | Descriere |
|
| Fișier | Descriere |
|
||||||
|--------|-----------|
|
|--------|-----------|
|
||||||
| `README.md` | Configurație hardware, servicii, rețea, backup |
|
| `README.md` | Configurație hardware, servicii, rețea, backup |
|
||||||
| `docs/vm201-certificat-letsencrypt-iis.md` | Certificate SSL Let's Encrypt, Win-ACME, SNI |
|
| `docs/vm201-certificat-letsencrypt-iis.md` | Certificate SSL Let's Encrypt, Win-ACME, SNI |
|
||||||
|
| `docs/vm201-dokploy-infrastructure.md` | Arhitectură Dokploy + domenii |
|
||||||
|
| `docs/vm201-btgo-playwright-service.md` | Scraper BT George — Playwright Python SDK, Windows Service |
|
||||||
| `docs/vm201-troubleshooting-backup-nfs.md` | Incident backup NFS (2025-10-08) |
|
| `docs/vm201-troubleshooting-backup-nfs.md` | Incident backup NFS (2025-10-08) |
|
||||||
| `docs/vm201-troubleshooting-pana-curent-2026-01-11.md` | Incident pană curent |
|
| `docs/vm201-troubleshooting-pana-curent-2026-01-11.md` | Incident pană curent |
|
||||||
| `scripts/check-ssl-certificates.ps1` | Verificare/reînnoire certificate (Windows) |
|
| `scripts/check-ssl-certificates.ps1` | Verificare/reînnoire certificate (Windows) |
|
||||||
@@ -428,6 +431,7 @@ ssh root@10.0.20.201 "qm snapshot 302 pre-test --description 'Before ROA test'"
|
|||||||
- **Informații generale** → `vm201-windows/README.md`
|
- **Informații generale** → `vm201-windows/README.md`
|
||||||
- **Configurez site-uri IIS noi (Dokploy)** → `vm201-windows/docs/vm201-dokploy-infrastructure.md`
|
- **Configurez site-uri IIS noi (Dokploy)** → `vm201-windows/docs/vm201-dokploy-infrastructure.md`
|
||||||
- **Script setup IIS automat** → `vm201-windows/scripts/setup-new-iis-sites.ps1`
|
- **Script setup IIS automat** → `vm201-windows/scripts/setup-new-iis-sites.ps1`
|
||||||
|
- **Scraper BT George (btgo-playwright)** → `vm201-windows/docs/vm201-btgo-playwright-service.md`
|
||||||
|
|
||||||
### Dokploy + Traefik (LXC 103)
|
### Dokploy + Traefik (LXC 103)
|
||||||
- **Deploy aplicație nouă** → `lxc103-dokploy/README.md` → "Workflow: Adăugare App Nouă"
|
- **Deploy aplicație nouă** → `lxc103-dokploy/README.md` → "Workflow: Adăugare App Nouă"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
- **Host Proxmox:** pvemini (10.0.20.201)
|
- **Host Proxmox:** pvemini (10.0.20.201)
|
||||||
- **Storage:** local-zfs (ZFS pool)
|
- **Storage:** local-zfs (ZFS pool)
|
||||||
- **Status:** Running (onboot: enabled)
|
- **Status:** Running (onboot: enabled)
|
||||||
- **Rol:** Client aplicații Windows, SQL*Plus client, Reverse proxy IIS, Monitorizare UPS
|
- **Rol:** Client aplicații Windows, SQL*Plus client, Reverse proxy IIS, Monitorizare UPS, Scraper BT George (btgo-playwright)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -74,6 +74,18 @@ ssh root@10.0.20.201 "qm config 201 | grep -E 'efidisk|virtio'"
|
|||||||
|
|
||||||
**Documentație:** Vezi `ups/docs/INSTALARE-WINNUT.md`
|
**Documentație:** Vezi `ups/docs/INSTALARE-WINNUT.md`
|
||||||
|
|
||||||
|
#### 4. Scraper Banca Transilvania George (btgo-playwright)
|
||||||
|
- **Repo:** `git@gitea.romfast.ro:romfast/btgo-playwright.git`
|
||||||
|
- **Stack:** Python + `playwright==1.48.0` (Python SDK direct, nu MCP/CLI)
|
||||||
|
- **Scop:** Extrage solduri conturi + descarcă CSV tranzacții din `go.bancatransilvania.ro`
|
||||||
|
- **Deploy:** Windows Service (scripturi PowerShell)
|
||||||
|
- **Notificări:** Telegram (2FA, succes/eroare)
|
||||||
|
- **Constraint critic:** `HEADLESS=false` obligatoriu — WAF-ul BT blochează headless / Docker.
|
||||||
|
De aceea rulează pe VM 201 cu sesiune Windows activă.
|
||||||
|
- **Flow:** `login()` → `handle_2fa_wait()` → `read_accounts()` → `download_transactions()` → `save_results()`
|
||||||
|
|
||||||
|
**Documentație:** Vezi `docs/vm201-btgo-playwright-service.md`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🔧 Servicii Instalate
|
## 🔧 Servicii Instalate
|
||||||
@@ -345,6 +357,7 @@ ssh root@10.0.20.201 "qm delsnapshot 201 pre-update-snapshot"
|
|||||||
### Documentație VM 201 Specifică
|
### Documentație VM 201 Specifică
|
||||||
- **SSL Certificates IIS:** `docs/vm201-certificat-letsencrypt-iis.md`
|
- **SSL Certificates IIS:** `docs/vm201-certificat-letsencrypt-iis.md`
|
||||||
- **Arhitectură Dokploy + Domenii:** `docs/vm201-dokploy-infrastructure.md`
|
- **Arhitectură Dokploy + Domenii:** `docs/vm201-dokploy-infrastructure.md`
|
||||||
|
- **Scraper BT George (btgo-playwright):** `docs/vm201-btgo-playwright-service.md`
|
||||||
- **Troubleshooting Incident 2025-10-08:** `docs/vm201-troubleshooting-backup-nfs.md`
|
- **Troubleshooting Incident 2025-10-08:** `docs/vm201-troubleshooting-backup-nfs.md`
|
||||||
- **Troubleshooting Pană Curent 2026-01-11:** `docs/vm201-troubleshooting-pana-curent-2026-01-11.md`
|
- **Troubleshooting Pană Curent 2026-01-11:** `docs/vm201-troubleshooting-pana-curent-2026-01-11.md`
|
||||||
|
|
||||||
|
|||||||
137
proxmox/vm201-windows/docs/vm201-btgo-playwright-service.md
Normal file
137
proxmox/vm201-windows/docs/vm201-btgo-playwright-service.md
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
# VM 201 — btgo-playwright (Scraper Banca Transilvania George)
|
||||||
|
|
||||||
|
## Obiectiv
|
||||||
|
|
||||||
|
Scraper automat pentru `go.bancatransilvania.ro` (Banca Transilvania):
|
||||||
|
extrage solduri conturi și descarcă CSV-uri de tranzacții. Rulează ca Windows
|
||||||
|
Service pe VM 201, cu notificări Telegram.
|
||||||
|
|
||||||
|
**Repo:** `git@gitea.romfast.ro:romfast/btgo-playwright.git`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Stack Tehnic
|
||||||
|
|
||||||
|
| Componentă | Detaliu |
|
||||||
|
|------------|---------|
|
||||||
|
| Limbaj | Python (venv dedicat) |
|
||||||
|
| Browser automation | `playwright==1.48.0` (Python SDK) |
|
||||||
|
| Mod | API Python direct: `from playwright.sync_api import sync_playwright` |
|
||||||
|
| Notificări | Telegram Bot API |
|
||||||
|
| Deploy | Windows Service (PowerShell wrappers) |
|
||||||
|
| Headless | **`HEADLESS=false` obligatoriu** |
|
||||||
|
|
||||||
|
### De ce Playwright Python SDK (și nu MCP / CLI)
|
||||||
|
|
||||||
|
Trei variante de a folosi Playwright; aici se folosește **a treia**:
|
||||||
|
|
||||||
|
1. **Playwright MCP plugin** — pentru Claude Code (agent control). NU se aplică.
|
||||||
|
2. **Playwright CLI** — pentru proiecte Node.js. NU se aplică.
|
||||||
|
3. **Playwright Python SDK** — dependință Python instalată în venv, folosită
|
||||||
|
programatic din script. ✅ Folosită aici.
|
||||||
|
|
||||||
|
Concluzie: setup-ul actual e corect pentru acest use case. Funcționează
|
||||||
|
independent de Claude.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Constrângere Critică: HEADLESS=false
|
||||||
|
|
||||||
|
WAF-ul Banca Transilvania detectează și blochează:
|
||||||
|
- Rularea în Docker
|
||||||
|
- Rularea headless
|
||||||
|
|
||||||
|
**De aceea:**
|
||||||
|
- Serviciul rulează direct pe VM 201 (Windows GUI prezent)
|
||||||
|
- Browser-ul Chromium pornește vizibil (`headless=False`)
|
||||||
|
- VM 201 trebuie să rămână pornit cu sesiune Windows activă
|
||||||
|
|
||||||
|
Orice migrare către container Linux / headless rupe scraper-ul la primul login.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Flow Aplicație
|
||||||
|
|
||||||
|
```
|
||||||
|
login() → autentificare cu user/parolă
|
||||||
|
↓
|
||||||
|
handle_2fa_wait() → așteaptă confirmare 2FA (notificare Telegram)
|
||||||
|
↓
|
||||||
|
read_accounts() → parsează lista de conturi + solduri
|
||||||
|
↓
|
||||||
|
download_transactions() → descarcă CSV per cont
|
||||||
|
↓
|
||||||
|
save_results() → persistă date + notificare Telegram (succes/eroare)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Deploy ca Windows Service
|
||||||
|
|
||||||
|
Serviciul este înregistrat ca Windows Service prin scripturi PowerShell din
|
||||||
|
repo. Lansează `python.exe` din venv-ul proiectului asupra entry-point-ului
|
||||||
|
scraper-ului.
|
||||||
|
|
||||||
|
Verificare rapidă pe VM 201:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# Status serviciu
|
||||||
|
Get-Service -Name "btgo-playwright*"
|
||||||
|
|
||||||
|
# Restart
|
||||||
|
Restart-Service -Name "btgo-playwright"
|
||||||
|
|
||||||
|
# Loguri
|
||||||
|
Get-EventLog -LogName Application -Source "btgo-playwright" -Newest 20
|
||||||
|
```
|
||||||
|
|
||||||
|
(Numele exact al serviciului și calea instalării sunt în README-ul repo-ului
|
||||||
|
`btgo-playwright`.)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Dependențe Operaționale
|
||||||
|
|
||||||
|
- **VM 201 pornit + sesiune Windows activă** (necesar pentru `HEADLESS=false`)
|
||||||
|
- **Acces internet** către `go.bancatransilvania.ro`
|
||||||
|
- **Acces internet** către `api.telegram.org`
|
||||||
|
- **Chromium instalat de Playwright** (`playwright install chromium` în venv)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Login eșuează / WAF block
|
||||||
|
|
||||||
|
1. Verifică că serviciul rulează cu sesiune Windows activă (NU doar RDP
|
||||||
|
deconectat — sesiunea trebuie să persiste). Vezi mai jos.
|
||||||
|
2. Confirmă `HEADLESS=false` în config / variabile mediu.
|
||||||
|
3. Verifică că nu rulează în paralel altă instanță Chromium pe profilul
|
||||||
|
Playwright (lock pe user data dir).
|
||||||
|
|
||||||
|
### 2FA nu primește notificare
|
||||||
|
|
||||||
|
Verifică tokenul Telegram și `chat_id` din config. Test rapid:
|
||||||
|
```powershell
|
||||||
|
curl "https://api.telegram.org/bot$TOKEN/getMe"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Sesiune Windows se închide după RDP disconnect
|
||||||
|
|
||||||
|
Pentru ca browser-ul GUI să rămână activ după RDP disconnect, sesiunea
|
||||||
|
trebuie păstrată. Variante:
|
||||||
|
- `tscon` din alt RDP pentru a transfera sesiunea pe consola fizică
|
||||||
|
- Configurare auto-logon + serviciul lansat în sesiunea consolă
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Referințe
|
||||||
|
|
||||||
|
- Repo: http://gitea:3000/romfast/btgo-playwright
|
||||||
|
- Playwright Python docs: https://playwright.dev/python/
|
||||||
|
- README VM 201: `../README.md`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Ultima actualizare:** 2026-04-25
|
||||||
|
**Autor:** Marius Mutu
|
||||||
Reference in New Issue
Block a user