misc.etcd: get closer to upstream service definition
taken from https://github.com/coreos/etcd/blob/master/contrib/systemd/etcd.service I intentionally kept "After = network.target" because I think it's missing upstream (https://github.com/coreos/etcd/pull/6388)
This commit is contained in:
parent
23ca90b013
commit
5481831263
@ -143,9 +143,9 @@ in {
|
|||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
systemd.services.etcd = {
|
systemd.services.etcd = {
|
||||||
description = "Etcd Daemon";
|
description = "etcd key-value store";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "network-interfaces.target" ];
|
after = [ "network.target" ];
|
||||||
|
|
||||||
environment = (filterAttrs (n: v: v != null) {
|
environment = (filterAttrs (n: v: v != null) {
|
||||||
ETCD_NAME = cfg.name;
|
ETCD_NAME = cfg.name;
|
||||||
@ -168,12 +168,18 @@ in {
|
|||||||
ETCD_INITIAL_CLUSTER_TOKEN = cfg.initialClusterToken;
|
ETCD_INITIAL_CLUSTER_TOKEN = cfg.initialClusterToken;
|
||||||
}) // (mapAttrs' (n: v: nameValuePair "ETCD_${n}" v) cfg.extraConf);
|
}) // (mapAttrs' (n: v: nameValuePair "ETCD_${n}" v) cfg.extraConf);
|
||||||
|
|
||||||
|
unitConfig = {
|
||||||
|
Documentation = "https://github.com/coreos/etcd";
|
||||||
|
};
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "notify";
|
Type = "notify";
|
||||||
ExecStart = "${pkgs.etcd.bin}/bin/etcd";
|
ExecStart = "${pkgs.etcd.bin}/bin/etcd";
|
||||||
User = "etcd";
|
User = "etcd";
|
||||||
PermissionsStartOnly = true;
|
PermissionsStartOnly = true;
|
||||||
|
LimitNOFILE = 40000;
|
||||||
};
|
};
|
||||||
|
|
||||||
preStart = ''
|
preStart = ''
|
||||||
mkdir -m 0700 -p ${cfg.dataDir}
|
mkdir -m 0700 -p ${cfg.dataDir}
|
||||||
if [ "$(id -u)" = 0 ]; then chown etcd ${cfg.dataDir}; fi
|
if [ "$(id -u)" = 0 ]; then chown etcd ${cfg.dataDir}; fi
|
||||||
|
Loading…
Reference in New Issue
Block a user