-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: run BrowserOS inside OpenClaw container #655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat/podman-migration
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| browseros_server |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| FROM ghcr.io/openclaw/openclaw:latest | ||
|
|
||
| USER root | ||
|
|
||
| # Install BrowserOS browser (.deb) | ||
| ARG BROWSEROS_DEB_URL=http://cdn.browseros.com/releases/0.44.0.2/linux/BrowserOS_v0.44.0.2_arm64.deb | ||
| RUN apt-get update -qq && \ | ||
| curl -fsSL -o /tmp/BrowserOS.deb "$BROWSEROS_DEB_URL" && \ | ||
| apt-get install -y -qq --fix-broken /tmp/BrowserOS.deb && \ | ||
| rm /tmp/BrowserOS.deb && \ | ||
| npm install -g browseros-cli && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Copy BrowserOS server binary (runs separately from the browser) | ||
| COPY browseros_server /usr/local/bin/browseros_server | ||
| RUN chmod +x /usr/local/bin/browseros_server | ||
|
|
||
| # Install browseros-agent skill | ||
| RUN su node -c "openclaw skills install browseros-agent" || true | ||
|
|
||
| COPY entrypoint.sh /entrypoint.sh | ||
| RUN chmod +x /entrypoint.sh | ||
|
|
||
| USER node | ||
|
|
||
| ENTRYPOINT ["/entrypoint.sh"] | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,63 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||||||||||||||||||||||||||||||
| set -e | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| # Ports — mirrors BrowserOSAppManager pattern | ||||||||||||||||||||||||||||||||||||||||||||||
| CDP_PORT=9000 | ||||||||||||||||||||||||||||||||||||||||||||||
| SERVER_PORT=9100 | ||||||||||||||||||||||||||||||||||||||||||||||
| EXTENSION_PORT=9300 | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| # 1. Launch BrowserOS (browser only, server disabled — matches --manual mode) | ||||||||||||||||||||||||||||||||||||||||||||||
| browseros \ | ||||||||||||||||||||||||||||||||||||||||||||||
| --headless=new \ | ||||||||||||||||||||||||||||||||||||||||||||||
| --no-sandbox \ | ||||||||||||||||||||||||||||||||||||||||||||||
| --disable-gpu \ | ||||||||||||||||||||||||||||||||||||||||||||||
| --disable-software-rasterizer \ | ||||||||||||||||||||||||||||||||||||||||||||||
| --disable-dev-shm-usage \ | ||||||||||||||||||||||||||||||||||||||||||||||
| --no-zygote \ | ||||||||||||||||||||||||||||||||||||||||||||||
| --single-process \ | ||||||||||||||||||||||||||||||||||||||||||||||
| --no-first-run \ | ||||||||||||||||||||||||||||||||||||||||||||||
| --no-default-browser-check \ | ||||||||||||||||||||||||||||||||||||||||||||||
| --use-mock-keychain \ | ||||||||||||||||||||||||||||||||||||||||||||||
| --disable-browseros-server \ | ||||||||||||||||||||||||||||||||||||||||||||||
| --disable-browseros-extensions \ | ||||||||||||||||||||||||||||||||||||||||||||||
| --remote-debugging-port=$CDP_PORT \ | ||||||||||||||||||||||||||||||||||||||||||||||
| --browseros-mcp-port=$SERVER_PORT \ | ||||||||||||||||||||||||||||||||||||||||||||||
| --browseros-extension-port=$EXTENSION_PORT \ | ||||||||||||||||||||||||||||||||||||||||||||||
| --window-size=1440,900 \ | ||||||||||||||||||||||||||||||||||||||||||||||
| --user-data-dir=/tmp/browseros-data \ | ||||||||||||||||||||||||||||||||||||||||||||||
| about:blank \ | ||||||||||||||||||||||||||||||||||||||||||||||
| & | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| echo "[entrypoint] Waiting for BrowserOS CDP on port $CDP_PORT..." | ||||||||||||||||||||||||||||||||||||||||||||||
| for i in $(seq 1 30); do | ||||||||||||||||||||||||||||||||||||||||||||||
| if curl -sf http://localhost:$CDP_PORT/json/version > /dev/null 2>&1; then | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "[entrypoint] CDP ready" | ||||||||||||||||||||||||||||||||||||||||||||||
| break | ||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||
| sleep 1 | ||||||||||||||||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+31
to
+38
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The wait loop exits after 30 iterations without signaling failure. If BrowserOS never starts, Add
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: packages/browseros-agent/apps/server/src/api/services/openclaw-container/entrypoint.sh
Line: 31-38
Comment:
**Silent failure if CDP never becomes ready**
The wait loop exits after 30 iterations without signaling failure. If BrowserOS never starts, `browseros_server` still launches and the container reports healthy with broken browser automation.
Add `exit 1` after the loop:
```suggestion
echo "[entrypoint] Waiting for BrowserOS CDP on port $CDP_PORT..."
READY=0
for i in $(seq 1 30); do
if curl -sf http://localhost:$CDP_PORT/json/version > /dev/null 2>&1; then
echo "[entrypoint] CDP ready"
READY=1
break
fi
sleep 1
done
if [ "$READY" -eq 0 ]; then
echo "[entrypoint] ERROR: BrowserOS CDP did not become ready in time" >&2
exit 1
fi
```
How can I resolve this? If you propose a fix, please make it concise. |
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| # 2. Launch BrowserOS server (connects to browser via CDP) | ||||||||||||||||||||||||||||||||||||||||||||||
| BROWSEROS_CDP_PORT=$CDP_PORT \ | ||||||||||||||||||||||||||||||||||||||||||||||
| BROWSEROS_SERVER_PORT=$SERVER_PORT \ | ||||||||||||||||||||||||||||||||||||||||||||||
| BROWSEROS_EXTENSION_PORT=$EXTENSION_PORT \ | ||||||||||||||||||||||||||||||||||||||||||||||
| NODE_ENV=production \ | ||||||||||||||||||||||||||||||||||||||||||||||
| browseros_server \ | ||||||||||||||||||||||||||||||||||||||||||||||
| --cdp-port $CDP_PORT \ | ||||||||||||||||||||||||||||||||||||||||||||||
| --server-port $SERVER_PORT \ | ||||||||||||||||||||||||||||||||||||||||||||||
| & | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| echo "[entrypoint] Waiting for BrowserOS server on port $SERVER_PORT..." | ||||||||||||||||||||||||||||||||||||||||||||||
| for i in $(seq 1 30); do | ||||||||||||||||||||||||||||||||||||||||||||||
| if curl -sf http://localhost:$SERVER_PORT/health > /dev/null 2>&1; then | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "[entrypoint] Server ready" | ||||||||||||||||||||||||||||||||||||||||||||||
| break | ||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||
| sleep 1 | ||||||||||||||||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+50
to
+57
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Same issue as the CDP loop: if
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: packages/browseros-agent/apps/server/src/api/services/openclaw-container/entrypoint.sh
Line: 50-57
Comment:
**Server wait loop also swallows failure silently**
Same issue as the CDP loop: if `browseros_server` never becomes healthy, the script silently continues and starts the OpenClaw gateway, producing a healthy-looking container with broken automation.
```suggestion
echo "[entrypoint] Waiting for BrowserOS server on port $SERVER_PORT..."
READY=0
for i in $(seq 1 30); do
if curl -sf http://localhost:$SERVER_PORT/health > /dev/null 2>&1; then
echo "[entrypoint] Server ready"
READY=1
break
fi
sleep 1
done
if [ "$READY" -eq 0 ]; then
echo "[entrypoint] ERROR: BrowserOS server did not become ready in time" >&2
exit 1
fi
```
How can I resolve this? If you propose a fix, please make it concise. |
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| # 3. Configure browseros-cli | ||||||||||||||||||||||||||||||||||||||||||||||
| browseros-cli init $SERVER_PORT 2>/dev/null || true | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| # 4. Start OpenClaw gateway | ||||||||||||||||||||||||||||||||||||||||||||||
| exec node dist/index.js gateway --bind lan --port 18789 | ||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.deb— local builds on AMD64 will install the wrong binaryThe PR adds an auto-local-build fallback when the registry image is missing, so this Dockerfile will run on user machines of any architecture. The default
BROWSEROS_DEB_URLpoints to thearm64package, causingdpkgto fail or install an unusable binary on AMD64 hosts. Detect arch at build time instead:Prompt To Fix With AI