> ## Documentation Index
> Fetch the complete documentation index at: https://docs.peak.inc/llms.txt
> Use this file to discover all available pages before exploring further.

# How detection works

> Check what Peak builds from your repository.

## Check the sources in order

Peak reads your setup from the default branch.
It uses the first source that works.

| Order | Source | Used when |
| - | - | - |
| 1 | .peak/preview\.yml | The file has version: 2 |
| 2 | Render Blueprint | Previews are on in it |
| 3 | Compose file | It is at the repository root |
| 4 | Render Blueprint | Previews are off in it |
| 5 | Dockerfile | It is at the repository root |

Expect Peak to always use a version 2 .peak/preview\.yml.
Fix its errors. Peak does not fall back to another source.
Expect Peak to skip any other source it can't use and try the next one.

Peak reads Blueprints named render.yaml, render.yml, or render.NAME.yaml, at the root or up to two folders deep.
Peak reads Compose files with these names.

```text theme={null}
compose.yaml  compose.yml  docker-compose.yaml  docker-compose.yml
```

Open your repository in [Previews](https://app.peak.inc/previews).
Under Setup, check the source, the public service, and every warning.
Merge setup changes to the default branch to use them.
Each pull request builds its own code and Dockerfiles.

## Render Blueprints

Peak runs the Blueprint the way Render runs a preview environment.
Peak treats previews as on when previews.generation is automatic or manual.
With manual, Peak starts the repository in [Labeled](https://docs.peak.inc/peakviews/lifecycle.md#choose-which-pull-requests).

| Blueprint | In the preview |
| - | - |
| web, pserv, and worker services | Built with runtime docker, or pulled with runtime image |
| keyvalue services | A Redis database |
| databases | A Postgres database. Peak reads databaseName, user, and postgresMajorVersion. |
| rootDir, dockerContext, dockerfilePath | The build |
| dockerCommand | The command |
| preDeployCommand | Runs once before the service starts |
| healthCheckPath | The health check. Without it, Peak waits for a web service's port. |
| disk | A volume at mountPath |
| previewValue | Used in place of value |
| generateValue | A random value for the preview |
| sync: false | An optional key. Unset unless you add it in Peak, as in a Render preview. |
| fromDatabase, fromService | Values from the preview's own databases and services |
| fromGroup | The variables of an envVarGroups entry in the Blueprint, or of a group outside it that you fill in Peak |

Expect each service's variables to also reach docker build as build arguments, as on Render.
Expect PORT=10000 on a service that doesn't set PORT.

Peak serves the first web service with a health check.
It prefers web services that turn on previews themselves.
With no web service, it serves the first private service.

Check Setup for these warnings.

| Blueprint | What Peak does |
| - | - |
| Native runtimes (node, python, ruby, go, elixir, rust) and static sites | Skips the service |
| cron and workflow services | Skips them. They don't run in previews. |
| initialDeployHook | Doesn't run it in previews |
| startCommand, buildCommand | Ignores them. Peak uses the Dockerfile and dockerCommand. |
| image.creds | Ignores them. The image must be public. |
| A service built from another repository | Skips the service |
| fromGroup for a group outside the Blueprint | Lists the group under Keys. [Fill it](https://docs.peak.inc/peakviews/environment.md#fill-environment-groups) with Paste .env or Import from Render. |
| More than one project environment | Runs the first one with a web service |

Peak sets the variables Render sets in a preview environment.

| Variable | Value |
| - | - |
| RENDER | true |
| IS\_PULL\_REQUEST | true |
| RENDER\_SERVICE\_NAME | The service name with -pr-NUMBER, such as web-pr-42 |
| RENDER\_SERVICE\_TYPE | web, pserv, or worker |
| RENDER\_GIT\_COMMIT | The head commit |
| RENDER\_GIT\_BRANCH | The pull request's branch |
| RENDER\_GIT\_REPO\_SLUG | owner/name |
| RENDER\_EXTERNAL\_URL | The preview URL, on the public service only |
| RENDER\_EXTERNAL\_HOSTNAME | The preview host name, on the public service only |

Expect each service to answer on its own name and on its name with -pr-NUMBER.

## Docker Compose

Peak runs each service as written, databases included.

| Compose | In the preview |
| - | - |
| build, image, command, entrypoint | Used as written |
| environment, env\_file | Used. For an env\_file that isn't committed, Peak asks for the names in its .example or .sample file. |
| A variable reference | From the committed .env next to the Compose file, then its default. Any other one is a key you add in Peak. |
| ports, expose | The service's port |
| healthcheck | The health check |
| depends\_on | Start order. A service others wait on with service\_completed\_successfully runs once as a job. |
| Named volumes | Kept |
| Bind mounts | Dropped. The image runs as built. |
| profiles | Services behind a profile don't start |
| include, extends, dockerfile\_inline | Not supported |

Peak serves the first service that matches, in this order.

1. A reverse proxy that publishes a port.
2. A service named web, frontend, app, or similar that publishes a port.
3. The first service that publishes a port.
4. A reverse proxy.
5. The first service with a port.

Expect Peak never to serve a data store or a job.

## Dockerfile

Peak builds the root Dockerfile as one service named app.
Peak picks the port from the first of these.

1. EXPOSE in the final stage.
2. ENV PORT in the final stage.
3. A port in the package.json start script, or 3000 for Next.js.
4. 3000, with a warning.

Expect Peak to set PORT to that port and wait for it to accept connections.

## Databases

Peak creates the databases that render.yaml or .peak/preview\.yml names.

| Kind | Runs | Default version |
| - | - | - |
| Postgres | PostgreSQL | 18 |
| MySQL | MySQL | 8.4 |
| ClickHouse | ClickHouse | 26.8 |
| Redis | Valkey | 9 |

Set a version to pin another one.
Expect every database and volume to start empty in each deployment.
Load test data in your migration command.

## Migrations

| Source | Field |
| - | - |
| render.yaml | preDeployCommand |
| .peak/preview\.yml | migrate |

Expect the command to run once per deployment, in the service's image and environment, before the service starts.
Expect a failed migration to fail the deployment.
Expect the current preview to keep serving.

## Health checks

| Source | Check |
| - | - |
| render.yaml | healthCheckPath |
| Compose | healthcheck |
| Dockerfile | The port accepts connections |
| .peak/preview\.yml | health |

Expect Peak to serve a new deployment only after every check passes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.