What’s inside a gateway
A gateway deployment is a set of Docker containers that work together:Gateway container
Runs OpenClaw (agent runtime), Chrome/Chromium, XFCE desktop, noVNC (remote desktop), and the files API. This is where agents actually execute.
Dispatcher daemon
Subscribes to
agent_inbox_items via Supabase Realtime. When new work arrives (task assignments, comment mentions, routines), it wakes the right agent on this gateway.Runner daemon
Subscribes to
agent_commands via Supabase Realtime. Leases and executes lifecycle commands: provision, update, remove, provider auth, shell commands, gateway operations. Also runs heartbeat (every 30s) and secrets sync.Embedder
Runs a local embedding model (default:
BAAI/bge-small-en-v1.5). Leases knowledge items pending indexing, generates vector embeddings, and creates chunks. HTTP server at :9100.File processor
Leases knowledge items with
kind='file' and processing_status='ready', downloads from Supabase Storage, extracts text (PDF, DOCX, XLSX, CSV, PPTX, TXT), and triggers embedding.Shared state volume
Holds OpenClaw config, the local bare git repo with per-agent branches, browser profiles, desktop files, auth tokens, and secrets.
How gateways communicate
Gateways are pull-based — they don’t receive inbound connections from the UI. All coordination flows through Supabase:Gateway lifecycle
Boot sequence
When a gateway container starts,entrypoint.sh runs a 10-step boot sequence:
- Seed the local bare git repo from
/opt/templates/(or$TEMPLATES_SOURCE) - Optionally attach to
$GIT_REMOTE_URLfor branch backup - Optionally bring up Tailscale (
$TAILSCALE_AUTH_KEY) - Run
openclaw onboard(first boot only) - Patch
openclaw.jsonwith browser, channel, and plugin paths - Install the hq-bootstrap plugin
- Start Xtigervnc + XFCE desktop
- Start websockify → noVNC
- Upsert this gateway’s row in the
gatewaystable with reachable URLs - Exec
openclaw gateway startas the main process
Heartbeat
The runner daemon writeslast_heartbeat_at to the gateways table every 30 seconds. The UI uses this to show gateway health:
- Healthy (green) — heartbeat within 90 seconds
- Stale (amber) — status is
readybut heartbeat is old - No signal — gateway has never reported
Registration
Gateways register with Supabase via a one-time token exchange. The UI generates a token (Settings → Gateways → Add Gateway), the gateway installer callsconsume_gateway_token() to atomically convert the token into a gateways row, and the gateway stores its GATEWAY_ID in .env for all future operations.
One workspace, many gateways
A single HQ workspace can have multiple gateways on different hosts — different machines, different data centers, different continents. Each gateway registers itself in thegateways table with its reachable URLs, so the UI knows how to reach each one.
Agents are bound to a specific gateway via gateway_id. The dispatcher and runner filter their Supabase subscriptions by GATEWAY_ID — no gateway ever picks up another gateway’s work.
Common multi-gateway patterns:
| Pattern | Example |
|---|---|
| Geo-distributed | US gateway for US agents, EU gateway for EU agents |
| Capability-split | GPU gateway for heavy tasks, lightweight gateway for messaging agents |
| Dev / prod | Staging gateway for testing, production gateway for live agents |
| Team isolation | Marketing team gateway, engineering team gateway |
Gateway state and persistence
Each gateway owns a Docker volume (gateway-state) that holds:
- Git repo — a bare repo with one branch per agent. Agent files, skills, memory, and identity all live here.
- Browser profiles — Chrome profiles persist cookies, logins, and localStorage across agent sessions.
- Auth tokens — model provider credentials (OpenAI, Anthropic, etc.) stored by OpenClaw.
- Secrets — decrypted
.envfiles written by the secrets sync daemon (plaintext on disk,chmod 0600). - Desktop state — XFCE config, wallpapers, shortcuts.
gateway-state volume, agents can be reprovisioned from the database, but accumulated browser sessions, local files, and auth tokens are gone. Use GIT_REMOTE_URL to continuously back up agent branches to GitHub/Gitea. See Operations → Backing up.
Adding a gateway
The recommended path is UI-driven:- Settings → Gateways → Add Gateway.
- Copy the generated installer command.
- Run it on the new host.

