graphite: fix carbonCache graphiteWeb graphiteApi
This commit implements the changes necessary to start up a graphite carbon Cache with twisted and start the corresponding graphiteWeb service. Dependencies need to be included via python buildEnv to include all recursive implicit dependencies. Additionally cairo is a requirement of graphiteWeb and pycairo is not a standard python package (buildPythonPackage) and therefore cannot be included via buildEnv. It also needs cairo in the Library PATH.
This commit is contained in:
parent
5e6798d7b7
commit
626bfce3b8
|
@ -51,7 +51,13 @@ let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
carbonEnv = {
|
carbonEnv = {
|
||||||
PYTHONPATH = "${pkgs.python27Packages.carbon}/lib/python2.7/site-packages";
|
PYTHONPATH = let
|
||||||
|
cenv = pkgs.python.buildEnv.override {
|
||||||
|
extraLibs = [ pkgs.python27Packages.carbon ];
|
||||||
|
};
|
||||||
|
cenvPack = "${cenv}/${pkgs.python.sitePackages}";
|
||||||
|
# opt/graphite/lib contains twisted.plugins.carbon-cache
|
||||||
|
in "${cenvPack}/opt/graphite/lib:${cenvPack}";
|
||||||
GRAPHITE_ROOT = dataDir;
|
GRAPHITE_ROOT = dataDir;
|
||||||
GRAPHITE_CONF_DIR = configDir;
|
GRAPHITE_CONF_DIR = configDir;
|
||||||
GRAPHITE_STORAGE_DIR = dataDir;
|
GRAPHITE_STORAGE_DIR = dataDir;
|
||||||
|
@ -445,10 +451,21 @@ in {
|
||||||
after = [ "network-interfaces.target" ];
|
after = [ "network-interfaces.target" ];
|
||||||
path = [ pkgs.perl ];
|
path = [ pkgs.perl ];
|
||||||
environment = {
|
environment = {
|
||||||
PYTHONPATH = "${pkgs.python27Packages.graphite_web}/lib/python2.7/site-packages";
|
PYTHONPATH = let
|
||||||
|
penv = pkgs.python.buildEnv.override {
|
||||||
|
extraLibs = [
|
||||||
|
pkgs.python27Packages.graphite_web
|
||||||
|
pkgs.python27Packages.pysqlite
|
||||||
|
];
|
||||||
|
};
|
||||||
|
penvPack = "${penv}/${pkgs.python.sitePackages}";
|
||||||
|
# opt/graphite/webapp contains graphite/settings.py
|
||||||
|
# explicitly adding pycairo in path because it cannot be imported via buildEnv
|
||||||
|
in "${penvPack}/opt/graphite/webapp:${penvPack}:${pkgs.pycairo}/${pkgs.python.sitePackages}";
|
||||||
DJANGO_SETTINGS_MODULE = "graphite.settings";
|
DJANGO_SETTINGS_MODULE = "graphite.settings";
|
||||||
GRAPHITE_CONF_DIR = configDir;
|
GRAPHITE_CONF_DIR = configDir;
|
||||||
GRAPHITE_STORAGE_DIR = dataDir;
|
GRAPHITE_STORAGE_DIR = dataDir;
|
||||||
|
LD_LIBRARY_PATH = "${pkgs.cairo}/lib";
|
||||||
};
|
};
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = ''
|
ExecStart = ''
|
||||||
|
@ -486,9 +503,11 @@ in {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "network-interfaces.target" ];
|
after = [ "network-interfaces.target" ];
|
||||||
environment = {
|
environment = {
|
||||||
PYTHONPATH =
|
PYTHONPATH = let
|
||||||
"${cfg.api.package}/lib/python2.7/site-packages:" +
|
aenv = pkgs.python.buildEnv.override {
|
||||||
concatMapStringsSep ":" (f: f + "/lib/python2.7/site-packages") cfg.api.finders;
|
extraLibs = [ cfg.api.package pkgs.cairo ] ++ cfg.api.finders;
|
||||||
|
};
|
||||||
|
in "${aenv}/${pkgs.python.sitePackages}";
|
||||||
GRAPHITE_API_CONFIG = graphiteApiConfig;
|
GRAPHITE_API_CONFIG = graphiteApiConfig;
|
||||||
LD_LIBRARY_PATH = "${pkgs.cairo}/lib";
|
LD_LIBRARY_PATH = "${pkgs.cairo}/lib";
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue