Helm Docs

Preview Lifecycle

A preview is created, becomes ready, may be rebuilt with newer code, and is finally torn down. This page explains each stage, what a rebuild keeps and changes, what happens when a preview fails, how long previews last, how many you can have, and what a preview can reach on the network.

What you're about to do, in plain English

You manage previews on the PR Previews page: open your project in Helm and click PR Previews in the sidebar. Each row shows one preview, its status, its branch or pull request, and its address once it is ready. The row's actions include Rebuild and Teardown; every item in the menu is explained in The PR Previews Page. Your GitHub Actions workflows can do the same through Helm's API; see Set Up PR Previews for Your Backend.

Create

A preview is created in one of three ways:

  • A GitHub Actions workflow sends POST /api/previews/.
  • Someone clicks Create preview on the PR Previews page and names a branch of the backend repository.
  • An AI assistant connected to Helm uses Helm's preview tools.

Helm then starts a virtual machine, copies your branch into it, checks your Compose file, runs your Pre-deploy Command, starts the stack with your Start Command, waits for the web service to answer, and runs your First-deploy Command; see Preview Commands for the exact order. A new request for a pull request that already has a preview replaces the old preview.

Ready

When the web service answers, the preview's status becomes ready and its address starts working, for example https://myapp-pr-42-a1b2c3.preview.helmcode.dev. Before that, and after teardown, the address answers 404.

HTTPS ends at Helm, so your web service receives plain HTTP, with the preview's domain in the Host header. The address stays the same for the whole life of the preview, including every rebuild.

Rebuild a ready preview

Click Rebuild on a ready preview to build it again, for example after you pushed new commits or changed a setting. You need the Project Admin role or higher; a member below that sees "Rebuilding a preview requires Project Admin or higher."

A rebuild replaces the preview's virtual machine with a new one. Helm deletes the old virtual machine, with every service and its data, and then starts the preview again from the beginning:

  • The address and the preview's id stay the same.
  • The data starts empty again. A rebuild destroys the virtual machine and its volumes, so nothing from before the rebuild, in the database or any other volume, is kept. A volume defined in your Compose file does not keep data either, because it is inside the same virtual machine.
  • The preview is unavailable while the rebuild runs. Its address answers with an error until the new version is ready, which takes about two minutes, or longer when images are built from the start. The status on the PR Previews page stays Ready during this time. While the request waits to start, the row shows Rebuild requested.
  • The code: if the preview was created for a specific commit, Helm builds that same commit again. Otherwise it builds the newest commit on the branch.
  • The settings: the rebuild uses the project's current settings: its plain and encrypted variables, the names of Helm's two variables, the Compose File Path, the Web Service, the App Port and the commands.
  • All three commands run again: the Pre-deploy Command, the Start Command and the First-deploy Command. Seed data loaded by the Pre-deploy or First-deploy Command comes back after every rebuild.
Warning: A rebuild deletes the preview's data. Anything testers created in the preview, such as accounts or uploads, is gone afterwards. Seed data comes back only if your Pre-deploy or First-deploy Command loads it.
Note: A preview created for a specific commit keeps building that commit. To preview commits you pushed later, request a new preview for the branch or pull request.

When a rebuild fails

If the new version fails to build, its Pre-deploy Command fails, or it does not answer in time, nothing is left serving at the address, because the old virtual machine was already deleted. The preview's status becomes Failed with the reason. Fix the reason, then click Rebuild on the failed preview to start it again as a new preview.

If Helm refuses the rebuild before it changes anything, for example because the new settings or the Compose file break one of Helm's rules, the old version keeps serving. The row then shows Last rebuild failed: with the reason, followed by "The previous version is still serving."

When a rebuild is not started

Sometimes Helm cannot start a rebuild at all. The preview stays exactly as it was, and the row shows Rebuild not started: with the reason. The common reasons are:

  • Helm is still busy with another change to the preview, such as starting it. Wait, then rebuild again.
  • Helm did not accept the project's current preview settings. The reason starts "Helm refused this preview's settings or Compose file" when it names the setting. Check the settings on the Preview Environments tab, then rebuild again.
  • The Helm GitHub App can no longer read the repository. Connect GitHub again, or give the App access to the repository.

A preview that is still starting, being torn down or already torn down cannot be rebuilt.

A failed preview

A preview that could not be built or started has the status failed, and the row shows the reason. The common reasons and their fixes are in the Troubleshooting sections of Set Up PR Previews for Your Backend Write the Compose File and Preview Commands.

Clicking Rebuild on a failed preview starts it again as a new preview, from the same repository, branch, pull request and commit, with the project's current settings. The new preview gets a new address and an empty database, and it counts against your organization's preview limit like any new preview. A failed preview takes no room from that limit.

Teardown

Tearing a preview down removes its virtual machine, with every service in your Compose file and all their data, and everything else Helm created for it. Nothing is kept, and the address answers 404.

Danger: Teardown cannot be undone. The preview's database is deleted and there are no backups.

