For the complete documentation index, see llms.txt. This page is also available as Markdown.

Example

End-to-end Service examples for common deployment patterns.

Use this page for complete Service manifests and related resources.

TCP Postgres Service with inline disk

This example runs Postgres as a stateful TCP Service. The disk block provisions storage mounted at /var/lib/postgresql/data. The disk is tied to the Service lifecycle.

name: ${TCP_PG_SECRET_NAME}
version: v2alpha
type: secret
description: "Password for TCP Postgres service"
layer: user
secret:
  type: key-value
  data:
    POSTGRES_PASSWORD: ${TCP_PG_PASSWORD}
version: v2alpha
name: ${TCP_PG_SERVICE_NAME}
type: service
tags:
  - postgres
  - database
  - test
description: "Single replica stateful Postgres service for TCP connectivity test"
spec:
  hostname: ${TCP_PG_SERVICE_NAME}
  compute: ${COMPUTE_NAME}
  stateful: true
  replicas: 1
  servicePorts:
    - name: postgres
      port: 5432
  resources:
    requests:
      cpu: 250m
      memory: 512Mi
    limits:
      cpu: "1"
      memory: 1Gi
  disk:
    size: 10Gi
    type: disk
    mountPath: /var/lib/postgresql/data
  use:
    projection:
      templateType: liquid
      secrets:
        - id: ${ENTITY_TENANT_ID}:${TCP_PG_SECRET_NAME}
          contextAlias: pgSecret
      projections:
        envVars:
          - key: POSTGRES_PASSWORD
            template: "{{ secrets['pgSecret'].POSTGRES_PASSWORD }}"
          - key: POSTGRES_USER
            templateType: none
            template: "postgres"
          - key: POSTGRES_DB
            templateType: none
            template: "postgres"
          - key: PGDATA
            templateType: none
            template: "/var/lib/postgresql/data/pgdata"
  stack: container
  stackSpec:
    image: docker.io/library/postgres:18-alpine
    command:
      - docker-entrypoint.sh
    arguments:
      - postgres

TCP Postgres Service with existing Volume

Use use.volumes when the database files must live in a Volume Resource whose lifecycle is managed separately from the Service.

version: v2alpha
name: ${TCP_PG_SERVICE_NAME}vol
type: service
tags:
  - postgres
  - database
  - test
description: "Single replica stateful Postgres service for TCP connectivity test"
spec:
  hostname: ${TCP_PG_SERVICE_NAME}vol
  compute: ${COMPUTE_NAME}
  stateful: true
  replicas: 1
  servicePorts:
    - name: postgres
      port: 5432
  resources:
    requests:
      cpu: 250m
      memory: 512Mi
    limits:
      cpu: "1"
      memory: 1Gi
  use:
    volumes:
      - id: ${TCP_PG_VOLUME_ID}
        directory: /var/lib/postgresql/data
        readOnly: false
    projection:
      templateType: liquid
      secrets:
        - id: ${ENTITY_TENANT_ID}:${TCP_PG_SECRET_NAME}vol
          contextAlias: pgSecret
      projections:
        envVars:
          - key: POSTGRES_PASSWORD
            template: "{{ secrets['pgSecret'].POSTGRES_PASSWORD }}"
          - key: POSTGRES_USER
            templateType: none
            template: "postgres"
          - key: POSTGRES_DB
            templateType: none
            template: "postgres"
          - key: PGDATA
            templateType: none
            template: "/var/lib/postgresql/data/pgdata"
  stack: container
  stackSpec:
    image: docker.io/library/postgres:18-alpine
    command:
      - docker-entrypoint.sh
    arguments:
      - postgres

Deploy with a Bundle

For Services that depend on Secrets, Volumes, or verification Workflows, package the resources in a Bundle so dependencies are applied in order.

Last updated

Was this helpful?