M5: hardening — retries, per-domain rate limiting, resource limits, docs

- renderer: per-domain politeness limiter (Redis fixed window, in-memory
  fallback; over-limit requests wait bounded, 429 past deadline); render retry
  with DNS-failure fast-fail
- orchestrator: one retry on connection-level stage failures (not timeouts)
- compose: per-container CPU/memory limits; all hardening knobs env-driven
  and documented in .env.example
- README: quick start, MCP + REST usage, architecture, config, dev workflow

Verified: rate limit window enforced (3rd request waited for reset), full
scrape + MCP web_search smoke green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
User 2026-07-05 22:11:28 -07:00
parent a70a6b5f5f
commit 64ffeabd49
7 changed files with 212 additions and 10 deletions

View file

@ -1,5 +1,10 @@
services:
orchestrator:
deploy:
resources:
limits:
cpus: "1"
memory: 512M
build: services/orchestrator
ports:
- "${ORCHESTRATOR_PORT:-8000}:8000"
@ -9,6 +14,7 @@ services:
SEARCHER_URL: http://searcher:8001
REDIS_URL: redis://redis:6379
EXTRACT_CACHE_TTL: ${EXTRACT_CACHE_TTL:-3600}
STAGE_TIMEOUT_S: ${STAGE_TIMEOUT_S:-60}
depends_on:
- searcher
- renderer
@ -21,10 +27,16 @@ services:
retries: 3
searcher:
deploy:
resources:
limits:
cpus: "0.5"
memory: 256M
build: services/searcher
environment:
REDIS_URL: redis://redis:6379
SEARCH_CACHE_TTL: ${SEARCH_CACHE_TTL:-300}
SEARCH_TIMEOUT_S: ${SEARCH_TIMEOUT_S:-15}
INSTANCES_FILE: /config/instances.yml
volumes:
- ./config:/config:ro
@ -38,6 +50,11 @@ services:
retries: 3
searxng:
deploy:
resources:
limits:
cpus: "1"
memory: 512M
image: searxng/searxng:latest
environment:
SEARXNG_SECRET: ${SEARXNG_SECRET:-change-me-lwss-internal}
@ -46,6 +63,11 @@ services:
- ./searxng:/etc/searxng:ro
renderer:
deploy:
resources:
limits:
cpus: "2"
memory: 2G
build: services/renderer
environment:
REDIS_URL: redis://redis:6379
@ -53,6 +75,9 @@ services:
RENDER_CONCURRENCY: ${RENDER_CONCURRENCY:-4}
RENDER_TIMEOUT_MS: ${RENDER_TIMEOUT_MS:-30000}
RENDER_WAIT_POLICY: ${RENDER_WAIT_POLICY:-networkidle}
RENDER_RETRIES: ${RENDER_RETRIES:-1}
DOMAIN_RATE_LIMIT: ${DOMAIN_RATE_LIMIT:-10}
DOMAIN_RATE_WINDOW_S: ${DOMAIN_RATE_WINDOW_S:-10}
depends_on:
- redis
init: true
@ -63,6 +88,11 @@ services:
retries: 3
extractor:
deploy:
resources:
limits:
cpus: "1"
memory: 512M
build: services/extractor
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8003/health')"]
@ -71,6 +101,11 @@ services:
retries: 3
redis:
deploy:
resources:
limits:
cpus: "0.5"
memory: 640M
image: redis:7-alpine
command: redis-server --maxmemory 512mb --maxmemory-policy allkeys-lru
healthcheck: