Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/content/docs/ruby-gem/reference/strategy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The client speaks OpenAPI 2.0 `ScrapeSuccess` / `ScrapeError` envelopes. Success
Supported `request.botasaurus` options (unknown keys are rejected):

- `execution_mode` (`auto`, `request`, `browser`; scrape-API default `auto` when omitted)
- `navigation_mode` (`auto`, `get`, `google_get`, `google_get_bypass`, `organic_get`; default `auto`)
- `navigation_mode` (`auto`, `get`, `google_get`, `google_get_bypass`; default `auto`)
- `max_retries` (`0..3`; omit to use the scrape-API default of `2`)
- `wait_for_selector` (string)
- `wait_timeout_seconds` (integer `1..30`; omit to use the scrape-API default of `15`; counts against post-boot **work** budget on the scraper, not browser boot)
Expand All @@ -84,10 +84,11 @@ Supported `request.botasaurus` options (unknown keys are rejected):
- `block_trackers` (boolean)
- `wait_for_complete_page_load` (boolean)
- `headless` (boolean, default `false`)
- `proxy` (string, `http://` only, credentials allowed; `https://` and `socks` proxies are rejected)
- `proxy` (string, `http://` only, credentials allowed; `https://` and `socks` proxies are rejected). The scrape API checks every destination against its network policy first, then hands the hostname to the proxy. A rotating residential gateway works; a proxy that intercepts TLS with its own certificate does not.
- `user_agent` (string)
- `window_size` (`{ width: 1920, height: 1080 }` — both positive integers, required together)
- `lang` (string, for example `en-US`)
- `timezone` (string, IANA id such as `Europe/Berlin`; browser tier only). The browser reports it to pages through `Intl`, `Date` and workers. With a proxy, set it to the exit country's zone. When omitted, the scrape API uses `SCRAPE_DEFAULT_TIMEZONE`, else UTC. Unknown ids fail with `422`.
- `headers` (hash, forwarded to the Botasaurus scrape API alongside config-level `headers`)
- `cookies` (hash)

Expand Down Expand Up @@ -148,7 +149,7 @@ Because no remote network connection is established, `local_file` skips remote n

## Network safeguards

Every strategy that makes network requests checks the requested URL against the guard before fetching. The default HTTPX transport also checks every redirect hop and filters the addresses a hostname resolves to. With `botasaurus`, redirects happen inside the Botasaurus service, so its own network policy applies to them. `local_file` makes no network requests.
Every strategy that makes network requests checks the requested URL against the guard before fetching. The default HTTPX transport also checks every redirect hop and filters the addresses a hostname resolves to. With `botasaurus`, the fetch happens inside the scrape API, which applies the same policy to every connection the browser or its HTTP client makes. That covers redirects, sub-resources, iframes, XHR/fetch and websockets. WebRTC is limited to proxied traffic, so a page cannot send UDP around the policy. A refused navigation or redirect fails the scrape with `403`. A refused sub-request is dropped, and the page still renders. `local_file` makes no network requests.

- **Private networks are denied.** Local hostnames, loopback, link-local, private (RFC 1918), unique-local and multicast addresses fail with `RequestService::PrivateNetworkDenied`.
- **Embedded IPv4 addresses are checked.** An IPv4-mapped IPv6 address (`::ffff:a.b.c.d`) is judged by the IPv4 address inside it. So are NAT64 (`64:ff9b::/96`) and 6to4 (`2002::/16`) addresses.
Expand Down
57 changes: 29 additions & 28 deletions src/content/docs/web-application/reference/env-variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,35 @@ description: "Configuration reference for html2rss-web environment variables."

## Supported ENV variables

