Skip to content
Service Configuration

Service Configuration

Each service lives in a top-level directory inside the controller repository. A service directory contains composia-meta.yaml and one or more Docker Compose files.

Minimal service:

composia-meta.yaml
name: my-app
nodes:
  - main

With the default behavior, Composia looks for docker-compose.yaml in the same directory.

Top-level keys

KeyTypeRequiredDescription
namestringYesUnique service name.
project_namestringNoDocker Compose project name override. Defaults to a normalized service name.
compose_files[]stringNoCompose file paths relative to the service directory.
enabledboolNoWhether the service is active. Defaults to true.
nodes[]stringYesTarget node IDs. Each must exist in controller.nodes.
infraobjectNoDeclares this service as Caddy, Rustic, or config-only infrastructure.
networkobjectNoCaddy and DNS settings.
updateobjectNoImage update settings.
data_protectobjectNoBackup and restore data definitions.
backupobjectNoScheduled backups for protected data.
migrateobjectNoMigration-enabled protected data.
auto_deployboolNoAuto-deploy this service after repository changes.

compose_files entries must be relative paths, must stay inside the service directory, and must not be duplicated. All file references in composia-meta.yaml use repository filenames. An encrypted reference therefore includes .enc; Composia removes that suffix after decryption when the agent accesses the runtime file. References inside Compose files, Caddyfiles, scripts, and other native formats use the runtime filename without .enc.

Infrastructure services

infra.caddy

Declares the repository’s Caddy infrastructure service.

infra:
  caddy:
    compose_service: caddy
    config_dir: /etc/caddy
KeyTypeDescription
compose_servicestringCompose service name. Defaults to caddy.
config_dirstringCaddy config directory. Defaults to /etc/caddy.

Only one service can be declared as Caddy infrastructure.

infra.rustic

Declares the repository’s Rustic infrastructure service.

infra:
  rustic:
    compose_service: rustic
    profile: default
    data_protect_dir: /data-protect
    init_args:
      - --set-version
      - "2"
KeyTypeDescription
compose_servicestringCompose service name. Defaults to rustic.
profilestringRustic profile name.
data_protect_dirstringContainer path mapped to the agent’s {StateDir}/data-protect.
init_args[]stringExtra args passed to rustic init. Empty entries are rejected.

Only one service can be declared as Rustic infrastructure.

infra.config

Declares a config-only infrastructure service.

infra:
  config: {}

Config-only services cannot be combined with infra.caddy or infra.rustic. Their data_protect actions can only use files.copy.

Network

network.caddy

network:
  caddy:
    enabled: true
    source: Caddyfile
KeyTypeRequiredDescription
enabledboolNoEnables Caddy management. Defaults to false.
sourcestringCond.Caddyfile path relative to the service directory. Required when enabled.

network.dns

network:
  dns:
    - hostname: app.example.com
      record_type: A
      value: 203.0.113.10
    - hostname: app.example.com
      record_type: AAAA
      value: 2001:db8::10
KeyTypeRequiredDescription
providerstringNocloudflare, alidns, dnspod, route53, or huaweicloud. It can be inferred from the configured zone.
hostnamestringYesDNS hostname.
record_typestringNoEmpty, A, AAAA, or CNAME.
valuestringNoDNS record value. Multi-node services should set this explicitly.
proxiedboolNoProvider-specific proxy toggle, currently relevant for Cloudflare.
ttluint32NoDNS TTL.
commentstringNoDNS record comment.

A service can define any number of DNS records. The same hostname may use different record types such as A and AAAA; duplicate hostname + record type entries and combining CNAME with other types are rejected.

Image updates

update:
  enabled: true
  auto_apply: false
  check_schedule: "0 */6 * * *"
  backup_before_update: true
  digest_pin: false
  backup_data:
    - name: db
      enabled: true
  discovery_sources:
    upstream:
      sources:
        - type: github
          repo: owner/repo
      combine: first_success
      include_prerelease: false
  images:
    app:
      image: ghcr.io/example/app
      current:
        env:
          file: .env
          key: APP_VERSION
      discovery: upstream
      filter:
        type: semver
        allow:
          - patch
          - minor

