docs: noteaza lectiile de deployment (headless/WAF, Session 0, sleep-uri)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-15 16:07:13 +03:00
parent df4356d3b2
commit 584d59a8cf

View File

@@ -8,7 +8,23 @@ BTGO Scraper - Playwright automation for extracting account balances and transac
**Security Context**: Authorized personal banking automation tool for educational purposes.
**CRITICAL**: Docker/headless mode is **BLOCKED by WAF**. ONLY works locally with `HEADLESS=false`.
**CRITICAL**: Docker is **BLOCKED by WAF** (datacenter IP). Run locally only.
## Lessons Learned (deployment)
- **Headless vs WAF**: Akamai blocks the *old* headless mode (plain `headless=True`),
but the *new* headless mode (`--headless=new`) passes. Launch with `headless=False`
+ arg `--headless=new` + a clean Chrome UA (the headless UA contains `HeadlessChrome`,
which Akamai detects).
- **Session 0 has no GPU**: Running as a Windows Service (no user logged in) means
Chromium does software rendering -> CPU 100%, slow. Mitigation, not a cure: smaller
viewport (1366x768, ~50% fewer pixels than 1920x1080; must stay >~1100px or BT shows
a "redirect to store" splash) + overhead flags (`--disable-gpu` etc.). The real fix
for speed would be running outside Session 0, with a GPU.
- **No fixed `time.sleep()` for page state**: on the slow prod machine, hardcoded
waits time out. Always wait on a selector/condition (`wait_for_selector`), generously.
- **`networkidle` never fires**: BT pages poll trackers continuously. Use
`domcontentloaded` + explicit selector waits.
## Coding Guidelines