summaryrefslogtreecommitdiffstats
path: root/makefu/3modules
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-10-09 14:48:58 +0200
committertv <tv@shackspace.de>2015-10-09 14:48:58 +0200
commit96f4248b65ff1539eded24572ae1805b27c53d50 (patch)
tree31ff450cc4a5166306c62f99fdd2d1caf3219ecb /makefu/3modules
parent694c79a5bc05014604fa2467f965b370102ff78f (diff)
parent4072a32f89b9cc1c1e7c3583ac5b9ce5dcb004af (diff)
Merge remote-tracking branch 'cloudkrebs/master'
Diffstat (limited to 'makefu/3modules')
-rw-r--r--makefu/3modules/tinc_graphs.nix29
1 files changed, 20 insertions, 9 deletions
diff --git a/makefu/3modules/tinc_graphs.nix b/makefu/3modules/tinc_graphs.nix
index 10f1b23a0..62d607527 100644
--- a/makefu/3modules/tinc_graphs.nix
+++ b/makefu/3modules/tinc_graphs.nix
@@ -24,21 +24,22 @@ let
# configure krebs nginx to serve the new graphs
enable = mkEnableOption "tinc_graphs nginx";
- hostnames_complete = {
+ hostnames_complete = mkOption {
#TODO: this is not a secure way to serve these graphs,better listen to
# the correct interface, krebs.nginx does not support this yet
type = with types; listOf str;
description = "hostname which serves complete graphs";
- default = config.krebs.build.host.name;
+ default = [ "graphs.${config.krebs.build.host.name}" ];
};
- hostnames_anonymous = {
+ hostnames_anonymous = mkOption {
type = with types; listOf str;
description = ''
hostname which serves anonymous graphs
must be different from hostname_complete
'';
+ default = [ "anongraphs.${config.krebs.build.host.name}" ];
};
};
@@ -63,29 +64,38 @@ let
environment.systemPackages = [ pkgs.tinc_graphs];
systemd.timers.tinc_graphs = {
description = "Build Tinc Graphs via via timer";
-
+ wantedBy = [ "timers.target"];
timerConfig = cfg.timerConfig;
};
systemd.services.tinc_graphs = {
description = "Build Tinc Graphs";
- wantedBy = [ "multi-user.target" ];
- after = [ "network.target" ];
environment = {
EXTERNAL_FOLDER = external_dir;
INTERNAL_FOLDER = internal_dir;
GEODB = cfg.geodbPath;
+ TINC_HOSTPATH=config.krebs.retiolum.hosts;
};
restartIfChanged = true;
serviceConfig = {
Type = "simple";
+
ExecStartPre = pkgs.writeScript "tinc_graphs-init" ''
#!/bin/sh
mkdir -p "${external_dir}" "${internal_dir}"
'';
+
ExecStart = "${pkgs.tinc_graphs}/bin/all-the-graphs";
- User = "root"; # tinc cannot be queried as user,
+
+ ExecStartPost = pkgs.writeScript "tinc_graphs-post" ''
+ #!/bin/sh
+ # TODO: this may break if workingDir is set to something stupid
+ # this is needed because homedir is created with 700
+ chmod 755 "${cfg.workingDir}"
+ '';
+
+ User = "root"; # tinc cannot be queried as user,
# seems to be a tinc-pre issue
privateTmp = true;
};
@@ -93,7 +103,7 @@ let
users.extraUsers.tinc_graphs = {
uid = 3925439960; #genid tinc_graphs
- home = "/var/cache/tinc_graphs";
+ home = "/var/spool/tinc_graphs";
createHome = true;
};
@@ -102,15 +112,16 @@ let
server-names = cfg.krebsNginx.hostnames_complete;
locations = [
(nameValuePair "/" ''
+ autoindex on;
root ${internal_dir};
'')
];
};
tinc_graphs_anonymous = {
server-names = cfg.krebsNginx.hostnames_anonymous;
- #server-names = [ "dick" ];
locations = [
(nameValuePair "/" ''
+ autoindex on;
root ${external_dir};
'')
];