| Name | Description |
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `HTML2RSS_SECRET_KEY` | required in production; development/test gets a temporary default |
| `HTML2RSS_ACCESS_TOKEN` | token for the main feed-creation flow; paste the same value into the web UI when prompted |
| `HEALTH_CHECK_TOKEN` | optional bearer token for authenticated `GET /api/v1/health`; not part of the first-run quickstart; use `/api/v1/health/ready` for standard readiness checks |
| `BUILD_TAG` | release metadata used in logs; published Docker images set this to the release version |
| `GIT_SHA` | deployed commit metadata used in logs; published Docker images set this to the released commit |
| `SENTRY_DSN` | optional; enables Sentry errors/logs when set |
| `BOTASAURUS_SCRAPER_URL` | optional; Botasaurus scrape API base URL (e.g. `http://botasaurus:4010`) for browser rendering and anti-bot bypass |
| `AUTO_SOURCE_ENABLED` | boolean. The app default is `true` in development/test and `false` otherwise. The shipped `docker-compose.yml` (default `true`) and `docker-compose.quickstart.yml` (`true`) both enable it. |
| `CONFIG_CATALOG_ENABLED` | optional boolean; default `true`. When `false`, `GET /api/v1/configs` returns `404` with `catalog_disabled`. |
| `BOTASAURUS_SENTRY_DSN` | optional; read by the production compose file and passed to the botasaurus service as its own `SENTRY_DSN`. Use a separate project from `SENTRY_DSN`. |
| `TLS_CERTIFICATE_PATH` / `TLS_KEY_PATH` | optional; certificate and private key paths for TLS termination inside the app. Without them, terminate TLS in a reverse proxy. |
| `ASYNC_FEED_REFRESH_ENABLED` | optional boolean; default `false` |
| `ASYNC_FEED_REFRESH_STALE_FACTOR` | optional integer `>= 1`; default `3` |
| `FEEDS_CACHE_MAX_SIZE` | optional integer `>= 1`; default `500`; maximum number of feeds to cache in memory before eviction |
| `RATE_LIMIT_ENABLED` | optional boolean; default `true` (except `false` in `test`); enables or disables client IP rate limiting |
| `RATE_LIMIT_MAX_REQUESTS` | optional integer `>= 1`; default `60`; maximum requests allowed per IP per window |
| `RATE_LIMIT_WINDOW_SECONDS` | optional integer `>= 1`; default `60`; rate limiter sliding window duration in seconds |
| `RETRY_AFTER_TIMEOUT_SECONDS` | optional integer `>= 1`; default `300`; Retry-After header backoff duration returned on timeouts |
| `PORT` | app listen port; compose uses `4000` |
| `RACK_ENV` | Rack environment; quickstart uses `development`, production examples use `production` |
| `REQUEST_TIMEOUT_SECONDS` | optional; total web-request timeout in seconds; default `55` |
| `WEB_CONCURRENCY` | optional integer `>= 1`; default `2` in production (`1` in development); number of web worker processes |
| `BOTASAURUS_SCRAPE_TIMEOUT_SECONDS` | optional; HTTP client cap for POST `/scrape` in seconds; default `45`; mirrors `SCRAPE_TIMEOUT_SECONDS` on botasaurus-scrape-api |
| `BOTASAURUS_SCRAPE_WORK_TIMEOUT_SECONDS` | optional; maximum `wait_timeout_seconds` in feed YAML; default `30`; mirrors `SCRAPE_WORK_TIMEOUT_SECONDS` on botasaurus-scrape-api |
| `SCRAPE_WORK_TIMEOUT_SECONDS` | optional on botasaurus-scrape-api; post-boot navigate, selector wait, and scroll budget in seconds; default `30`; set on the scraper service in compose |
| `HTML2RSS_TOTAL_TIMEOUT_SECONDS` | optional; internal gem feed-build timeout in seconds; default `50` |
| Name | Description |
| ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `HTML2RSS_SECRET_KEY` | required in production; development/test gets a temporary default |
| `HTML2RSS_ACCESS_TOKEN` | token for the main feed-creation flow; paste the same value into the web UI when prompted |
| `HEALTH_CHECK_TOKEN` | optional bearer token for authenticated `GET /api/v1/health`; not part of the first-run quickstart; use `/api/v1/health/ready` for standard readiness checks |
| `BUILD_TAG` | release metadata used in logs; published Docker images set this to the release version |
| `GIT_SHA` | deployed commit metadata used in logs; published Docker images set this to the released commit |
| `SENTRY_DSN` | optional; enables Sentry errors/logs when set |
| `BOTASAURUS_SCRAPER_URL` | optional; Botasaurus scrape API base URL (e.g. `http://botasaurus:4010`) for browser rendering and anti-bot bypass |
| `AUTO_SOURCE_ENABLED` | boolean. The app default is `true` in development/test and `false` otherwise. The shipped `docker-compose.yml` (default `true`) and `docker-compose.quickstart.yml` (`true`) both enable it. |
| `CONFIG_CATALOG_ENABLED` | optional boolean; default `true`. When `false`, `GET /api/v1/configs` returns `404` with `catalog_disabled`. |
| `BOTASAURUS_SENTRY_DSN` | optional; read by the production compose file and passed to the botasaurus service as its own `SENTRY_DSN`. Use a separate project from `SENTRY_DSN`. |
| `TLS_CERTIFICATE_PATH` / `TLS_KEY_PATH` | optional; certificate and private key paths for TLS termination inside the app. Without them, terminate TLS in a reverse proxy. |
| `ASYNC_FEED_REFRESH_ENABLED` | optional boolean; default `false` |
| `ASYNC_FEED_REFRESH_STALE_FACTOR` | optional integer `>= 1`; default `3` |
| `FEEDS_CACHE_MAX_SIZE` | optional integer `>= 1`; default `500`; maximum number of feeds to cache in memory before eviction |
| `RATE_LIMIT_ENABLED` | optional boolean; default `true` (except `false` in `test`); enables or disables client IP rate limiting |
| `RATE_LIMIT_MAX_REQUESTS` | optional integer `>= 1`; default `60`; maximum requests allowed per IP per window |
| `RATE_LIMIT_WINDOW_SECONDS` | optional integer `>= 1`; default `60`; rate limiter sliding window duration in seconds |
| `RETRY_AFTER_TIMEOUT_SECONDS` | optional integer `>= 1`; default `300`; Retry-After header backoff duration returned on timeouts |
| `PORT` | app listen port; compose uses `4000` |
| `RACK_ENV` | Rack environment; quickstart uses `development`, production examples use `production` |
| `REQUEST_TIMEOUT_SECONDS` | optional; total web-request timeout in seconds; default `55` |
| `WEB_CONCURRENCY` | optional integer `>= 1`; default `2` in production (`1` in development); number of web worker processes |
| `BOTASAURUS_SCRAPE_TIMEOUT_SECONDS` | optional; HTTP client cap for POST `/scrape` in seconds; default `45`; mirrors `SCRAPE_TIMEOUT_SECONDS` on botasaurus-scrape-api |
| `BOTASAURUS_SCRAPE_WORK_TIMEOUT_SECONDS` | optional; maximum `wait_timeout_seconds` in feed YAML; default `30`; mirrors `SCRAPE_WORK_TIMEOUT_SECONDS` on botasaurus-scrape-api |
| `SCRAPE_WORK_TIMEOUT_SECONDS` | optional on botasaurus-scrape-api; post-boot navigate, selector wait, and scroll budget in seconds; default `30`; set on the scraper service in compose |
| `SCRAPE_DEFAULT_TIMEZONE` | optional on botasaurus-scrape-api; IANA timezone (for example `Europe/Berlin`) the browser reports when a feed sets no `timezone`; unset means UTC; an invalid id stops the service at startup |
| `HTML2RSS_TOTAL_TIMEOUT_SECONDS` | optional; internal gem feed-build timeout in seconds; default `50` |

