Skip to content

Split the configuration into files

providers.file.paths since v0.2 adds the objects of more files to rdock.yaml: one file per site or team, generated files next to hand-written ones, and so on.

rdock.yaml
listeners:
web: { address: ":80" }
defaults:
listeners: [web]
tls: off
providers:
file:
paths: ["conf.d/*.yaml"]
middlewares:
secure-headers:
type: headers
response:
set:
X-Content-Type-Options: nosniff
conf.d/blog.yaml
routes:
blog:
match: "Host(`blog.example.com`)"
service: blog
middlewares: [secure-headers]
services:
blog:
backends: [{ address: "blog:2368" }]
  • A path is a file or a pattern; * and ? may appear in the file name, not in directories. Relative paths start at the main file’s directory.
  • Extra files may hold routes, services, middlewares, tcp_routes, tcp_services and certificates. Listeners, defaults and every other setting stay in the main file.
  • All files form one configuration: objects refer to each other by name across files, as secure-headers above.
  • A name defined in two files is an error that names both files, and the whole configuration is refused; the previous one keeps serving.
  • A missing file named exactly is an error. A pattern that matches nothing is not, so conf.d/ can start empty.
  • Files whose names start with . match only patterns that start with ., so editors’ temporary files are skipped.
  • Changes are applied like changes to the main file: on save, with SIGHUP or rdock reload. A file added to or removed from a pattern’s directory counts as a change, even when the directory is created after ReverseDock starts. providers.file.watch: false turns watching off.
  • rdock validate rdock.yaml reads the extra files too.