Skip to content

Running a Persistent OpenClaw Gateway on DigitalOcean

I’ve spent too much time dealing with local dev environments that disappear when I close my laptop. It’s frustrating to have a gateway or a bot that only works when my machine is awake and connected to Wi-Fi.

I want my tools to stay online and respond to messages even while I’m sleeping. This guide shows you how to get a persistent OpenClaw Gateway running on DigitalOcean for about $6 a month.

  • A DigitalOcean account
  • An SSH key pair (or use password auth)
  • Ubuntu 24.04 LTS
  • About 20 minutes of time

First, log into your DigitalOcean dashboard and click Create → Droplets. Use these settings:

  • Region: Pick the one closest to you or your users.
  • Image: Ubuntu 24.04 LTS.
  • Size: Choose Basic, then Regular, and select the $6/mo plan (1 vCPU, 1GB RAM, 25GB SSD).
  • Authentication: I recommend using an SSH key.

Once the droplet is ready, copy its IP address.

Open your terminal and SSH into your new server:

Terminal window
ssh root@YOUR_DROPLET_IP

Now, run these commands to update the system and install OpenClaw:

Terminal window
# Update system
apt update && apt upgrade -y
# Install Node.js 22
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt install -y nodejs
# Install OpenClaw
curl -fsSL https://openclaw.ai/install.sh | bash
# Verify
openclaw --version

Start the setup wizard. This handles your API keys and channel connections:

Terminal window
openclaw onboard --install-daemon

The wizard helps you with model authentication, channel setup (like Telegram or Discord), and generating your gateway token. It also installs the systemd daemon so OpenClaw starts automatically when the server reboots.

By default, the gateway only listens locally. I use an SSH tunnel to access the UI safely:

Terminal window
# Run this from your local machine
ssh -L 18789:localhost:18789 root@YOUR_DROPLET_IP

Now you can open http://localhost:18789 in your browser.

If you prefer Tailscale, you can set that up too:

Terminal window
# On the droplet
curl -fsSL https://tailscale.com/install.sh | sh
tailscale up
# Configure Gateway to use Tailscale Serve
openclaw config set gateway.tailscale.mode serve
openclaw gateway restart

Once the gateway is running, link your messaging apps. For WhatsApp, run:

Terminal window
openclaw channels login whatsapp

Scan the QR code that appears. For Telegram, use:

Terminal window
openclaw pairing list telegram
openclaw pairing approve telegram <CODE>

The $6 droplet is affordable but has limited memory. I recommend adding a swap file to prevent crashes:

Terminal window
fallocate -l 2G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap sw 0 0' >> /etc/fstab

To keep memory usage low, use API-based models like Claude or GPT instead of running local models. You can also monitor your usage with free -h or htop.

OpenClaw stores everything in your home directory. These files stay safe even if you reboot the server:

  • ~/.openclaw/ (config and credentials)
  • ~/.openclaw/workspace/ (SOUL.md and memory)

I suggest backing them up occasionally:

Terminal window
tar -czvf openclaw-backup.tar.gz ~/.openclaw ~/.openclaw/workspace

If the gateway fails to launch, check the status or run the doctor tool:

Terminal window
openclaw gateway status
openclaw doctor --non-interactive
journalctl -u openclaw --no-pager -n 50

If another process is blocking the port, find and stop it:

Terminal window
lsof -i :18789
kill <PID>

If you see “Out of memory” errors, check your RAM with free -h. You might need to add more swap space or upgrade to the $12/mo droplet.

Need more help? Talk to the AI Setup Assistant.

OpenClaw

OpenClaw Expert

Still stuck?

If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.