Lawn Compose

Extensions

Health checks, environment metadata, notices, init files, and directories using x-lawn.
The catalog is community-driven. Want to add an app? Open a PR on GitHub. Support for custom catalogs from other sources is coming soon.

The Compose Specification allows custom x- prefixed keys as extensions. Lawn uses x-lawn at two levels:

  • Top-level — template-wide settings like config declarations and compatibility
  • Per-service — health checks, environment metadata, notices, directories, and init files

User-facing strings (descriptions, titles, labels, content) live in the localization file, not in the YAML template.

Compatibility

Declare the minimum Lawn version required to use this template. Lawn filters out templates whose minLawnVersion exceeds the running app version.

x-lawn:
  compatibility:
    minLawnVersion: 0.2.0
FieldDescription
minLawnVersionMinimum Lawn version required (e.g., 0.2.0)

Health Checks

Lawn-specific health checks that determine when a service is ready. These complement the standard healthcheck field from the Compose Specification. Each health check has an id used as a localization key.

services:
  app:
    x-lawn:
      healthChecks:
        - id: web-ui
          type: http
          path: /health
          expectedStatus: 200
          followRedirects: true

The description for each health check lives in locales/en.json under services.<svc>.healthChecks.<id>.description.

HTTP health checks:

FieldDefaultDescription
idUnique identifier (localization key)
typeMust be http
pathURI path to check
expectedStatus200Expected HTTP status code
followRedirectstrueFollow 3xx redirects

Command health checks:

services:
  db:
    x-lawn:
      healthChecks:
        - id: db-ready
          type: command
          command: ["/bin/sh", "-c", "pg_isready -U postgres"]

Timing fields (shared by both types):

FieldDefaultDescription
intervalSeconds30Seconds between checks
timeoutSeconds10Seconds before a check times out
retries3Failures before marking unhealthy
startPeriodSeconds60Grace period before checks begin

Environment Metadata

Metadata for environment variables declared in the service's environment: section. Provides format hints for validation.

services:
  db:
    environment:
      POSTGRES_USER: postgres
      POSTGRES_DB: app
    x-lawn:
      environment:
        POSTGRES_USER:
          format: string
        POSTGRES_DB:
          format: string

Environment entries can also be bare keys with no value — the key's presence registers the variable with Lawn, and descriptions come from the localization file:

x-lawn:
  environment:
    EULA:
    TZ:
    VERSION:
FieldDescription
formatValidation hint: string, integer, boolean, port, or url

Descriptions and group labels live in locales/en.json under services.<svc>.environment.<VAR>. See Localization for the full JSON structure.

Notices

Notices are dismissible banners shown on the instance detail panel after installation. Use them to surface important information: default credentials, required setup steps, or warnings about things users should not change.

Defining Notices

Notices are defined in a service's x-lawn.notices array. The YAML contains only structural fields — titles, labels, and content live in the localization file.

services:
  app:
    x-lawn:
      notices:
        - id: default-credentials
          style: info
          elements:
            - id: username
              type: field
              value: admin
            - id: password
              type: field
              source: ADMIN_PASSWORD
              container: app
            - id: setup-note
              type: text

The corresponding localization entry provides the user-facing strings:

{
  "services": {
    "app": {
      "notices": {
        "default-credentials": {
          "title": "Default Credentials",
          "elements": {
            "username": { "label": "Username" },
            "password": { "label": "Password" },
            "setup-note": { "content": "Change these in **Settings > Security** after your first login." }
          }
        }
      }
    }
  }
}

Notice Fields

FieldDescription
idUnique identifier (localization key and dismissal tracking)
styleinfo (blue) for general guidance, warning (orange) for critical actions
elementsList of content blocks, each with an id

Element Types

Text — Markdown content (provided via localization JSON):

- id: setup-note
  type: text

Field — Static label-value pair with a copy button:

- id: username
  type: field
  value: admin

Source field — Resolves the current value of an environment variable. Uses the same type: field as static fields, but includes source and container to look up the live value:

- id: password
  type: field
  source: ADMIN_PASSWORD
  container: app

The source field reads the resolved value of the named variable from the specified container, keeping credential notices accurate even after overrides. Labels for both static and source field elements come from the localization file.

Notice Guidelines

Keep notices to 2-3 per template maximum. Only surface information users genuinely need to act on — login credentials, required setup steps, or critical warnings. Users can dismiss notices and restore them from the instance menu.
  • Use info style for setup guidance and warning for critical actions
  • Notices are collected from all services in the compose file

Init Files

Init files are copied from the template into the container's volume mounts before each start. They're useful for configuration overrides that need to exist on disk when the container boots.

Init files are defined in a service's x-lawn.initFiles array:

services:
  app:
    x-lawn:
      initFiles:
        - source: "override.config.php"
          containerPath: "/var/www/html/config/override.config.php"
FieldDescription
sourceFilename in the template's init-files/ directory
containerPathAbsolute path inside the container

The containerPath must fall within a declared volume mount. Lawn resolves it to a host path using the volume mapping. For example, if the volume is ./www:/var/www and the containerPath is /var/www/html/config/foo.php, the file is written to {volume_host_path}/html/config/foo.php.

Init files are overwritten on every start. Do not expect user modifications to persist — the template always provides the latest version.

Create Directories

The x-lawn.createDirectories array lists host-side directories to create before the container starts. Paths follow the same conventions as volume host paths — relative paths resolve against the instance's data/ directory.

services:
  app:
    x-lawn:
      createDirectories:
        - "./data/uploads"
        - "./data/cache"

This is useful when a volume mount covers a parent directory but the container expects specific subdirectories to exist on first startup.