# cluster.toml reference



Commit `cluster.toml` at the project root so every clone uses the same build
and service settings. An App uses `[serverless]`. A Compute service uses the
top-level `name` and `mode` keys plus its service tables. Both can share a
file. CCP keeps the selected remote identities in the gitignored `.ccp/`
directory. See the [quickstart](/docs/ccp/quickstart) to link a fresh clone.

## Serverless App [#serverless-app]

```toml
[serverless]
index = "src/handler.ts"
client = "src/client.tsx"
assets = "public"
analytics = "server"
oidc_callback_path = "/auth/callback"
```

| Key                  | Type    | Default when omitted           | Meaning                                                                                                                                                                                     |
| -------------------- | ------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `index`              | string  | Required in this table         | Entry file exporting the request handler.                                                                                                                                                   |
| `client`             | string  | No browser entry               | Client-side JavaScript or TypeScript entry to bundle.                                                                                                                                       |
| `assets`             | string  | No configured assets directory | Directory of static files to include.                                                                                                                                                       |
| `analytics`          | string  | `"server"`                     | Select `"server"` for server-side analytics or `"client"` for browser tracking.                                                                                                             |
| `prebuilt_assets`    | boolean | `false`                        | Read HTML only from the assets directory. Requires `assets`. Used for compiled frontend output such as Vite’s `dist`. CCP serves this HTML unchanged, so add any analytics script yourself. |
| `oidc_callback_path` | string  | `"/auth/callback"`             | Callback path used when CCP registers a redirect URI for a linked OIDC client.                                                                                                              |

Use project-relative paths that resolve inside the project for `index`,
`client`, and `assets`. Omit optional paths you do not use.

## Local development [#local-development]

| Key            | Type   | Default when omitted       | Meaning                                      |
| -------------- | ------ | -------------------------- | -------------------------------------------- |
| `dev.env_file` | string | Automatic `.env` discovery | Default environment file for `ccp dev` only. |

Use a non-empty path relative to the project root. It must resolve to an
existing file inside the project, even if the path uses a symlink. If CCP
can't load the configured file, `ccp dev` exits with an error rather than
falling back to `.env`. See [Custom Env File](/docs/ccp/environment-variables#custom-env-file)
for an example and command-line overrides.

## Compute service [#compute-service]

This image-mode example runs NGINX on port 80. Put the two top-level keys
before the first table header.

```toml
name = "web"
mode = "image"

[image]
ref = "nginx:alpine"

[service]
internal_port = 80
always_on = false
```

| Key                     | Type    | Default when omitted           | Meaning                                                                                                    |
| ----------------------- | ------- | ------------------------------ | ---------------------------------------------------------------------------------------------------------- |
| `name`                  | string  | Required in a Compute manifest | Service name.                                                                                              |
| `mode`                  | string  | Required                       | `"image"` pulls a container image. `"binary"` runs a Linux x86-64 executable.                              |
| `image.ref`             | string  | Required for image mode        | Container image reference.                                                                                 |
| `service.internal_port` | integer | Required                       | Port the service listens on, from 1 to 65535. Bind the application to `0.0.0.0` so the proxy can reach it. |
| `service.always_on`     | boolean | `false`                        | Set to `true` to keep the VM running and to enable private network attachment.                             |

Changing the mode, binary runtime, port, resource shape, always-on setting,
or network can require replacing a deployed service. See [Compute replacement](/docs/ccp/compute#replace-immutable-configuration).

### Binary and build [#binary-and-build]

For a binary service, use `mode = "binary"` and supply a binary table.
CCP records a build table when it detects a Go or Rust source project.

```toml
name = "worker"
mode = "binary"

[binary]
path = "./dist/worker"
runtime = "auto"
args = ["--listen", "0.0.0.0:8080"]

[service]
internal_port = 8080
```

```toml
[build]
kind = "go"
```

| Key              | Type             | Default when omitted                                                               | Meaning                                                                                                                                    |
| ---------------- | ---------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `binary.path`    | string           | Required for a prebuilt binary. A source-only `[build]` can omit the binary table. | Path to the executable CCP uploads.                                                                                                        |
| `binary.runtime` | string           | `"auto"`                                                                           | CCP inspects the ELF to select Alpine for static or musl binaries and Debian for glibc. Set `"alpine"` or `"debian"` to select explicitly. |
| `binary.args`    | array of strings | `[]`                                                                               | Each element is one argument. CCP passes the arguments without shell expansion.                                                            |
| `build.kind`     | string           | No recorded build toolchain                                                        | `"go"` or `"rust"`. CCP uses the recorded toolchain to rebuild from source on redeploy. Omit the table when supplying a prebuilt binary.   |

### Resources and environment [#resources-and-environment]

```toml
[resources]
vcpu = 2
memory_mb = 1024

[env]
LOG_LEVEL = "info"
```

| Key                   | Type    | Default when omitted                                                     | Meaning                                                                                                                                                 |
| --------------------- | ------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `resources.vcpu`      | integer | 1 when the table is absent                                               | Virtual CPUs. Supply both resource keys when setting a shape.                                                                                           |
| `resources.memory_mb` | integer | 512 MiB for binary mode, 768 MiB for image mode when the table is absent | Memory in MiB. Supported explicit CPU/memory pairs are 1/256, 1/512, 2/1024, 4/2048, and 4/4096.                                                        |
| `env.<KEY>`           | string  | No manifest value                                                        | Compute environment variable. Values from this table override `.env`; a deploy-time `--env` overrides both. Keep credentials out of the committed file. |

### Health checks [#health-checks]

Omit `[health]` for the standard TCP readiness check. Add the table when
readiness depends on an HTTP endpoint.

```toml
[health]
path = "/ready"
port = 8080
initial_delay_ms = 1000
timeout_ms = 2000
period_ms = 500
success_threshold = 1
startup_budget_ms = 30000
```

| Key in `[health]`   | Type    | Default when omitted    | Meaning                                                                                      |
| ------------------- | ------- | ----------------------- | -------------------------------------------------------------------------------------------- |
| `path`              | string  | Required                | HTTP readiness path served by your application.                                              |
| `port`              | integer | `service.internal_port` | Port serving the readiness endpoint.                                                         |
| `initial_delay_ms`  | integer | 1000                    | Delay before retries if the initial HTTP probe fails, in milliseconds.                       |
| `timeout_ms`        | integer | 2000                    | Timeout per probe, in milliseconds.                                                          |
| `period_ms`         | integer | 500                     | Interval between attempts, in milliseconds.                                                  |
| `success_threshold` | integer | 1                       | Consecutive successes required during retries. An immediately successful first probe passes. |
| `startup_budget_ms` | integer | 30000                   | Retry budget after the initial delay, in milliseconds.                                       |

## Private network [#private-network]

```toml
[network]
name = "backend"
```

`network.name` is a string, required when the table is present. Use a lowercase
DNS label of 1–63 letters, digits, or hyphens, starting and ending with a letter
or digit. Omitting the table selects no private network. For a Serverless App,
select an existing network in the organization. For Compute, set
`service.always_on = true`; the first deploy can create the network.
See [Compute networking](/docs/ccp/compute) and [App deployment](/docs/ccp/deploying).
