Page MenuHomePhabricator

Consider using BindsTo instead of Requires to declare dependencies between systemd unit
Open, LowPublic

Description

While working on T283660, @MMandere discovered the systemd setting BindsTo, documented here:

Configures requirement dependencies, very similar in style to Requires=. However, this dependency type is stronger: in addition to the effect of Requires= it declares that if the unit bound to is stopped, this unit will be stopped too.

We currently use Requires for quite a few units, including many services depending on varnish such as varnishfetcherr, varnishmtail, varnishospital, and various others. For all those services, the stricter guarantees of BindsTo seem to be more appropriate than Requires: if varnish is stopped, all those services stop operating correctly.

The list of services currently using Requires is:

  • codesearch-frontend
  • hound
  • fifo-log-demux
  • keyholder-proxy
  • ircecho
  • atsmtail
  • docker-service-shim
  • varnishfetcherr
  • varnishmtail
  • varnishospital
  • varnishslowlog
  • varnishtlsinspector
  • varnishkafka

For each service, we need to understand if Requires is the appropriate choice, or if BindsTo would be better instead.

Event Timeline

ema triaged this task as Low priority.Jun 8 2021, 12:31 PM

When we looked into this for the Bird-based anycast stuff, we found that the combination you want for strong service binding is both BindsTo= + After= on the same underlying service (cf https://www.freedesktop.org/software/systemd/man/systemd.unit.html ).

The swap of Traffic for Traffic-Icebox in this ticket's set of tags was based on a bulk action for all tickets that aren't are neither part of our current planned work nor clearly a recent, higher-priority emergent issue. This is simply one step in a larger task cleanup effort. Further triage of these tickets (and especially, organizing future potential project ideas from them into a new medium) will occur afterwards! For more detail, have a look at the extended explanation on the main page of Traffic-Icebox . Thank you!