Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.compartment.dev/llms.txt

Use this file to discover all available pages before exploring further.

compartment.yml is the single file Compartment reads to understand your project. It lives at your repository root and declares the project slug, the services you want to deploy, and optional per-service hints for how each one should be built, run, and accessed. Everything else — secrets, environment-specific values, node placement, hosted domains, deployment history, and browser-facing proxy rules — belongs elsewhere.

Top-level fields

FieldTypeRequiredDescription
namestringYesProject slug. Must match ^[a-z][a-z0-9-]{0,62}$.
servicesmapYesOne or more named services. At least one entry is required.

name

The project slug uniquely identifies your project within Compartment. It must start with a lowercase letter and contain only lowercase letters, digits, and hyphens, up to 63 characters total.
name: internal-tools

services

Each key under services is the service name. Service names must match ^[a-z0-9][a-z0-9_-]{0,62}$. The value can be either a path string or a service config object.

Service as a path string

The simplest form is a bare path string pointing to the service’s directory relative to the repository root. Compartment applies all defaults for kind, accessMode, build, run, and readiness.
name: my-app

services:
  web: .
The . path means the service source is the repository root itself. Use a subdirectory path when your service lives in a subdirectory:
services:
  web: apps/web

Service config object

When you need to control build strategy, access mode, restart policy, or readiness checks, expand the value to a config object.
FieldTypeRequiredDefaultDescription
pathstringYesPath to the service directory, relative to the repository root.
kindstringNowebService kind. One of web, api, worker, job, cron.
accessModestringNoauthenticatedRoute access mode. One of authenticated or public.
buildobjectNoBuild configuration. See Build Options.
runobjectNoRuntime configuration. Controls the start command and restart policy.
readinessobjectNoReadiness probe configuration.

run

The run block controls how Compartment starts your service after a successful build.
FieldTypeRequiredDescription
commandstringNoOverride the start command. Railpack services only.
restartobjectNoRestart policy configuration.
run.restart
FieldTypeRequiredDescription
policystringYesOne of no, on-failure, unless-stopped. Default is on-failure.
maxRetriesintegerNoMaximum restart attempts. Only valid with on-failure policy.
run.command is only supported when the service build resolves to Railpack. Dockerfile-built services must define their start command inside the Dockerfile.

readiness

The readiness block tells Compartment when your service is ready to receive traffic. Currently only HTTP probes are supported.
FieldTypeRequiredDefaultDescription
typestringYesMust be http.
pathstringNo/healthzHTTP path Compartment polls to check readiness.
timeoutMsintegerNo30000Maximum milliseconds to wait for the probe to succeed. Maximum value is 300000.

Examples

Minimal

The smallest valid compartment.yml — one service pointing at the repository root:
name: <project-slug>

services:
  web: .

Expanded

A multi-service project showing all available config options:
name: internal-tools

services:
  web:
    accessMode: public
    path: apps/web
    build:
      strategy: railpack
      command: pnpm build
      env:
        - VITE_PUBLIC_API_URL
      packages:
        build:
          - build-essential
        runtime:
          - libnss3
    run:
      command: pnpm start
      restart:
        policy: on-failure
    readiness:
      type: http
      path: /ready
      timeoutMs: 10000

  api:
    path: apps/api
    kind: api

  worker:
    path: apps/worker
    kind: worker

What compartment.yml does not own

compartment.yml is intentionally narrow in scope. The following concerns are managed separately:
  • Secrets — managed via the CLI, never committed to the repository
  • Environment-specific runtime values — set per environment using variables
  • Node placement — controlled by the Compartment platform
  • Hosted domains — configured via the CLI
  • Deployment history — recorded by the platform
  • Browser-facing proxy rules — defined in compartment.routes.yml
FilePurpose
compartment.routes.ymlBrowser-facing rewrites and proxy rules