Currently, oc-bootstrap.sh installs Docker, clones OpenClaw source, builds a Docker image from the Dockerfile, and runs the gateway with docker compose up. This makes secrets and configuration awkward because env vars must be threaded through Docker rather than being available directly on the VPS.
The goal is to run OpenClaw directly on the VPS using the official installer + a systemd service. This means:
- Secrets in
~/.openclaw/.envare sourced directly by systemd — no volume mounts or Docker env plumbing needed. oc-load-secrets.shwrites to the same.envfile that OpenClaw reads at startup.- Updates are
npm update -g openclawrather than rebuilding an image.
From official docs and community guides:
- OpenClaw requires Node.js >= 22
- Official installer:
curl -fsSL https://openclaw.ai/install.sh | bash - Key env vars (bare metal):
OPENCLAW_HOME— base directory for stateOPENCLAW_STATE_DIR— mutable state (overrides OPENCLAW_HOME for state)OPENCLAW_CONFIG_PATH— path toopenclaw.jsonOPENCLAW_GATEWAY_TOKEN— gateway auth token (unchanged)OPENCLAW_GATEWAY_PORT— port (unchanged, 18789)OPENCLAW_GATEWAY_BIND— change fromlantoloopback(bare metal, no Docker network)GOG_KEYRING_PASSWORD— keyring password (unchanged)
- Gateway runs as a systemd service:
systemctl start openclaw - Logs via:
journalctl -u openclaw -f - Pairing command changes from
docker compose run --rm openclaw-cli pairing approveto justopenclaw pairing approve
Phase 1 (currently "Installing Docker") → "Installing Node.js 22"
- Remove:
curl https://get.docker.com | sh, Docker Compose verification - Add: Install Node.js 22 via NodeSource (
curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && apt-get install -y nodejs) - Add: Verify
node -vandnpm -v
Phase 2 (currently "Building OpenClaw from Docker source") → "Installing OpenClaw via official installer"
- Remove: Downloading source tarball,
docker build,chown -R 1000:1000 - Remove:
usermod -aG docker deploy - Add: Run official installer as
deployuser:sudo -u deploy bash -c 'curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard' - The
--no-onboardflag skips interactive onboarding (we configure viaopenclaw.json) - This installs the
openclawbinary into the deploy user's path
Phase 3 (persistent directories & .env) — Update env vars
- Remove Docker-specific vars:
OPENCLAW_IMAGE,XDG_CONFIG_HOME=/home/node/.openclaw - Change:
OPENCLAW_GATEWAY_BIND=lan→OPENCLAW_GATEWAY_BIND=loopback - Change:
OPENCLAW_CONFIG_DIR→OPENCLAW_HOME(points to~/.openclaw) - Remove:
OPENCLAW_WORKSPACE_DIR(handled byOPENCLAW_HOME) - Keep:
OPENCLAW_GATEWAY_TOKEN,OPENCLAW_GATEWAY_PORT,GOG_KEYRING_PASSWORD - Add:
OPENCLAW_CONFIG_PATH=/home/deploy/.openclaw/openclaw.json - New env file location:
/home/deploy/.openclaw/.env(instead of~/openclaw/.env) chown deploy:deployinstead ofchown 1000:1000(no Docker UID mapping needed)
Phase 4 (currently "Building & launching gateway via docker compose") → "Creating systemd service"
- Remove:
docker build,docker compose up -d,docker compose pschecks - Add: Create
/etc/systemd/system/openclaw.service:[Unit] Description=OpenClaw Gateway After=network.target Wants=network.target [Service] Type=simple User=deploy EnvironmentFile=/home/deploy/.openclaw/.env ExecStart=/home/deploy/.local/bin/openclaw gateway start Restart=on-failure RestartSec=10 NoNewPrivileges=true PrivateTmp=true [Install] WantedBy=multi-user.target - Add:
systemctl daemon-reload && systemctl enable --now openclaw - Add: Health check via
systemctl is-active openclawandcurl -sf http://127.0.0.1:18789/
Summary section update
- Change "Docker + OpenClaw gateway running" → "OpenClaw gateway running via systemd"
- Update next steps (no docker compose commands)
- Gateway restart:
docker compose restart openclaw-gateway→sudo systemctl restart openclaw - Gateway status check:
docker compose ps | grep -q "Up"→systemctl is-active --quiet openclaw - Failure message: Update to reference
journalctl -u openclawinstead ofdocker compose logs - Pairing instructions: Change from
docker compose run --rm openclaw-cli pairing approve telegram <CODE>→openclaw pairing approve telegram <CODE> - Env file path: Update reference from
~/openclaw/.envto~/.openclaw/.env - Config dir reference: Update
OPENCLAW_DIRusage (no longer needed for docker compose commands)
- Security hardening phases (SSH, UFW, fail2ban, unattended-upgrades) — no change
- Tailscale installation and configuration — no change
- Automated backup system — no change (still backs up
~/.openclaw) oc-load-secrets.sh— no change (it writes to.env, still works)oc-provision.sh— no changeopenclaw.json/openclaw.json.example— no change (config format is the same)
monitor.sh— removed entirely; OpenClaw has built-in heartbeats and health monitoring
- Update
oc-bootstrap.sh(major changes) - Update
oc-configure.sh(minor changes) - Update documentation strings in
README.mdandAGENTS.mdif needed