OpenClawSkills
GitHub
Gateway / Operations β€’ TutorialHeader.readTime

Multiple Gateways

Run multiple OpenClaw Gateways on one host (isolation, ports, and profiles)

Most setups should use one Gateway because a single Gateway can handle multiple messaging connections and agents. If you need stronger isolation or redundancy (e.g., a rescue bot), run separate Gateways with isolated profiles/ports.

Tutorial.step

Isolation checklist (required)

- ''OPENCLAW_CONFIG_PATH'' β€” per-instance config file

- ''OPENCLAW_STATE_DIR'' β€” per-instance sessions, creds, caches

- ''agents.defaults.workspace'' β€” per-instance workspace root

- ''gateway.port'' (or ''--port'') β€” unique per instance

- Derived ports (browser/canvas) must not overlap

If these are shared, you will hit config races and port conflicts.

Tutorial.step

Recommended: profiles (`--profile`)

Profiles auto-scope ''OPENCLAW_STATE_DIR'' + ''OPENCLAW_CONFIG_PATH'' and suffix service names.

Bash
openclaw --profile main setup
openclaw --profile main gateway --port 18789


openclaw --profile rescue setup
openclaw --profile rescue gateway --port 19001

Per-profile services:

Bash
openclaw --profile main gateway install
openclaw --profile rescue gateway install
Tutorial.step

Rescue-bot guide

Run a second Gateway on the same host with its own:

- profile/config

- state dir

- workspace

- base port (plus derived ports)

This keeps the rescue bot isolated from the main bot so it can debug or apply config changes if the primary bot is down.

Port spacing: leave at least 20 ports between base ports so the derived browser/canvas/CDP ports never collide.

#

Tutorial.step

How to install (rescue bot)

Bash
openclaw onboard
openclaw gateway install


openclaw --profile rescue onboard





openclaw --profile rescue gateway install
Tutorial.step

Port mapping (derived)

Base port = ''gateway.port'' (or ''OPENCLAW_GATEWAY_PORT'' / ''--port'').

- browser control service port = base + 2 (loopback only)

- ''canvasHost.port = base + 4''

- Browser profile CDP ports auto-allocate from ''browser.controlPort + 9 .. + 108''

If you override any of these in config or env, you must keep them unique per instance.

Tutorial.step

Browser/CDP notes (common footgun)

- Do ''not'' pin ''browser.cdpUrl'' to the same values on multiple instances.

- Each instance needs its own browser control port and CDP range (derived from its gateway port).

- If you need explicit CDP ports, set ''browser.profiles.''.cdpPort'' per instance.

- Remote Chrome: use ''browser.profiles.''.cdpUrl'' (per profile, per instance).

Tutorial.step

Manual env example

Bash
OPENCLAW_CONFIG_PATH=~/.openclaw/main.json \
OPENCLAW_STATE_DIR=~/.openclaw-main \
openclaw gateway --port 18789

OPENCLAW_CONFIG_PATH=~/.openclaw/rescue.json \
OPENCLAW_STATE_DIR=~/.openclaw-rescue \
openclaw gateway --port 19001
Tutorial.step

Quick checks

Bash
openclaw --profile main status
openclaw --profile rescue status
openclaw --profile rescue browser status