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 deployment access settings
  • Enable preview deployments turns on previews for the application.
  • PR deployment access set to Repository members only blocks pull requests from forks unless the author is a repository owner, member, or collaborator.
  • PR deployment access set to Public (fork PRs allowed) allows public contributors to trigger previews.

PR deployment access applies only while preview deployments are enabled. When they are disabled, a preview that you deploy by hand is deployed as Repository members only.

Keep PR deployment access set to Repository members only unless you accept the risk of running contributor code.

Scoped secrets

Coolify keeps production and preview variables in separate groups.

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

Use explicit, limited non-production credentials for pull requests. Creating a production variable can also create a preview entry with the same value. A public preview does not get the preview variables whose value resolves to the production value, including references such as {{team.KEY}}. With Repository members only, a preview can fall back to production runtime values for keys with no preview entry. Review preview variable isolation before exposing previews to contributors.

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

Set Preview deployment access to Read and update pull requests before selecting Register with GitHub. 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