modules: use consul-ready when waiting for consul
This commit is contained in:
parent
d2ab37f3b1
commit
9aa1f29e24
3 changed files with 10 additions and 3 deletions
|
@ -87,7 +87,8 @@ in
|
|||
description = "Ascension for ${name}";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
inherit (asc) requiredBy before;
|
||||
after = asc.after ++ (lib.optional asc.distributed "consul.service");
|
||||
after = asc.after ++ (lib.optional asc.distributed "consul-ready.service");
|
||||
requires = lib.optional asc.distributed "consul-ready.service";
|
||||
serviceConfig.Type = "oneshot";
|
||||
distributed.enable = asc.distributed;
|
||||
script = ''
|
||||
|
|
|
@ -42,6 +42,10 @@ in
|
|||
|
||||
hasSpecialPrefix = elem (substring 0 1 ExecStart) [ "@" "-" ":" "+" "!" ];
|
||||
in assert !hasSpecialPrefix; pkgs.writeTextDir "etc/systemd/system/${n}.service.d/distributed.conf" ''
|
||||
[Unit]
|
||||
Requires=consul-ready.service
|
||||
After=consul-ready.service
|
||||
|
||||
[Service]
|
||||
ExecStartPre=${waitForConsul} 'services/${n}%i'
|
||||
ExecStart=
|
||||
|
|
|
@ -81,14 +81,16 @@ let
|
|||
}.${mode};
|
||||
value = {
|
||||
direct = {
|
||||
after = [ "consul.service" ];
|
||||
after = [ "consul-ready.service" ];
|
||||
requires = [ "consul-ready.service" ];
|
||||
serviceConfig = {
|
||||
ExecStartPost = register servicesJson;
|
||||
ExecStopPost = deregister servicesJson;
|
||||
};
|
||||
};
|
||||
external = {
|
||||
after = [ "consul.service" "${unit}.service" ];
|
||||
after = [ "consul-ready.service" "${unit}.service" ];
|
||||
requires = [ "consul-ready.service" ];
|
||||
wantedBy = [ "${unit}.service" ];
|
||||
unitConfig.BindsTo = "${unit}.service";
|
||||
serviceConfig = {
|
||||
|
|
Loading…
Reference in a new issue