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
| Label | What it provisions | When to use |
|---|---|---|
deploy-preview | A DigitalOcean app for your branch, pointed at the shared IBA-DEV database | Most product work. Quick to spin up, no extra DB cost. |
deploy-preview-with-db | The same DO app, plus an isolated database cloned from the latest production S3 backup | Migrations, 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:
- Sanitises your branch name to fit DO’s hostname rules (lowercase,
hyphens only, ≤18 chars). So
TUN-1234-suspend-logicbecomestun-1234-suspend-lfor the preview hostname. - (With
-with-dbonly) 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. - Provisions a DigitalOcean app running your branch, pointed at whichever database is appropriate.
- 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:
- PR closed (merged or otherwise). The
pr-preview-cleanup.ymljob runs automatically. The DO app is deleted; the isolated DB (if any) is dropped; the firewall rule is removed. - 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-dblabel 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.