GitHub Preview Deployments

Preview deployments run pull requests separately from the production application. Coolify removes an automatic preview after its pull request is merged or closed.

Features

Preview domains

Preview URL Template and Load Pull Requests controls in Coolify

Preview URL Template controls the generated domain:

  • {{random}} inserts a random value.
  • {{pr_id}} inserts the pull-request number.
Create wildcard DNS first

To use a domain such as https://123.preview.example.com, create an A or AAAA record for *.preview.example.com that points to the deployment server.

Load Pull Requests fetches currently open pull requests.

Deploy older pull requests manually

Coolify does not automatically deploy pull requests that were already open when preview deployments were enabled. Select Load Pull Requests, then select Deploy for each required pull request.

Choose who can deploy previews

Pull-request code can be untrusted. A public contributor could otherwise run code on your server.

Preview Deployments and Allow Public PR Deployments settings
  • Preview Deployments enables previews for trusted repository members, collaborators, and contributors.
  • Allow Public PR Deployments allows public contributors to trigger previews.

Keep public pull-request deployments disabled unless you accept the risk of running contributor code.

Scoped secrets

Coolify keeps production and preview variables separate.

Production and preview environment-variable groups
  • Production Environment Variables are used only by the main deployment and are not passed to pull-request previews.
  • Preview Deployment Environment Variables are used only by pull-request deployments.

Do not copy production credentials into preview variables for untrusted pull requests. Use limited, non-production credentials.

Automated comments

Coolify can add deployment status and domain information to the pull request and update the comment when the deployment state changes.

Coolify preview deployment comment on a GitHub pull request
Comments require a GitHub App

Manual repository webhooks can trigger previews, but automated pull-request comments require GitHub App permissions.


Set up preview deployments

Choose how the application receives pull-request events.

Follow Set up a GitHub App first.

Preview Deployments permission during automated GitHub App installation

Enable Preview Deployments before selecting Register Now. Coolify requests read-and-write pull-request access and subscribes the app to pull-request events.

Update an existing GitHub App

Update GitHub App permissions action in Coolify
  1. Open Sources and select the GitHub App.
  2. Open Permissions.
  3. Select Update.
Pull Request permissions and event subscription on GitHub
  1. Set Pull requests to Read and write.
  2. Subscribe to Pull request events.
  3. Accept the permission update.

Verify preview deployments

  1. Open or update a pull request.
  2. Confirm that Coolify creates a separate preview deployment.
  3. Open the generated preview domain and test the changed behavior.
  4. Close the pull request and confirm that Coolify removes the automatic preview.

On this page