m {3,5} tinc_graphs: make everyting work, final
This commit is contained in:
parent
463a8e01d4
commit
ab48fbd972
@ -32,8 +32,8 @@ in {
|
|||||||
makefu.tinc_graphs.enable = true;
|
makefu.tinc_graphs.enable = true;
|
||||||
makefu.tinc_graphs.krebsNginx = {
|
makefu.tinc_graphs.krebsNginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
hostnames_complete = [ "graphs.wry" "graphs.wry.retiolum" ];
|
# TODO: remove hard-coded hostname
|
||||||
# TODO: remove hard-coded path
|
hostnames_complete = [ "graphs.wry" ];
|
||||||
hostnames_anonymous = [ "graphs.krebsco.de" ];
|
hostnames_anonymous = [ "graphs.krebsco.de" ];
|
||||||
};
|
};
|
||||||
networking.firewall.allowedTCPPorts = [80];
|
networking.firewall.allowedTCPPorts = [80];
|
||||||
|
@ -24,21 +24,22 @@ let
|
|||||||
# configure krebs nginx to serve the new graphs
|
# configure krebs nginx to serve the new graphs
|
||||||
enable = mkEnableOption "tinc_graphs nginx";
|
enable = mkEnableOption "tinc_graphs nginx";
|
||||||
|
|
||||||
hostnames_complete = {
|
hostnames_complete = mkOption {
|
||||||
#TODO: this is not a secure way to serve these graphs,better listen to
|
#TODO: this is not a secure way to serve these graphs,better listen to
|
||||||
# the correct interface, krebs.nginx does not support this yet
|
# the correct interface, krebs.nginx does not support this yet
|
||||||
|
|
||||||
type = with types; listOf str;
|
type = with types; listOf str;
|
||||||
description = "hostname which serves complete graphs";
|
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;
|
type = with types; listOf str;
|
||||||
description = ''
|
description = ''
|
||||||
hostname which serves anonymous graphs
|
hostname which serves anonymous graphs
|
||||||
must be different from hostname_complete
|
must be different from hostname_complete
|
||||||
'';
|
'';
|
||||||
|
default = [ "anongraphs.${config.krebs.build.host.name}" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -74,18 +75,29 @@ let
|
|||||||
EXTERNAL_FOLDER = external_dir;
|
EXTERNAL_FOLDER = external_dir;
|
||||||
INTERNAL_FOLDER = internal_dir;
|
INTERNAL_FOLDER = internal_dir;
|
||||||
GEODB = cfg.geodbPath;
|
GEODB = cfg.geodbPath;
|
||||||
|
TINC_HOSTPATH=config.krebs.retiolum.hosts;
|
||||||
};
|
};
|
||||||
|
|
||||||
restartIfChanged = true;
|
restartIfChanged = true;
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
|
|
||||||
ExecStartPre = pkgs.writeScript "tinc_graphs-init" ''
|
ExecStartPre = pkgs.writeScript "tinc_graphs-init" ''
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
mkdir -p "${external_dir}" "${internal_dir}"
|
mkdir -p "${external_dir}" "${internal_dir}"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
ExecStart = "${pkgs.tinc_graphs}/bin/all-the-graphs";
|
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
|
# seems to be a tinc-pre issue
|
||||||
privateTmp = true;
|
privateTmp = true;
|
||||||
};
|
};
|
||||||
@ -93,7 +105,7 @@ let
|
|||||||
|
|
||||||
users.extraUsers.tinc_graphs = {
|
users.extraUsers.tinc_graphs = {
|
||||||
uid = 3925439960; #genid tinc_graphs
|
uid = 3925439960; #genid tinc_graphs
|
||||||
home = "/var/cache/tinc_graphs";
|
home = "/var/spool/tinc_graphs";
|
||||||
createHome = true;
|
createHome = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -102,15 +114,16 @@ let
|
|||||||
server-names = cfg.krebsNginx.hostnames_complete;
|
server-names = cfg.krebsNginx.hostnames_complete;
|
||||||
locations = [
|
locations = [
|
||||||
(nameValuePair "/" ''
|
(nameValuePair "/" ''
|
||||||
|
autoindex on;
|
||||||
root ${internal_dir};
|
root ${internal_dir};
|
||||||
'')
|
'')
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
tinc_graphs_anonymous = {
|
tinc_graphs_anonymous = {
|
||||||
server-names = cfg.krebsNginx.hostnames_anonymous;
|
server-names = cfg.krebsNginx.hostnames_anonymous;
|
||||||
#server-names = [ "dick" ];
|
|
||||||
locations = [
|
locations = [
|
||||||
(nameValuePair "/" ''
|
(nameValuePair "/" ''
|
||||||
|
autoindex on;
|
||||||
root ${external_dir};
|
root ${external_dir};
|
||||||
'')
|
'')
|
||||||
];
|
];
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
python3Packages.buildPythonPackage rec {
|
python3Packages.buildPythonPackage rec {
|
||||||
name = "tinc_graphs-${version}";
|
name = "tinc_graphs-${version}";
|
||||||
version = "0.2.9";
|
version = "0.2.12";
|
||||||
propagatedBuildInputs = with pkgs;[
|
propagatedBuildInputs = with pkgs;[
|
||||||
python3Packages.pygeoip
|
python3Packages.pygeoip
|
||||||
## ${geolite-legacy}/share/GeoIP/GeoIPCity.dat
|
## ${geolite-legacy}/share/GeoIP/GeoIPCity.dat
|
||||||
];
|
];
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://pypi.python.org/packages/source/t/tinc_graphs/tinc_graphs-${version}.tar.gz";
|
url = "https://pypi.python.org/packages/source/t/tinc_graphs/tinc_graphs-${version}.tar.gz";
|
||||||
sha256 = "0fm063qhjlb8g1xahwcqqrd2dxgd38wwi55rhl1k5chr7zajsqfz";
|
sha256 = "03jxvxahpcbpnz4668x32b629dwaaz5jcjkyaijm0zzpgcn4cbgp";
|
||||||
};
|
};
|
||||||
preFixup = with pkgs;''
|
preFixup = with pkgs;''
|
||||||
wrapProgram $out/bin/build-graphs --prefix PATH : "$out/bin"
|
wrapProgram $out/bin/build-graphs --prefix PATH : "$out/bin"
|
||||||
|
Loading…
Reference in New Issue
Block a user