update

KeyTypeDescription
enabledboolEnables update checks for this service.
auto_applyboolApply detected updates automatically.
check_schedulestringCron schedule for update checks.
backup_before_updateboolRun backups before applying updates.
backup_data[]objectProtected data items to back up before update.
digest_pinboolPin images by digest.
discovery_sourcesmap[string]objectReusable discovery sources. Named sources cannot reference another source.
imagesmap[string]objectPer-image update definitions.

update.backup_data[]

KeyTypeDescription
namestringProtected data item name.
enabledboolInclude or exclude this item.

update.images.<name>

KeyTypeRequiredDescription
imagestringYesImage repository.
auto_applyboolNoPer-image auto-apply override.
check_schedulestringNoPer-image check schedule.
backup_before_updateboolNoPer-image backup toggle.
digest_pinboolNoPer-image digest pin toggle.
currentobjectYesCurrent version source.
discoveryobject or stringYesDiscovery config or named discovery source reference.
filterobjectCond.Required unless discovery is digest.

current

Specify exactly one of:

KeyDescription
tagStatic current tag.
env.file + env.keyRead current tag from an env file. file must be relative and stay inside the service directory.
yaml.file + yaml.pathRead current tag from a YAML file. file must be relative and stay inside the service directory.

discovery

KeyTypeDescription
sources[]objectAt least one source.
combinestringEmpty, merge, or first_success.
include_prereleaseboolInclude prerelease versions.

Discovery source types:

TypeRequired keysNotes
autoNonerepo_url is optional and must be a valid URL if set. Must be the only source.
probeNoneRequires semver filter when a filter is present.
registryNoneRegistry tag discovery.
digestNoneMust be the only source. filter must be omitted.
githubreporepo is owner/repo.
gitlabprojectGitLab project ID or path.
forgejoreporepo is owner/repo.

filter

TypeRequired keysNotes
semverNoneallow may contain patch, minor, major.
dateformatDate format used to parse tags.
regexpattern, orderorder must be numeric or lexicographic.
latestNoneUses the latest candidate.

Data protection

data_protect:
  data:
    - name: db
      backup:
        strategy: database.pgdumpall
        service: postgres
        user: app
      restore:
        strategy: database.pgimport
        service: postgres
        user: app
    - name: uploads
      backup:
        strategy: files.copy_after_stop
        include:
          - ./uploads
      restore:
        strategy: files.copy
        include:
          - ./uploads

data_protect.data[]

KeyTypeRequiredDescription
namestringYesUnique data item name.
backupobjectNoBackup action.
restoreobjectNoRestore action.

Data action

KeyTypeRequiredDescription
strategystringYesfiles.copy, files.copy_after_stop, database.pgdumpall, or database.pgimport.
servicestringCond.Required for database.* strategies. Compose service name.
userstringNoPostgreSQL role passed to pg_dumpall or psql. If omitted, Composia checks the resolved service environment for PGUSER, POSTGRES_USER, POSTGRESQL_USERNAME, then POSTGRESQL_USER, in that order.
include[]stringCond.Required for files.* strategies. Use ./... or paths containing / for service paths; bare names are Docker volume names.

Backups

backup:
  data:
    - name: db
      provider: rustic
      enabled: true
      schedule: "0 2 * * *"
KeyTypeRequiredDescription
namestringYesMust reference a data_protect.data[].name with a backup action.
providerstringNoBackup provider name.
enabledboolNoEnable or disable this backup entry.
schedulestringNoCron schedule.

Migration

migrate:
  data:
    - name: db
      enabled: true
KeyTypeRequiredDescription
namestringYesMust reference a data_protect.data[].name with both backup and restore actions.
enabledboolNoEnable or disable migration for this item.
Last updated on • alexma233