Make Apache wait for ‘charon send-keys’

(This is a no-op on non-Charon deployments since the ‘keys.target’
unit won't have any dependencies.)
This commit is contained in:
Eelco Dolstra 2012-11-01 23:32:12 +01:00
parent dd7edefb2c
commit 48a0ea0513
2 changed files with 11 additions and 10 deletions

View File

@ -580,11 +580,12 @@ in
date.timezone = "${config.time.timeZone}" date.timezone = "${config.time.timeZone}"
''; '';
jobs.httpd = boot.systemd.services.httpd =
{ description = "Apache HTTPD"; { description = "Apache HTTPD";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "network.target" "fs.target" "postgresql.service" ]; requires = [ "keys.target" ];
after = [ "network.target" "fs.target" "postgresql.service" "keys.target" ];
path = path =
[ httpd pkgs.coreutils pkgs.gnugrep ] [ httpd pkgs.coreutils pkgs.gnugrep ]
@ -596,9 +597,7 @@ in
environment = environment =
{ PHPRC = if enablePHP then phpIni else ""; { PHPRC = if enablePHP then phpIni else "";
TZ = config.time.timeZone; TZ = config.time.timeZone;
} // (listToAttrs (concatMap (svc: svc.globalEnvVars) allSubservices)); } // (listToAttrs (concatMap (svc: svc.globalEnvVars) allSubservices));
preStart = preStart =
@ -628,12 +627,9 @@ in
done done
''; '';
exec = "httpd -f ${httpdConf} -DNO_DETACH"; serviceConfig.ExecStart = "@${httpd}/bin/httpd httpd -f ${httpdConf} -DNO_DETACH";
serviceConfig.ExecStop = "${httpd}/bin/httpd -f ${httpdConf} -k graceful-stop";
preStop = serviceConfig.Restart = "always";
''
${httpd}/bin/httpd -f ${httpdConf} -k graceful-stop
'';
}; };
}; };

View File

@ -442,6 +442,11 @@ in
} }
]; ];
# Target for charon send-keys to hook into.
boot.systemd.targets.keys =
{ description = "Security Keys";
};
boot.systemd.units = boot.systemd.units =
{ "rescue.service".text = rescueService; } { "rescue.service".text = rescueService; }
// mapAttrs' (n: v: nameValuePair "${n}.target" (targetToUnit n v)) cfg.targets // mapAttrs' (n: v: nameValuePair "${n}.target" (targetToUnit n v)) cfg.targets