A preview is torn down when any of these happens:

  • A member with the Project Admin role or higher clicks Teardown on the PR Previews page. A member below that sees "Tearing down a preview requires Project Admin or higher."
  • A workflow sends POST /api/previews/<id>/teardown/. A workflow that asked for a preview should tear it down when the run ends, pass or fail.
  • The pull request is closed or merged, or the branch is deleted. GitHub tells Helm through the Helm GitHub App, with no webhook needed on your repository. This works for every repository in the project's GitHub Repos setting.
  • The preview's lifetime runs out (see below).

None of these tear down a pinned preview. See "Pinning a preview" below.

Pinning a preview

Pinning marks a preview that must stay up, for example while testers use it. A Project Admin pins or unpins a preview with the star at the start of its row on the PR Previews page, or with the Helm MCP tools pin_preview_environment and unpin_preview_environment. While a preview is pinned:

  • Teardown on the PR Previews page opens a dialog, "This preview is pinned. Unpin it before tearing it down.", and nothing is removed.
  • POST /api/previews/<id>/teardown/ answers 409 with {"error": "preview_pinned", "code": "preview_pinned", "message": "This preview environment is pinned. Unpin it before tearing it down."}. The MCP tool teardown_preview_environment returns the same refusal as a tool error with http_status 409.
  • Closing or merging its pull request, or deleting its branch, leaves it running.
  • It does not expire, whatever its age.

It still counts toward Max Concurrent Previews. A new run for the same pull request still replaces it, and the new preview is pinned in its place. Unpinning does not restart the lifetime: a preview older than the Preview TTL (hours) is torn down within a few minutes of being unpinned.

Expiry and limits

Two organization settings control previews across all your projects:

  • Preview TTL (hours) — how long a preview lives. When it reaches this age, Helm tears it down, unless it is pinned. The default is 168 hours (7 days), which is also the most you can set.
  • Max Concurrent Previews — how many previews your organization may have at once, across all projects. The default is 5. A new request for a pull request that already has a preview replaces it and needs no free place. A preview for a new pull request beyond the limit is refused, and the API answers 409 with the code preview_limit_reached.

You can set lower values in Company settings → Usage Limits. Contact Helm support if you need more.

Network access

Each preview has its own private network, shared only by the services in its Compose file. Nothing outside the preview can connect to them directly; requests reach the web service only through the preview's address.

  • The internet works. Your app can call third-party APIs, send webhooks and look up domain names as usual.
  • Private networks do not. Connections to private addresses (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 100.64.0.0/10, 169.254.0.0/16 and a few other reserved ranges) are refused at once with "connection refused". This includes other previews and cloud metadata addresses such as 169.254.169.254. If your app needs a service, give it the service's public address.
  • The same rules apply while your images build, so a RUN step in a Dockerfile can download from the internet but not from a server on a private network.

Resources

Each preview runs in its own virtual machine on 64-bit x86 Linux (linux/amd64), which no other preview shares.

WhatEach preview gets
Processor2 cores
Memory4 GiB, shared by every service in your Compose file
Disk40 GiB, shared by the images, the volumes and everything the services write

Helm applies these limits to every service in your Compose file. Everything the services write is lost when the preview is rebuilt or torn down, so do not rely on uploads or caches surviving.

Troubleshooting

The address answers 404 or an error

The preview is not ready yet, it is being rebuilt, or it has been torn down. Check its status on the PR Previews page. A preview becomes reachable only after the web service answers GET /.

The preview became Failed after a rebuild

The new version failed, and because a rebuild replaces the old version, nothing is serving. Fix the reason shown, for example a failing migration, then click Rebuild on the failed preview to start it again as a new preview.

"Last rebuild failed:" is shown

Helm refused the rebuild before changing anything, and the old version is still serving. Fix the reason shown, usually a preview setting, then click Rebuild again.

My data disappeared after a rebuild

That is expected: a rebuild starts the preview's database empty. Load the data your testers need in your Pre-deploy or First-deploy Command; both run on every rebuild.

"Rebuild not started:" is shown

Follow the reason shown, then rebuild again.

My rebuild still runs the old code

The preview was created for a specific commit, so every rebuild builds that commit. Request a new preview to build newer commits.

A new preview is refused because of the limit

Tear down previews you no longer need on the PR Previews page. Make sure your workflows tear down their previews when each run ends, so previews do not wait for their lifetime to run out. Pinned previews count toward the limit too; unpin the ones nobody needs any more.

A teardown answers 409 preview_pinned

The preview is pinned, so Helm left it running. That is expected in a workflow's teardown job: the copy-ready job in Set Up PR Previews logs "Preview is pinned; left running" and succeeds. To remove the preview, a Project Admin unpins it on the PR Previews page first.

My app cannot reach a service

If the service has a private address, the preview cannot reach it. Use the service's public address. If a public address fails too, check that the service accepts connections from the internet.

The preview was torn down unexpectedly

Check whether the pull request was closed or merged, the branch was deleted, a workflow's teardown job ran, or the preview reached its Preview TTL (hours). To keep a preview up through all of these, pin it.