OC
OpenClaw
Dashboard

openclaw-dashboard-auto-deploy.md

/home/ubuntu/.openclaw/workspace/docs/openclaw-dashboard-auto-deploy.md

OpenClaw Dashboard: Auto-deploy (poll origin/main) via systemd timer

⚠️ Status: This mechanism is deprecated and currently disabled on the EC2 host.

The dashboard now uses GitHub Actions → SSH deploy → systemd restart (see openclaw-dashboard-deploy.md). This doc is kept for historical reference in case we ever switch back.

This documents the simple “Option A” deployment mechanism for openclaw-dashboard on the EC2 host.

Goal

Automatically update the running dashboard when main changes in GitHub, without GitHub Actions / SSH deploy keys.

Approach: a systemd timer runs every ~5 minutes and executes a script that:

  1. git fetch origin main
  2. compares local HEAD vs origin/main
  3. if unchanged → exit (cheap)
  4. if changed → git pull --ff-only
  5. if package.json or package-lock.json changed → npm ci
  6. systemctl restart openclaw-dashboard.service

This keeps the dashboard updated with a bounded delay (≤ timer interval).


Components

Update script

  • Path: /usr/local/bin/openclaw-dashboard-update.sh
  • Repo: /home/ubuntu/projects/openclaw-dashboard
  • Branch: main
  • Service restarted: openclaw-dashboard.service

Key behaviors:

  • Uses fast-forward only pulls (git pull --ff-only) to avoid accidental merge commits.
  • Runs npm ci only when dependency files changed.
  • Restarts the dashboard service to apply updates.

systemd oneshot service

  • Path: /etc/systemd/system/openclaw-dashboard-update.service
  • Type: oneshot
  • Runs as user: ubuntu

systemd timer

  • Path: /etc/systemd/system/openclaw-dashboard-update.timer
  • Interval: OnUnitActiveSec=5min
  • Jitter: RandomizedDelaySec=20s
  • Persistent: true (catches up after downtime)

Useful commands

See when it will run next

sudo systemctl status openclaw-dashboard-update.timer
sudo systemctl list-timers | grep openclaw-dashboard-update

Run an update immediately

sudo systemctl start openclaw-dashboard-update.service

View logs

sudo journalctl -u openclaw-dashboard-update.service --no-pager -n 200

Disable / re-enable

sudo systemctl disable --now openclaw-dashboard-update.timer
sudo systemctl enable --now openclaw-dashboard-update.timer

Notes / gotchas

  • The update service restarts openclaw-dashboard.service. That service currently runs npm run build on each restart via ExecStartPre, so updates trigger a rebuild automatically.
  • If you rename the repo remote or branch, update /usr/local/bin/openclaw-dashboard-update.sh accordingly.
  • This mechanism deploys changes on main only. For branch-based deploys, switch to a different branch or use a separate service/timer.