mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-07-30 16:22:47 +00:00
* feat(browser): add remote Chrome sidecar support for Docker deployments
When running in Docker, Chrome is not installed in the runtime image.
This adds support for connecting to a remote Chrome via CDP (Chrome
DevTools Protocol) using a Docker Compose sidecar overlay, following
the existing pattern used by sandbox, OTel, and Tailscale overlays.
Changes:
- Add RemoteURL field to BrowserToolConfig
- Add GOCLAW_BROWSER_REMOTE_URL env var (auto-enables browser tool)
- Browser Manager: remote CDP connection with hostname-to-IP resolution
(required by Chrome M113+ DNS rebinding protection), auto-reconnect
on dead connections, disconnect-only on Stop (sidecar stays alive)
- Auto-start browser on first tool action (no explicit "start" needed)
- Add docker-compose.browser.yml overlay (zenika/alpine-chrome:124)
- Add unit tests for CDP resolution and Manager lifecycle
Usage:
docker compose -f docker-compose.yml -f docker-compose.managed.yml \
-f docker-compose.browser.yml up -d --build
Closes #56
* feat(browser): fix onboard summary and config serialization for remote mode
- onboard.go: show "remote: ws://..." instead of "headless" when RemoteURL is set
- onboard_auto.go: serialize remote_url field in generated config
---------
Co-authored-by: Luvu182 <208665161+Luvu182@users.noreply.github.com>
40 lines
1.1 KiB
YAML
40 lines
1.1 KiB
YAML
# Browser sidecar overlay — adds headless Chrome for the browser automation tool.
|
|
#
|
|
# Usage (with managed mode):
|
|
# docker compose -f docker-compose.yml -f docker-compose.managed.yml -f docker-compose.browser.yml up -d --build
|
|
#
|
|
# The Chrome sidecar exposes CDP (Chrome DevTools Protocol) on port 9222.
|
|
# GoClaw connects to it automatically via GOCLAW_BROWSER_REMOTE_URL.
|
|
|
|
services:
|
|
chrome:
|
|
image: zenika/alpine-chrome:124
|
|
command:
|
|
- --no-sandbox
|
|
- --remote-debugging-address=0.0.0.0
|
|
- --remote-debugging-port=9222
|
|
- --remote-allow-origins=*
|
|
- --disable-gpu
|
|
- --disable-dev-shm-usage
|
|
ports:
|
|
- "${CHROME_CDP_PORT:-9222}:9222"
|
|
shm_size: 2gb
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:9222/json/version >/dev/null 2>&1"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 2G
|
|
cpus: '2.0'
|
|
restart: unless-stopped
|
|
|
|
goclaw:
|
|
environment:
|
|
- GOCLAW_BROWSER_REMOTE_URL=ws://chrome:9222
|
|
depends_on:
|
|
chrome:
|
|
condition: service_healthy
|