DigitalOcean Provider

Deploy preview environments to DigitalOcean Droplets via SSH.

How it works

Prerequisites

  1. A DigitalOcean account.
  2. A personal access token with read/write scope.
  3. An SSH key registered in DigitalOcean (used for Droplet access).

Step 1 — Create a DigitalOcean personal access token

  1. Go to API → Tokens → Generate New Token.
  2. Enable both Read and Write scopes.
  3. Store the token as DIGITALOCEAN_TOKEN in Previewops secrets.

Step 2 — Register an SSH key in DigitalOcean

If you already have an SSH key pair:

  1. Go to Settings → Security → SSH Keys → Add SSH Key.
  2. Paste the public key.
  3. Note the Key ID (numeric) or fingerprint shown after adding it (or find either with doctl compute ssh-key list).

If you need a new key pair:

ssh-keygen -t ed25519 -C "previewops" -f ~/.ssh/previewops
# Upload ~/.ssh/previewops.pub to DigitalOcean (step above)
# Store the private key content as DO_SSH_PRIVATE_KEY in previewops secrets
cat ~/.ssh/previewops

Step 3 — Store secrets in Previewops

Secret Value
DIGITALOCEAN_TOKEN Personal access token from step 1
DO_SSH_PRIVATE_KEY PEM-encoded private key from step 2

Step 4 — Configure the repo

provider: digitalocean
providerConfig:
  sshKeyId: "12345678"   # required — numeric Key ID or fingerprint from step 2
  region: nyc3           # optional (default: nyc3)
                         # see: doctl compute region list
  size: s-1vcpu-1gb      # optional (default: s-1vcpu-1gb)
                         # see: doctl compute size list

Step 5 — Verify

Comment /validate-previewops on any open PR. The bot will call GET /v2/account and report the account email and status.

Notes

Troubleshooting

Error Fix
DIGITALOCEAN_TOKEN environment variable is required Set the token in secrets
digitalocean providerConfig.sshKeyId is required Add sshKeyId to providerConfig
SSH connection refused Droplet hasn't finished cloud-init; the provider waits 3 min automatically
docker: command not found cloud-init failed — check Droplet console logs in the DO dashboard