This repository provides an OpenClaw deployment flow built on a single Docker Compose stack:
- Build the latest OpenClaw image via the official OpenClaw setup script
- Access OpenClaw directly at
http://localhostfor local development - Deploy to production with Traefik + Let's Encrypt HTTPS by setting
DOMAIN_NAME,SSL_EMAIL, and the Traefik router env vars - Keep the AI provider configuration generic — you choose the provider from the UI
.
├── .env.example
├── docker-compose.yml
├── Makefile
└── scripts/
├── build-latest-image.sh
├── local-up.sh
└── traefik-cmd.sh # starts Traefik in local HTTP or production HTTPS mode
- Docker Engine + Docker Compose plugin
- Git
- Bash
Check your setup:
docker --version
docker compose version
git --version- Copy the environment template:
cp .env.example .env- Build the image and start the stack:
make up-
Open
http://localhost. -
If Control UI asks for auth, copy the token printed in the terminal and paste it manually into Control UI settings.
The first run will:
- Create local folders for config and workspace
- Clone OpenClaw and run the official
./scripts/docker/setup.sh - Build the image and generate/sync
OPENCLAW_GATEWAY_TOKEN - Start Traefik + OpenClaw
make up # build image + start stack
make down # stop stack
make logs # follow gateway logs
make rebuild # rebuild image + restart
make build-image # build image only
make token # show current gateway tokenLocal access: http://localhost
Main variables in .env:
OPENCLAW_IMAGE: local tag for the built imageOPENCLAW_UPSTREAM_REPO: upstream source repositoryOPENCLAW_BUILD_REF:latest-release,main, or a specific tag/branchOPENCLAW_GATEWAY_TOKEN: auth token (auto-generated on firstmake up)DOMAIN_NAME: your production domain (used by Traefik routing labels)SSL_EMAIL: Let's Encrypt email — leave empty for local dev; set to your email for production HTTPSTRAEFIK_ROUTER_ENTRYPOINTS:webfor local,websecurefor productionTRAEFIK_ROUTER_TLS:falsefor local,truefor productionTRAEFIK_CERTRESOLVER: empty for local,letsencryptfor production
The bootstrap creates .openclaw/openclaw.json (if missing) with:
- Gateway token auth mode
- Local allowed origins (
localhostand127.0.0.1) - No preconfigured model provider (you choose later)
You can configure your preferred provider later from OpenClaw onboarding/UI or by editing the file manually.
Set a fixed ref in .env:
OPENCLAW_BUILD_REF=mainor a specific tag:
OPENCLAW_BUILD_REF=vX.Y.ZDelete OPENCLAW_GATEWAY_TOKEN value in .env (or set CHANGE_ME) and run:
make upThe build step syncs the token generated by the official OpenClaw setup script back into your local .env.
On your VPS:
- Clone this repo and copy
.env.exampleto.env. - Set
DOMAIN_NAME=openclaw.your-domain.comandSSL_EMAIL=your@email.com. - Set
TRAEFIK_ROUTER_ENTRYPOINTS=websecure,TRAEFIK_ROUTER_TLS=true, andTRAEFIK_CERTRESOLVER=letsencrypt. - Point your domain's DNS A record to the VPS IP.
- Open ports 80 and 443 on the server firewall.
- Run
make up.
Traefik will automatically obtain a Let's Encrypt certificate for your domain on first start.
- Never commit
.env,.openclaw/,workspace/, or.tmp/(already covered by.gitignore). - Rotate
OPENCLAW_GATEWAY_TOKENif you ever shared terminal output/screenshots with the full token. - Prefer HTTPS in production: set
TRAEFIK_ROUTER_ENTRYPOINTS=websecure,TRAEFIK_ROUTER_TLS=true, andTRAEFIK_CERTRESOLVER=letsencrypt. - Restrict network exposure at the VPS/firewall level to ports
80/443only; do not publish internal service ports. - Keep Docker, Traefik, and OpenClaw updated regularly to receive security fixes.
- Review
gateway.trustedProxiesandallowedOriginsin.openclaw/openclaw.jsonif deploying behind a reverse proxy in non-local environments. - Container hardening is enabled in
docker-compose.yml(read-only filesystem for Traefik, dropped Linux capabilities,no-new-privileges, and log rotation limits).
This repository is a personal project provided "as is", without warranties of any kind, express or implied.
By using, deploying, or modifying this project, you accept full responsibility for your own infrastructure, data, compliance, and security posture.
The author is not liable for any direct or indirect damages, data loss, service interruptions, security incidents, or other issues resulting from the use of this repository.
For legal terms, see LICENSE and DISCLAIMER.md.