graphite: make systemd create /run directory for us (#44392)
This commit is contained in:
parent
e103ad48ea
commit
5a43f6ffeb
|
@ -57,12 +57,6 @@ let
|
||||||
--nodaemon --syslog --prefix=${name} --pidfile /run/${name}/${name}.pid ${name}
|
--nodaemon --syslog --prefix=${name} --pidfile /run/${name}/${name}.pid ${name}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
mkPidFileDir = name: ''
|
|
||||||
mkdir -p /run/${name}
|
|
||||||
chmod 0700 /run/${name}
|
|
||||||
chown -R graphite:graphite /run/${name}
|
|
||||||
'';
|
|
||||||
|
|
||||||
carbonEnv = {
|
carbonEnv = {
|
||||||
PYTHONPATH = let
|
PYTHONPATH = let
|
||||||
cenv = pkgs.python.buildEnv.override {
|
cenv = pkgs.python.buildEnv.override {
|
||||||
|
@ -412,18 +406,16 @@ in {
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
environment = carbonEnv;
|
environment = carbonEnv;
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
|
RuntimeDirectory = name;
|
||||||
ExecStart = "${pkgs.pythonPackages.twisted}/bin/twistd ${carbonOpts name}";
|
ExecStart = "${pkgs.pythonPackages.twisted}/bin/twistd ${carbonOpts name}";
|
||||||
User = "graphite";
|
User = "graphite";
|
||||||
Group = "graphite";
|
Group = "graphite";
|
||||||
PermissionsStartOnly = true;
|
PermissionsStartOnly = true;
|
||||||
PIDFile="/run/${name}/${name}.pid";
|
PIDFile="/run/${name}/${name}.pid";
|
||||||
};
|
};
|
||||||
preStart = mkPidFileDir name + ''
|
preStart = ''
|
||||||
|
install -dm0700 -o graphite -g graphite ${cfg.dataDir}
|
||||||
mkdir -p ${cfg.dataDir}/whisper
|
install -dm0700 -o graphite -g graphite ${cfg.dataDir}/whisper
|
||||||
chmod 0700 ${cfg.dataDir}/whisper
|
|
||||||
chown graphite:graphite ${cfg.dataDir}
|
|
||||||
chown graphite:graphite ${cfg.dataDir}/whisper
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
@ -436,12 +428,12 @@ in {
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
environment = carbonEnv;
|
environment = carbonEnv;
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
|
RuntimeDirectory = name;
|
||||||
ExecStart = "${pkgs.pythonPackages.twisted}/bin/twistd ${carbonOpts name}";
|
ExecStart = "${pkgs.pythonPackages.twisted}/bin/twistd ${carbonOpts name}";
|
||||||
User = "graphite";
|
User = "graphite";
|
||||||
Group = "graphite";
|
Group = "graphite";
|
||||||
PIDFile="/run/${name}/${name}.pid";
|
PIDFile="/run/${name}/${name}.pid";
|
||||||
};
|
};
|
||||||
preStart = mkPidFileDir name;
|
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -452,12 +444,12 @@ in {
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
environment = carbonEnv;
|
environment = carbonEnv;
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
|
RuntimeDirectory = name;
|
||||||
ExecStart = "${pkgs.pythonPackages.twisted}/bin/twistd ${carbonOpts name}";
|
ExecStart = "${pkgs.pythonPackages.twisted}/bin/twistd ${carbonOpts name}";
|
||||||
User = "graphite";
|
User = "graphite";
|
||||||
Group = "graphite";
|
Group = "graphite";
|
||||||
PIDFile="/run/${name}/${name}.pid";
|
PIDFile="/run/${name}/${name}.pid";
|
||||||
};
|
};
|
||||||
preStart = mkPidFileDir name;
|
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue