GitOps Auto-Deploy
A GitHub Actions pipeline can automatically deploy to the VPS on every push to main. This is optional — if you don’t configure the secrets below, the workflow won’t run and you can continue deploying manually with make deploy.
What It Does
- Triggered by changes to
openclaw.json,docker/,docker-compose.yml,ansible/, orsecrets/.env.enc - Connects to the VPS via an ephemeral Tailscale node (no public SSH required)
- Decrypts
secrets/.env.encusing SOPS + age key from GitHub Secrets - If
docker/ordocker-compose.ymlchanged: runsmake deploy REBUILD=1 - Otherwise: runs
make deploy
A manual rollback workflow is also included (.github/workflows/rollback.yml) — trigger it from the GitHub Actions UI with any previous git SHA. It also decrypts secrets with SOPS before deploying.
One-Time Setup
1. Generate a dedicated CI deploy SSH key
| |
2. Create a Tailscale OAuth client
Full reference: Tailscale CI/CD guide
- Tailscale admin → Settings → OAuth clients → Create new client
- Required scopes: Devices → Write and Auth keys → Write
- Assign tag:
tag:ci-runner(this must be the only tag — do not add other tags to this client)Important: Tailscale OAuth clients with 2+ tags require all tags simultaneously on every key request. Keep this client single-tag. The Terraform provider uses a separate OAuth client for
tag:openclaw-vps. - Save Client ID and Client Secret
3. Tag the VPS in Tailscale
Tailscale admin → Machines → your VPS → Tags → add tag:openclaw-vps.
4. Set up SOPS encryption
| |
5. Add GitHub repository secrets (Settings → Secrets and variables → Actions → Repository secrets):
| Secret | Value |
|---|---|
TAILSCALE_OAUTH_CLIENT_ID | From step 2 |
TAILSCALE_OAUTH_CLIENT_SECRET | From step 2 |
SSH_PRIVATE_KEY | Private key from step 1 |
SERVER_IP | Tailscale IP of the VPS (e.g. 100.x.x.x) — use the IP, not the MagicDNS hostname (MagicDNS resolution is unreliable on ephemeral runners) |
SOPS_AGE_KEY | Full content of secrets/age-key.txt (the age private key — multiline is fine) |
Updating Secrets
When you need to change environment variables:
| |
Verification
- Push a change to
openclaw.json→ confirm theDeploy to VPSworkflow triggers and completes - Push a change to
docker/Dockerfile→ confirm the rebuild step runs - Push a change to
secrets/.env.enc→ confirm the decrypt step works and deploy succeeds - Trigger
Rollback deploymentfrom the GitHub Actions UI with a previous SHA → confirm the VPS reverts