Skip to Content
Networking

Pull request previews

Every open pull request gets its own running copy of the app, at its own URL.

Reviewers click a link instead of checking out a branch. Each pull request opened against the app's branch gets its own running copy, removed when the pull request closes. Its URL stays the same across rebuilds.

Preview URL
By defaultblog-pr-42-3f9a1c-cb00710a.deplo.site, plain HTTP
With a Preview domainblog-pr-42.preview.example.com, HTTPS if you turn it on

Turn it on

Previews need an app that deploys from GitHub. For other sources the settings show, disabled.

Open pull request settings

Open the app, then Settings -> Pull requests.

Turn on previews

Turn on Deploy pull requests, then Save in the bar at the bottom.

Use the tab

A Pull requests tab appears on the app.

Settings

SettingDefaultWhat it does
Preview domainnoneA base like preview.example.com, with a wildcard DNS record *.preview.example.com pointing at the server
HTTPSoffA certificate per preview. Needs a preview domain
Rebuild on every commitonOff, only Redeploy preview builds the latest commit
Live previews3How many run at once, 1 to 50. Past it, a new one stops the least active
Portthe app'sThe port a preview answers on
Only pull requests labellednoneOne label per line. Only pull requests carrying one get a preview
Build draftsoffOff, a draft waits until it is ready for review
Comment on the pull requestonPosts the URL on the pull request and keeps it up to date
Destroy after3 daysDays without activity before a preview is destroyed, 1 to 365
Fork pull requestsWait for approvalOr Ignore them, or Build them automatically
ServerSame as the appWhere previews run, often a cheaper machine

Only pull requests labelled and every row after it are under Advanced.

The Pull requests tab

Every preview is a row, with Redeploy preview, Destroy preview and Open pull request. New preview deploys one by hand, drafts included.

Preview deployments in the history, each on its own pull request URL

Inside a preview, DEPLO_PREVIEW=1, DEPLO_PREVIEW_URL and DEPLO_PR_NUMBER are set.

Fork pull requests

A preview from a fork gets none of the app's variables: give it what it needs with a plain preview override. By default it waits on a row marked Needs approval until someone with Manage pull request previews clicks Review and deploy.

Good to know

  • A preview reads the app's variables. A hand-written DATABASE_URL points it at the production database: set a preview override first.
  • Turning previews off destroys every live preview and its data, after a confirmation.
  • Every preview is a running copy that uses the server's CPU and memory.

Something wrong? See Deploys and builds.

Did this page help you?

On this page