Guide
OpenClaw on DigitalOcean — Self-Host Your AI Agent on a Droplet
A complete walkthrough for deploying OpenClaw on a DigitalOcean Droplet: create a Droplet, install Docker, configure your AI agent, and optionally add a custom domain with auto-HTTPS.
Why DigitalOcean for OpenClaw?
DigitalOcean is one of the most developer-friendly cloud platforms available, with simple per-hour pricing, a clean UI, and excellent documentation. Droplets (their virtual machines) start at just $6/mo and offer full root access, dedicated resources, and native Docker support — everything OpenClaw needs to run reliably.
- Simple pricing: Droplets start at $6/mo. The recommended plan for OpenClaw (2 vCPU, 4 GB RAM) runs at $18/mo — no hidden fees or complex billing.
- Docker Marketplace image: DigitalOcean offers a one-click Docker Droplet that comes with Docker pre-installed, saving you setup time.
- Worldwide data centers: Regions across the US, EU, Asia, and Australia — pick the location closest to your users for lower latency.
- Strong developer ecosystem: Detailed documentation, an active community forum, and a straightforward API make DigitalOcean easy to manage long-term.
Requirements
Before you start, make sure you have:
- A DigitalOcean account (sign up at digitalocean.com — new accounts get a $200 free credit).
- A Droplet with at least 2 vCPU and 4 GB RAM running Ubuntu 24.04. The $18/mo Basic Droplet (2 vCPU, 4 GB RAM, 80 GB SSD) is the recommended minimum.
- SSH access to your Droplet (SSH key added during creation).
- An OpenRouter API key (or any other supported model provider key) for your AI agent.
- A Telegram bot token and/or Discord bot token to connect channels.
- A domain name (optional — only needed for HTTPS access to the OpenClaw gateway).
Step 1: Create a DigitalOcean Droplet
Log in to your DigitalOcean account and click Create → Droplets. Configure your Droplet as follows:
- Choose an image: For the easiest setup, go to the Marketplace tab and search for Docker. Select the official Docker image — it comes with Docker CE pre-installed on Ubuntu. Alternatively, choose Ubuntu 24.04 (LTS) from the OS tab and install Docker manually in Step 2.
- Choose a plan: Select the Basic plan. Under “Regular” CPU, pick the $18/mo option (2 vCPU, 4 GB RAM, 80 GB SSD). The $12/mo plan (1 vCPU, 2 GB RAM) is too small and will cause out-of-memory crashes under load.
- Choose a region: Select the data center closest to your users (e.g., New York, Amsterdam, Singapore).
- Add your SSH key: Under Authentication, select SSH Key and upload your public key. This is required for secure access — password auth is not recommended.
- Click Create Droplet and wait 30–60 seconds for provisioning. Note the Droplet's public IP address from the dashboard.
Step 2: Install Docker (if needed)
If you selected the Docker Marketplace image in Step 1, Docker is already installed — skip ahead to Step 3. If you chose plain Ubuntu 24.04, SSH into your Droplet and install Docker:
ssh root@your-droplet-ipThen run the official Docker install script:
# Update packages
apt update && apt upgrade -y
# Install Docker using the official script
curl -fsSL https://get.docker.com | sh
# Verify Docker installed correctly
docker --version
# Enable Docker to start on boot
systemctl enable docker
systemctl start dockerAfter running this, docker --version should print something like Docker version 27.x.x. Docker is now ready to run OpenClaw.
Step 3: Deploy OpenClaw
Create the config directory and start the OpenClaw container:
# Create the config directory (with credentials subdirectory for DM pairing)
mkdir -p ~/openclaw/credentials
chmod 777 ~/openclaw
chmod 777 ~/openclaw/credentials
# Pull the OpenClaw image
docker pull ghcr.io/openclaw/openclaw:main
# Run the container
docker run -d \
--name openclaw \
--restart unless-stopped \
--memory=3g --memory-swap=4g \
-v ~/openclaw:/home/node/.openclaw \
-p 18789:18789 \
ghcr.io/openclaw/openclaw:main \
node openclaw.mjs gateway --allow-unconfiguredKey flags explained:
--memory=3g --memory-swap=4g— Allocates 3 GB RAM on the 4 GB Droplet. OpenClaw needs at least 2 GB; 3 GB provides comfortable headroom while leaving 1 GB for the OS.-v ~/openclaw:/home/node/.openclaw— Mounts your config directory into the container. OpenClaw reads and writes config files to this path.-p 18789:18789— Exposes the OpenClaw web gateway on port 18789.--restart unless-stopped— Auto-restarts the container after crashes or Droplet reboots.ghcr.io/openclaw/openclaw:main— Always use the:maintag, not:latest(which doesn't exist).
Verify the container started correctly:
docker logs openclaw --tail 20You should see startup messages from OpenClaw. If the container immediately exits, there's likely a configuration error — check the Troubleshooting section below.
chmod 777 on the config directory is required because the container runs as user node (uid 1000), which differs from your host root user. Without it, OpenClaw can't write its config files and will crash on startup.Step 4: Configure Your AI Agent
Create ~/openclaw/openclaw.json with your settings. Here's a complete example with Telegram and Discord:
{
"gateway": {
"port": 18789,
"auth": { "token": "your-random-secret-token" },
"controlUi": { "allowInsecureAuth": true }
},
"models": {
"providers": {
"openrouter": {
"apiKey": "sk-or-your-openrouter-api-key"
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "openrouter/anthropic/claude-sonnet-4.6"
},
"systemPrompt": "You are a helpful AI assistant."
}
},
"channels": {
"telegram": {
"enabled": true,
"botToken": "123456:ABC-your-telegram-bot-token",
"dmPolicy": "pairing"
},
"discord": {
"enabled": true,
"botToken": "your-discord-bot-token",
"dmPolicy": "open",
"allowFrom": ["*"]
}
},
"plugins": {
"entries": {
"telegram": { "enabled": true },
"discord": { "enabled": true }
}
}
}Important configuration notes:
gateway.authmust be an object with atokenproperty — not a plain string.- Both
channels.X.enabled: trueANDplugins.entries.X.enabled: trueare required for a channel to work. - Model IDs must be prefixed with the provider:
openrouter/anthropic/claude-sonnet-4.6, not justanthropic/claude-sonnet-4.6. - Telegram
dmPolicyshould always be"pairing"— never"open", as that allows anyone on the internet to use your bot. - Discord
dmPolicy: "open"requiresallowFrom: ["*"]to pass config validation.
After saving the config, restart the container to apply it:
docker restart openclawStep 5: Set Up Domain with Caddy (Optional)
If you want HTTPS access to the OpenClaw gateway via a custom domain (e.g. bot.yourdomain.com), set up Caddy as a reverse proxy. Caddy automatically provisions and renews SSL certificates via Let's Encrypt.
First, add an A record in your DNS settings pointing your domain to the Droplet's IP address. Then install Caddy on the Droplet:
# Install Caddy
apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' \
| gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' \
| tee /etc/apt/sources.list.d/caddy-stable.list
apt update && apt install caddyCreate /etc/caddy/Caddyfile:
bot.yourdomain.com {
reverse_proxy localhost:18789
}Restart Caddy to apply:
systemctl restart caddyCaddy will obtain an SSL certificate automatically. Your OpenClaw gateway will be accessible at https://bot.yourdomain.com. DNS propagation can take a few minutes — if certificate issuance fails, wait 5 minutes and try again.
DigitalOcean vs Managed Hosting
Running OpenClaw on a DigitalOcean Droplet gives you full control over your environment, but it also comes with ongoing responsibilities. Here's how it compares to a fully managed solution:
| DigitalOcean Droplet (Self-Hosted) | OpenClaw Launch | |
|---|---|---|
| Setup time | 1–3 hours | 10 seconds |
| Monthly cost | ~$18/mo (4 GB Droplet) + your time | From $6/mo |
| Docker updates | Manual docker pull + restart | Automatic |
| Security patches | Manual apt upgrade + monitoring | Fully managed |
| Uptime monitoring | Set up yourself | Built-in |
| Visual config editor | No — edit JSON manually | Yes — point-and-click |
| Auto-restart on crash | Docker restart policy (manual setup) | Automatic |
Self-hosting on DigitalOcean is a great choice if you want full control, need to run multiple containers on one server, or want to integrate OpenClaw into a larger infrastructure. If you'd rather skip the ops work and just focus on your AI agent, OpenClaw Launch handles everything.
Deploy Without the Setup
If managing a Droplet, keeping Docker updated, and monitoring server uptime isn't how you want to spend your time, there's a simpler path.
OpenClaw Launch deploys a fully managed OpenClaw instance in 10 seconds — no Droplet, no Docker, no SSH. Visual configuration editor, automatic updates, built-in uptime monitoring, and plans starting at $6/mo. The same price as the cheapest DigitalOcean Droplet, with none of the maintenance.