Skip to content

Self-hosting with Docker Compose

cloudscode is designed to be self-hosted. The reference deployment is a single docker-compose.yml that you can drop on any Linux host with Docker installed.

The compose file launches:

ServiceImagePortsPurpose
apicloudscode/api:latest8787 (HTTP)Hono control plane.
dashcloudscode/dash:latest5173 (HTTP)Web dashboard.
runtime-hostcloudscode/runtime-host:latest(Docker socket)Spawns per-instance runtime containers.
postgrespostgres:175432Primary database.
redisredis:76379Queues, rate-limits, presence.
caddycaddy:280, 443TLS termination + reverse proxy.
  • Linux host (Ubuntu 24.04, Debian 12, or any modern distro).
  • Docker 24+ and Docker Compose v2.
  • A domain pointed at the host (api.example.com, app.example.com).
  • 4 GB RAM minimum; 8 GB recommended.
Terminal window
git clone https://github.com/cloudscode/cloudscode
cd cloudscode/deploy
cp .env.example .env
$EDITOR .env # set DOMAIN, ADMIN_EMAIL, secrets
docker compose up -d

Caddy will provision Let’s Encrypt certs automatically on first boot. Watch the logs:

Terminal window
docker compose logs -f caddy

Once you see certificate obtained, hit https://api.<your-domain>/healthz.

VarRequiredNotes
DOMAINyesApex domain; used to derive api. and app..
ADMIN_EMAILyesFirst admin user; ACME contact.
POSTGRES_PASSWORDyesGenerated by .env.example template.
SESSION_SECRETyes32-byte hex; rotate annually.
BYOK_KEKyes32-byte hex; key-encryption-key for BYOK store.
OPENCLAW_IMAGEnoOverride default runtime image.
WEBHOOK_TIMEOUT_MSnoDefault 5000.

The compose file ships with a backup-cron.timer systemd unit that snapshots postgres and redis to /var/backups/cloudscode/ daily. Forward those off-box to S3 / R2 / your storage of choice.

Terminal window
sudo systemctl enable --now backup-cron.timer
sudo systemctl status backup-cron.timer
Terminal window
cd /opt/cloudscode
docker compose pull
docker compose up -d

Database migrations run automatically on api boot. Roll back by docker compose down && git checkout <previous-tag> && docker compose up -d.