## Timeout Chain

Expand Down
21 changes: 20 additions & 1 deletion src/content/docs/web-application/reference/monitoring.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Monitoring"
description: "Health endpoints and Sentry-based monitoring for html2rss-web."
description: "Health endpoints, Sentry, and scraper log events for html2rss-web."
---

import { Code } from "@astrojs/starlight/components";
Expand Down Expand Up @@ -39,3 +39,22 @@ Use separate Sentry projects for html2rss-web and botasaurus-scrape-api. Never s
In `docker-compose.yml`, the botasaurus service maps `BOTASAURUS_SENTRY_DSN` into its own `SENTRY_DSN`, requires it at startup, and does not fall back to the web project's DSN.

For on-call triage, alert rules, and dashboard baselines, see the [Sentry runbook in the web repo](https://github.com/html2rss/html2rss-web/blob/main/docs/README.md#sentry-runbook).

## Scraper log events

Sentry only receives the scraper's own failures. Outcomes on target sites go to the logs. Set `LOG_FORMAT=json` on botasaurus-scrape-api and ship its stdout to your log store, such as OpenObserve. Each line is one JSON object with an `event_name`, and events tied to a scrape carry its `request_id` and `host`.

| Event | Level | When |
| ----------------- | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `scrape_finished` | INFO, WARNING or ERROR | Once per admitted scrape (ERROR for the scraper's own failures), with tier, status, `error_category`, and the challenge `vendor`/`signal` on blocks |
| `scrape_rejected` | WARNING or INFO | A request refused before scraping (SSRF, invalid proxy, unresolvable host) |
| `egress_blocked` | WARNING | The page tried to reach a blocked address; logged once per host per attempt |
| `egress_summary` | INFO or WARNING | Once per scrape when egress had refusals or failures; WARNING when the upstream proxy refused a tunnel or DNS timed out |

Useful alerts:

- `egress_summary` with `upstream_refused > 0`: proxy credentials or quota. `upstream_status` holds the proxy's answer, such as `407` or `402`.
- `egress_summary` with `dns_timeouts > 0`: resolver trouble on the scraper host.
- `egress_blocked` grouped by `host`: sites whose pages try to reach internal addresses.

The scrape API README lists every field.
Loading