8.2 KiB
Distributor Configuration
Config File Location
distributor run --config <path> loads the YAML config at the provided path.
If --config is omitted, run uses:
/usr/local/etc/distributor/config.yml
Config parsing rejects unknown YAML fields. The executable backends are local, ssh, and s3.
Minimal Local Config
pipelines:
- id: reports
source:
backend: local
path: /var/spool/distributor/reports
destinations:
- id: archive
backend: local
path: /srv/reports/archive
This publishes source files only. It uses the default validation and transfer policies.
Production-Oriented Local Config
pipelines:
- id: reports
source:
backend: local
path: /var/spool/distributor/reports
validation:
on_digest_mismatch: fail
destinations:
- id: archive
backend: local
path: /srv/reports/archive
publish:
source: true
html: false
transfer:
on_destination_same: skip
on_destination_older: replace
on_destination_newer: skip
on_conflict: fail
HTML Publication
To publish generated HTML from Markdown files:
publish:
source: false
html: true
transform:
markdown_to_html:
enabled: true
mode: sidecar
Sidecar generation writes report.html for report.md. It does not mutate the source bundle.
Reference
Top level:
secrets.directory: optional credential secrets directory.pipelines: required non-empty list.
Pipeline:
id: required unique slug-like identifier.source: required backend config.validation.on_digest_mismatch: optional; defaults tofail; onlyfailis supported.destinations: required non-empty destination list.
Source backend:
backend: required.path: required forlocalandssh.host: required forssh.user: optional forssh; defaults to the current OS user when available.port: optional forssh; defaults to22.ssh_key_file: optional forssh.known_hosts: optional forssh; defaults to the service user's OpenSSHknown_hostspath when available.host_key_policy: optional forssh; defaults toaccept-new.endpoint: required fors3.bucket: required fors3.prefix: optional fors3; leading and trailing slashes are trimmed.region: optional fors3; defaults tous-east-1.force_path_style: optional fors3; defaults totrue. Setfalseonly for services that require virtual-host addressing.credentials.access_key_id_env: optional S3 credential environment variable name.credentials.secret_access_key_env: optional S3 credential environment variable name.
Destination:
id: required unique slug-like identifier within the pipeline.- Backend fields: same accepted shape as source backends, with destination fields at the destination level.
publish: optional; defaults to source-only publication.transform: required only for generated HTML publication.transfer: optional; defaults described below.
Accepted backend names:
local: executable; requirespath.ssh: executable; requireshostandpath.s3: executable; requiresendpointandbucket.
SSH Backend
SSH uses native SFTP. It can be used for sources, destinations, or both:
backend: ssh
host: example.com
user: distributor
port: 2222
path: /remote/root
ssh_key_file: /home/distributor/.ssh/id_ed25519
known_hosts: /home/distributor/.ssh/known_hosts
host_key_policy: accept-new
Authentication uses SSH agent identities first when SSH_AUTH_SOCK is set, then ssh_key_file if configured. Password authentication in YAML is not supported.
Host key policies:
strict,true, and"true"require a matching known host key.accept-newaccepts and persists a new host key, but fails if an existing key changed. Duringrun --dry-run, new host keys are accepted only for the current connection and are not persisted.off,false, and"false"disable host key checking and are insecure.
accept-new and strict use known_hosts when configured. If omitted, distributor uses the current service user's default OpenSSH known_hosts path where practical. accept-new fails when it needs to persist a new host key and no writable known_hosts path is available. It does not create a missing parent .ssh directory.
S3 Backend
S3 uses the AWS SDK for Go v2 and supports S3-compatible endpoints:
backend: s3
endpoint: https://s3.example.com
bucket: reports
prefix: archive
region: us-east-1
force_path_style: true
credentials:
access_key_id_env: DISTRIBUTOR_S3_ACCESS_KEY_ID
secret_access_key_env: DISTRIBUTOR_S3_SECRET_ACCESS_KEY
endpoint and bucket are required. prefix is an optional backend root; it is treated as an object-key prefix, not a real directory. Prefixes must be clean slash-separated paths after trimming leading and trailing slashes. http:// endpoints are allowed for explicitly configured local development or local S3-compatible test services.
If either credential environment variable name is configured, both must be configured and both referenced variables must resolve to non-empty values through the real process environment or secrets.directory. Explicit credentials take precedence over the AWS SDK default credential chain. If credential environment variable names are omitted, the SDK default credential chain is used and secrets.directory values are not injected into the process environment.
Publish policy:
publish.source: publish source artifacts.publish.html: publish generated HTML artifacts from Markdown source files.
At least one output type must be enabled. When publish.html is true, transform.markdown_to_html.enabled must be true and transform.markdown_to_html.mode must be sidecar.
Transfer policy:
transfer.on_destination_same:skiporfail; defaults toskip.transfer.on_destination_older:replaceorfail; defaults toreplace.transfer.on_destination_newer:skip,replace, orfail; defaults toskip.transfer.on_conflict:failorreplace; defaults tofail.
replace for on_destination_newer and on_conflict is honored only when run --force is used for that invocation. Force is CLI-only; there is no persistent config field that enables forced replacement by default.
Defaults
Defaults are applied after YAML decoding and before validation:
validation.on_digest_mismatch: fail- SSH
port: 22 - SSH
host_key_policy: accept-new - S3
region: us-east-1 - S3
force_path_style: true publish.source: truepublish.html: falsetransfer.on_destination_same: skiptransfer.on_destination_older: replacetransfer.on_destination_newer: skiptransfer.on_conflict: fail
Secrets
Do not put literal secrets in config files. secrets.directory lets deployments provide credential values as files:
secrets:
directory: /run/secrets/distributor
Each regular file in the directory becomes an internal credential environment value named by the filename. Valid filenames must match [A-Za-z_][A-Za-z0-9_]*. Directories are ignored, and symlinks to regular files are followed. Exactly one trailing LF or CRLF is trimmed from each file; other whitespace is preserved.
The resolver checks the real process environment first, then the secrets directory. If both define the same variable with different values, run prints a warning with the variable name and uses the real environment value. Secret values are not printed. The process environment is not modified, so SDK default credential chains see only real environment variables.
S3 credentials may name environment variables:
credentials.access_key_id_envcredentials.secret_access_key_env
Examples
Maintained examples live under examples:
local-to-local.yml: minimal local config.local-publish.yml: runnable local source publication.local-html.yml: runnable local HTML publication.fan-out.yml: runnable local fan-out publication to source and HTML destinations.ssh-destination.yml: environment-gated local-to-SSH publication example.s3-destination.yml: environment-gated local-to-S3 publication example.