Reference / component / v1.3.0

component examples

Every example below is validated against the schema on this page in CI, so an example that does not validate fails the build rather than shipping.

build-from-git.yaml

specVersion: v1
kind: COMPONENT
metadata:
  revision: 1
  description: Web application built from its Git repository with a Dockerfile.
spec:
  type: SERVICE
  workload:
    source:
      git:
        repositoryURL: https://github.com/musher-dev/examples
        ref:
          branch: main
        build:
          dockerfile: Dockerfile
          arguments:
            NODE_ENV: production
    command:
      - node
      - server.js
    endpoints:
      web:
        targetPort: 8080
        protocol: HTTP
    health:
      readiness:
        http:
          endpoint: web
          path: /healthz
        periodSeconds: 10
        failureThreshold: 3

external-endpoint.yaml

specVersion: v1
kind: COMPONENT
metadata:
  revision: 1
  description: Managed PostgreSQL database run by a provider outside this platform and addressed by its host.
spec:
  type: EXTERNAL
  contract:
    inputs:
      host:
        description: Hostname of the managed database server.
        schema:
          type: string
        presentationHint: HOSTNAME
      port:
        description: Port the managed database server listens on.
        schema:
          type: integer
          minimum: 1
          maximum: 65535
        default: 5432
      database:
        description: Name of the database the application uses.
        schema:
          type: string
      username:
        description: Role the application connects as.
        schema:
          type: string
      password:
        description: Password of the application role.
        schema:
          type: string
        sensitive: true
    outputs:
      host:
        description: Hostname of the managed database server, for a client to connect to.
        schema:
          type: string
        presentationHint: HOSTNAME
        from:
          input: host
      port:
        description: Port the managed database server listens on.
        schema:
          type: integer
        from:
          input: port
      database:
        description: Name of the database the application uses.
        schema:
          type: string
        from:
          input: database
      username:
        description: Role the application connects as.
        schema:
          type: string
        from:
          input: username
      password:
        description: Password of the application role.
        schema:
          type: string
        sensitive: true
        from:
          input: password
      sslMode:
        description: TLS mode a client uses; the provider accepts only verified connections.
        schema:
          type: string
        from:
          value: verify-full

llm-worker.yaml

specVersion: v1
kind: COMPONENT
metadata:
  revision: 1
  description: Background worker that answers queued requests with a language model it reaches through three ordinary inputs.
spec:
  type: WORKER
  workload:
    source:
      image: ghcr.io/musher-dev/assistant-worker:2.3.0
  contract:
    inputs:
      llmBaseURL:
        description: Base URL of the language-model API.
        schema:
          type: string
        presentationHint: ENDPOINT_URL
        target:
          envVarKey: OPENAI_BASE_URL
      llmAPIKey:
        description: Credential presented to the language-model API.
        schema:
          type: string
        sensitive: true
        target:
          envVarKey: OPENAI_API_KEY
      llmModel:
        description: Model the language-model API answers with.
        schema:
          type: string
        target:
          envVarKey: OPENAI_MODEL
    outputs: {}

minimal.yaml

specVersion: v1
kind: COMPONENT
metadata:
  revision: 1
  description: Static web server with one HTTP endpoint.
spec:
  type: SERVICE
  workload:
    source:
      image: nginx:1.29.4-alpine
    endpoints:
      web:
        targetPort: 8080
        protocol: HTTP

multi-endpoint.yaml

specVersion: v1
kind: COMPONENT
metadata:
  revision: 1
  description: RabbitMQ message broker with an AMQP listener, a management console and HTTP API, and a Prometheus metrics endpoint.
spec:
  type: SERVICE
  workload:
    source:
      image: rabbitmq:4.1.4-management-alpine
    endpoints:
      amqp:
        targetPort: 5672
        protocol: TCP
      console:
        targetPort: 15672
        protocol: HTTP
      metrics:
        targetPort: 15692
        protocol: HTTP
    health:
      readiness:
        http:
          endpoint: metrics
          path: /metrics
    volumes:
      data:
        mountPath: /var/lib/rabbitmq
        minSizeGiB: 5
  contract:
    inputs:
      username:
        description: Name of the user the broker creates on first start.
        schema:
          type: string
          minLength: 1
        default: app
        target:
          envVarKey: RABBITMQ_DEFAULT_USER
      password:
        description: Password of the user the broker creates on first start.
        schema:
          type: string
          minLength: 12
        sensitive: true
        target:
          envVarKey: RABBITMQ_DEFAULT_PASS
    outputs:
      consoleURL:
        description: Public URL of the management console, for an operator to sign in at.
        schema:
          type: string
        presentationHint: ENDPOINT_URL
        from:
          endpoint: console
          property: publicURL
      apiURL:
        description: Base URL of the management HTTP API, for sibling nodes that declare queues.
        schema:
          type: string
        presentationHint: ENDPOINT_URL
        from:
          template: "http://${{ self.endpoints.console.privateAddress }}/api"
      wireAddress:
        description: Internal host and port of the AMQP listener, for sibling nodes that publish or consume.
        schema:
          type: string
        from:
          endpoint: amqp
          property: privateAddress
      username:
        description: Name of the broker user a client authenticates as.
        schema:
          type: string
          minLength: 1
        from:
          input: username
      password:
        description: Password of the broker user a client authenticates as.
        schema:
          type: string
          minLength: 12
        sensitive: true
        from:
          input: password

