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 default | blog-pr-42-3f9a1c-cb00710a.deplo.site, plain HTTP |
| With a Preview domain | blog-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
| Setting | Default | What it does |
|---|---|---|
| Preview domain | none | A base like preview.example.com, with a wildcard DNS record *.preview.example.com pointing at the server |
| HTTPS | off | A certificate per preview. Needs a preview domain |
| Rebuild on every commit | on | Off, only Redeploy preview builds the latest commit |
| Live previews | 3 | How many run at once, 1 to 50. Past it, a new one stops the least active |
| Port | the app's | The port a preview answers on |
| Only pull requests labelled | none | One label per line. Only pull requests carrying one get a preview |
| Build drafts | off | Off, a draft waits until it is ready for review |
| Comment on the pull request | on | Posts the URL on the pull request and keeps it up to date |
| Destroy after | 3 days | Days without activity before a preview is destroyed, 1 to 365 |
| Fork pull requests | Wait for approval | Or Ignore them, or Build them automatically |
| Server | Same as the app | Where 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.
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_URLpoints 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?