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.
What You’ll Need
Section titled “What You’ll Need”- A DigitalOcean account
- An SSH key pair (or use password auth)
- Ubuntu 24.04 LTS
- About 20 minutes of time
Quick Start
Section titled “Quick Start”1. Create a Droplet
Section titled “1. Create a Droplet”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.
2. Connect and Install
Section titled “2. Connect and Install”Open your terminal and SSH into your new server:
ssh root@YOUR_DROPLET_IPNow, run these commands to update the system and install OpenClaw:
# Update systemapt update && apt upgrade -y
# Install Node.js 22curl -fsSL https://deb.nodesource.com/setup_22.x | bash -apt install -y nodejs
# Install OpenClawcurl -fsSL https://openclaw.ai/install.sh | bash
# Verifyopenclaw --version3. Run Onboarding
Section titled “3. Run Onboarding”Start the setup wizard. This handles your API keys and channel connections:
openclaw onboard --install-daemonThe 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.
4. Access the Dashboard
Section titled “4. Access the Dashboard”By default, the gateway only listens locally. I use an SSH tunnel to access the UI safely:
# Run this from your local machinessh -L 18789:localhost:18789 root@YOUR_DROPLET_IPNow you can open http://localhost:18789 in your browser.
If you prefer Tailscale, you can set that up too:
# On the dropletcurl -fsSL https://tailscale.com/install.sh | shtailscale up
# Configure Gateway to use Tailscale Serveopenclaw config set gateway.tailscale.mode serveopenclaw gateway restart5. Connect Your Channels
Section titled “5. Connect Your Channels”Once the gateway is running, link your messaging apps. For WhatsApp, run:
openclaw channels login whatsappScan the QR code that appears. For Telegram, use:
openclaw pairing list telegramopenclaw pairing approve telegram <CODE>Optimizations for 1GB RAM
Section titled “Optimizations for 1GB RAM”The $6 droplet is affordable but has limited memory. I recommend adding a swap file to prevent crashes:
fallocate -l 2G /swapfilechmod 600 /swapfilemkswap /swapfileswapon /swapfileecho '/swapfile none swap sw 0 0' >> /etc/fstabTo 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.
Persistence
Section titled “Persistence”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:
tar -czvf openclaw-backup.tar.gz ~/.openclaw ~/.openclaw/workspaceTroubleshooting
Section titled “Troubleshooting”Gateway won’t start
Section titled “Gateway won’t start”If the gateway fails to launch, check the status or run the doctor tool:
openclaw gateway statusopenclaw doctor --non-interactivejournalctl -u openclaw --no-pager -n 50Port already in use
Section titled “Port already in use”If another process is blocking the port, find and stop it:
lsof -i :18789kill <PID>Out of memory
Section titled “Out of memory”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.
What’s Next
Section titled “What’s Next”- Hetzner guide — A cheaper alternative for more power.
- Docker install — Run OpenClaw in a container.
- Tailscale — Secure your remote access.
- Configuration — View the full config reference.
OpenClaw Expert
Still stuck?
If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.