Skip to content

Commit

Permalink
graphite: make systemd create /run directory for us
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhoeg authored and basvandijk committed Aug 3, 2018
1 parent 70e7235 commit 069a34a
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions nixos/modules/services/monitoring/graphite.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ let
--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 = {
PYTHONPATH = let
cenv = pkgs.python.buildEnv.override {
Expand Down Expand Up @@ -412,18 +406,16 @@ in {
after = [ "network.target" ];
environment = carbonEnv;
serviceConfig = {
RuntimeDirectory = name;
ExecStart = "${pkgs.pythonPackages.twisted}/bin/twistd ${carbonOpts name}";
User = "graphite";
Group = "graphite";
PermissionsStartOnly = true;
PIDFile="/run/${name}/${name}.pid";
};
preStart = mkPidFileDir name + ''
mkdir -p ${cfg.dataDir}/whisper
chmod 0700 ${cfg.dataDir}/whisper
chown graphite:graphite ${cfg.dataDir}
chown graphite:graphite ${cfg.dataDir}/whisper
preStart = ''
install -dm0700 -o graphite -g graphite ${cfg.dataDir}
install -dm0700 -o graphite -g graphite ${cfg.dataDir}/whisper
'';
};
})
Expand All @@ -436,12 +428,12 @@ in {
after = [ "network.target" ];
environment = carbonEnv;
serviceConfig = {
RuntimeDirectory = name;
ExecStart = "${pkgs.pythonPackages.twisted}/bin/twistd ${carbonOpts name}";
User = "graphite";
Group = "graphite";
PIDFile="/run/${name}/${name}.pid";
};
preStart = mkPidFileDir name;
};
})

Expand All @@ -452,12 +444,12 @@ in {
after = [ "network.target" ];
environment = carbonEnv;
serviceConfig = {
RuntimeDirectory = name;
ExecStart = "${pkgs.pythonPackages.twisted}/bin/twistd ${carbonOpts name}";
User = "graphite";
Group = "graphite";
PIDFile="/run/${name}/${name}.pid";
};
preStart = mkPidFileDir name;
};
})

Expand Down

0 comments on commit 069a34a

Please sign in to comment.