openai-chat.yaml

specVersion: v1
kind: COMPONENT
metadata:
  revision: 1
  description: Language-model API reached through an organization connection, handing its endpoint, credential and model to the nodes that call it.
spec:
  type: EXTERNAL
  contract:
    inputs:
      llm:
        description: Language-model connection this node stands for.
        connection:
          protocol: OPENAI_CHAT_COMPLETIONS
          capabilities:
            - STREAMING
            - TOOL_CALLS
    outputs:
      baseURL:
        description: Base URL of the language-model API.
        schema:
          type: string
        presentationHint: ENDPOINT_URL
        from:
          input: llm
          member: baseURL
      apiKey:
        description: Credential the language-model API accepts.
        schema:
          type: string
        sensitive: true
        from:
          input: llm
          member: apiKey
      model:
        description: Model the language-model API answers with.
        schema:
          type: string
        from:
          input: llm
          member: model

queue-worker.yaml

specVersion: v1
kind: COMPONENT
metadata:
  revision: 1
  description: Queue consumer with a private health endpoint the platform probes; it serves no traffic of its own.
spec:
  type: WORKER
  workload:
    source:
      image: ghcr.io/musher-dev/worker:1.4.0
    command:
      - /bin/consume
      - --queue
      - default
    endpoints:
      health:
        targetPort: 8081
        protocol: HTTP
    health:
      readiness:
        http:
          endpoint: health
          path: /readyz
      liveness:
        http:
          endpoint: health
          path: /healthz
        failureThreshold: 5
  contract:
    inputs:
      queueURL:
        description: Address of the queue the worker consumes.
        schema:
          type: string
        presentationHint: CONNECTION_STRING
        sensitive: true
        target:
          envVarKey: QUEUE_URL
    outputs: {}

scheduled-job.yaml

specVersion: v1
kind: COMPONENT
metadata:
  revision: 1
  description: Nightly database backup that runs at 03:00 UTC and writes to a persistent volume.
spec:
  type: JOB
  workload:
    source:
      image: ghcr.io/musher-dev/backup:1.0.2
    command:
      - /bin/backup
      - --verify
    schedule:
      cron: "0 3 * * *"
    volumes:
      archive:
        mountPath: /var/backups
        minSizeGiB: 20
  contract:
    inputs:
      databaseURL:
        description: Connection URL of the database to back up.
        schema:
          type: string
        presentationHint: CONNECTION_STRING
        sensitive: true
        target:
          envVarKey: DATABASE_URL
    outputs: {}

service-with-contract.yaml

specVersion: v1
kind: COMPONENT
metadata:
  revision: 1
  description: PostgreSQL database with a single persistent data volume.
spec:
  type: SERVICE
  workload:
    source:
      image: postgres:17.10-alpine
    endpoints:
      primary:
        targetPort: 5432
        protocol: TCP
    volumes:
      data:
        mountPath: /var/lib/postgresql/data
        minSizeGiB: 10
  contract:
    inputs:
      postgresPassword:
        description: Password the database superuser is created with.
        schema:
          type: string
        required: true
        target:
          envVarKey: POSTGRES_PASSWORD
        sensitive: true
      databaseName:
        description: Name of the database created on first start.
        schema:
          type: string
        default: app
        target:
          envVarKey: POSTGRES_DB
      dataDirectory:
        description: Directory inside the data volume PostgreSQL keeps its files in.
        schema:
          type: string
        default: /var/lib/postgresql/data/pgdata
        target:
          envVarKey: PGDATA
    outputs:
      address:
        description: Internal host and port clients reach the database at.
        schema:
          type: string
        from:
          endpoint: primary
          property: privateAddress