Skip to Content
Getting started3. Deploy previews

Deploy previews

Apply a label to your PR → a live, shareable preview environment exists within ~10 minutes. The team uses this to demo work to product, run proper QA, and let stakeholders click around before merge.

The two labels

LabelWhat it provisionsWhen to use
deploy-previewA DigitalOcean app for your branch, pointed at the shared IBA-DEV databaseMost product work. Quick to spin up, no extra DB cost.
deploy-preview-with-dbThe same DO app, plus an isolated database cloned from the latest production S3 backupMigrations, destructive data work, anything that would corrupt the shared dev DB if it broke.

You can only have one active at a time — if you swap labels, the previous preview tears down and a fresh one spins up.

What you’ll see

Within ~30 seconds of applying the label, the PR Preview — Create workflow starts. It runs the .github/workflows/pr-preview-create.yml job. Watch its progress in the Checks tab of the PR.

The job:

  1. Sanitises your branch name to fit DO’s hostname rules (lowercase, hyphens only, ≤18 chars). So TUN-1234-suspend-logic becomes tun-1234-suspend-l for the preview hostname.
  2. (With -with-db only) Provisions an isolated MySQL database from the latest production S3 backup, adds the runner’s public IP to the DB cluster’s firewall, and waits ~15s for the firewall rule to propagate.
  3. Provisions a DigitalOcean app running your branch, pointed at whichever database is appropriate.
  4. Comments on the PR with the preview URL once it’s healthy.

Total wall-clock time is usually 5–10 minutes. A second push to the same PR triggers a fast rebuild (~2 minutes) — the existing app is re-deployed in place, the DB stays.

Finding the URL

A bot comment on your PR will look something like:

Preview deployed: https://tun-1234-suspend-l-iba-iflyworld.ondigitalocean.app/

The exact hostname is derived from your branch name. Subsequent updates edit the same comment, so you’ll always have it in the latest sticky position.

If for some reason the comment doesn’t post, you can find the app in the DigitalOcean dashboard under Apps — search for your sanitised branch name.

Cleanup

Two events tear the preview down:

  1. PR closed (merged or otherwise). The pr-preview-cleanup.yml job runs automatically. The DO app is deleted; the isolated DB (if any) is dropped; the firewall rule is removed.
  2. Label removed. Same cleanup, kept live but no longer running.

You don’t need to manually clean anything up. If a preview gets stuck — e.g. the cleanup workflow itself fails — flag it in the channel; the DO dashboard has a manual delete option that’s a one-clicker.

Cost awareness

Previews are not free — each DO app is a real running container, and each isolated DB is real storage. Be considerate:

  • Don’t leave a deploy-preview-with-db label on a long-lived draft PR that you’re not actively reviewing.
  • If you’re stopping work for the night, remove the label; you can re-apply tomorrow.
  • For purely backend tweaks where the shared DB is fine, use deploy-preview (no -with-db). DB provisioning is by far the biggest cost component.

What’s next

Last orientation page: Keeping docs in sync — the spec 003 flow that catches business-logic changes lacking matching doc updates.

Last updated on