-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
72 lines (70 loc) · 2.69 KB
/
docker-compose.yml
File metadata and controls
72 lines (70 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
services:
crw:
build: .
ports:
- "3000:3000"
depends_on:
lightpanda:
condition: service_started
# `chrome` is opt-in via `--profile heavy`. Compose treats a missing
# service as "not started", so listing it here is harmless when the
# profile is off — but keeping it makes `--profile heavy up` order
# crw after chrome instead of racing.
chrome:
condition: service_started
required: false
environment:
- RUST_LOG=info
- CRW_CONFIG=config.docker
volumes:
- ./config.docker.toml:/app/config.docker.toml:ro
# Primary JS renderer — lightweight (~64 MB), fast startup.
# Handles most static-JS sites. Falls back to Chrome for complex SPAs.
#
# `restart: unless-stopped` is load-bearing: LightPanda is known to OOM
# or segfault on adversarial pages (heavy SPA bundles, Cloudflare turnstile),
# and without auto-restart the breaker stays open forever and every JS
# request falls through to Chrome — defeating the lightweight tier.
# `mem_limit` keeps a runaway tab from dragging Chrome and the host into
# swap on small VPS instances.
lightpanda:
image: lightpanda/browser:latest
restart: unless-stopped
mem_limit: 1g
memswap_limit: 1g
healthcheck:
test: ["CMD-SHELL", "exec 3<>/dev/tcp/127.0.0.1/9222 || exit 1"]
interval: 30s
timeout: 5s
retries: 3
start_period: 5s
# Fallback JS renderer — full Chromium, handles complex SPAs and
# Cloudflare challenges that LightPanda cannot.
# --remote-allow-origins=* lets Chrome accept CDP connections where the
# Host header is the Docker service name ("chrome") instead of localhost.
#
# Opt-in: `docker compose --profile heavy up -d`. Self-host users on
# small VPS instances skip the ~500MB Chromium image by default; the
# crw service falls back to LightPanda + HTTP-only when chrome is absent.
chrome:
image: chromedp/headless-shell:latest
profiles: ["heavy"]
shm_size: "2g"
# --ignore-certificate-errors: render sites with expired/invalid certs
# (e.g., actu-transport-logistique.fr) instead of failing nav.
# --disable-http2: dodge `ERR_HTTP2_PROTOCOL_ERROR` on hosts that hard-fail
# on Chrome's JA4 fingerprint mismatch (e.g., desotoms.mugshots.zone);
# forces HTTP/1.1 fallback which most anti-bot stacks still allow.
command:
- "--remote-allow-origins=*"
- "--ignore-certificate-errors"
- "--disable-http2"
restart: unless-stopped
mem_limit: 2g
memswap_limit: 2g
healthcheck:
test: ["CMD-SHELL", "exec 3<>/dev/tcp/127.0.0.1/9222 || exit 1"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s