Skip to content
Install

Preview a session

To check what an agent built, run it. Greenhouse gives you two ways to view a session’s work:

  • A preview shows a dev server that runs on the machine. Nothing is built or deployed. The server updates as you and the agent change code.
  • A preview environment builds the session’s branch and deploys it to an Orchard project. People without access to the machine can open it.
  • A running machine.
  • A process that is bound to 0.0.0.0 and listens on a port that Greenhouse can preview.
  • On the Kubernetes runner, a preview domain set by the operator.

These ports can always be previewed:

3000 3001 4173 5173 8000 8080 8787

On the Kubernetes runner, a repository can add up to 10 more ports with the ports key in .orchard/greenhouse.json. The Vercel runner exposes only the ports listed here.

  1. In the terminal dock, select the Ports tab.
  2. Select Preview on the row of the port.

The preview opens in a tab in the workspace. A port that cannot be previewed shows Not exposed. A port that is bound to 127.0.0.1 shows a warning on the button.

The host, guests, and read-only guests can open previews.

Kubernetes: The preview has its own address: https://<port>-<machine>.<preview domain>/. <machine> is the first eight characters of the machine’s ID.

  • Access starts with a single-use ticket that expires after 60 seconds. The ticket sets a cookie for that preview address, valid for 12 hours.
  • Each request is checked against your current access. Removing someone from the machine ends their preview access within 15 seconds.
  • Orchard does not send your Orchard session cookie to the preview. The preview cannot set cookies for Orchard.
  • Orchard refuses requests from other sites.
  • HTTP and WebSockets work, so hot reload works.

Vercel: The preview is the machine’s public URL for that port on Vercel’s domain. Anyone with the link can open it, without signing in. The Ports tab labels these ports Public.

  • Host access to the machine.
  • Edit access to the target project, which must belong to the machine’s organization.
  • An app in the project that builds the same GitHub repository.
  1. Open the session menu in the title bar.
  2. Select Deploy preview. The pull request menu has the same item.
  3. Select a Project.
  4. (Optional) Under Copy settings from, select the app to copy. The default is the app that builds the repository.
  5. Select Deploy preview.

Greenhouse then does the following:

  1. It pushes the session’s branch to GitHub.
  2. It creates an environment named gh-<slug> in the project, or reuses the one that this session already has.
  3. It copies the settings of the source app. Without a selection, it prefers an app in the project’s default environment, then in its production environment.
  4. It deploys the branch with one replica.

The session then shows the preview’s status and URL.

Secret variables, and variables that reference another resource in the source environment, are not copied. Greenhouse lists them after the deploy. Set them on the preview environment yourself.

To deploy the latest commit again, repeat the steps. The button then reads Redeploy.

  1. Open the session menu.
  2. Select Preview deploy.
  3. Select Remove preview.

Archiving or deleting the session also removes its preview environment. Greenhouse removes only gh- environments that belong to the session. It does not remove a default or production environment.