Proposal: make systemd unit ordering configurable
Summary
Make systemd unit ordering configurable via template of WantedBy
/After
values in gitlab-runsvdir.service.
Proposal
In !2632 (merged) we changed the systemd unit's hard-coded ordering from basic.target
to multi-user.target
in an attempt to ensure that the service runs after the remote-fs
and network
targets to solve an issue seen by our own production infrastructure. Later, a user discovered that this change interacts poorly with cloud-init's own unit ordering, as used by AWS CloudFormation.
For many users, multi-user.target
is not a requirement, as there is no requirement for network storage to be online. While this setting covers the largest portion of our users, I propose that we make this a configurable item by converting the gitlab-runsvdir.service into a template. We should populate After=
and WantedBy=
via runit['systemd_after']
&& runit['systemd_wanted_by']
, with the defaults being multi-user.target
, and After=
being populated by the value of WantedBy
when not present.
This change would allow for direct customization to the users environment when absolutely needed, as seen by @ferricoxide. The majority of users would never see a difference in behavior, but highly customized or automated environments would greatly benefit.