I am wondering what everyone’s approach is to making compose files well-formatted, re-usable and optimally configured - also in regard to individual properties and values of service definitions.
I have a placement constraint on some of my services, to avoid specific worker nodes, e.g.:
placement: constraints: - node.role == worker - node.hostname != worker3 - node.hostname != worker4
But I couldn’t find anywhere in the documentation if that’s the best way of defining multiple values for the hostname constraint. Could I use comma-separated values instead of one line for each?
Or should I define an
avoidWorkers array at the top of my file and then somehow refer to that in the constraint?
More generally, how much yaml cleverness do you use in your compose files, and what do you regard as best practices when setting configurations?