1 { config, pkgs, lib, name, ... }:
5 enable = lib.mkOption {
9 Whether to enable status app.
14 config = lib.mkIf config.myServices.status.enable {
15 secrets.keys."naemon-status/environment" = {
20 TOKENS=${builtins.concatStringsSep " " config.myEnv.monitoring.nrdp_tokens}
25 recommendedOptimisation = true;
26 recommendedGzipSettings = true;
27 recommendedProxySettings = true;
28 upstreams."netdata".servers = { "127.0.0.1:19999" = {}; };
29 upstreams."netdata".extraConfig = ''
32 virtualHosts."status.eban.bzh" = {
33 acmeRoot = config.myServices.certificates.webroot;
36 locations."/".proxyPass = "http://unix:/run/naemon-status/socket.sock:/";
38 virtualHosts."status.immae.eu" = {
39 acmeRoot = config.myServices.certificates.webroot;
42 locations."/".proxyPass = "http://unix:/run/naemon-status/socket.sock:/";
44 locations."= /netdata".return = "301 /netdata/";
45 locations."~ /netdata/(?<ndpath>.*)".extraConfig = ''
47 proxy_set_header Host $host;
49 proxy_set_header X-Forwarded-Host $host;
50 proxy_set_header X-Forwarded-Server $host;
51 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
52 proxy_http_version 1.1;
53 proxy_pass_request_headers on;
54 proxy_set_header Connection "keep-alive";
56 proxy_pass http://netdata/$ndpath$is_args$args;
64 security.acme.certs."${name}" = {
65 extraDomains."status.immae.eu" = null;
66 extraDomains."status.eban.bzh" = null;
67 user = config.services.nginx.user;
68 group = config.services.nginx.group;
71 myServices.certificates.enable = true;
72 networking.firewall.allowedTCPPorts = [ 80 443 ];
73 systemd.services.naemon-status = {
74 description = "Naemon status";
75 after = [ "network.target" ];
76 wantedBy = [ "multi-user.target" ];
79 EnvironmentFile = config.secrets.fullPaths."naemon-status/environment";
81 WorkingDirectory = "${./status}";
83 python = pkgs.python3.withPackages (p: [ p.gunicorn p.flask p.flask_login ]);
85 "${python}/bin/gunicorn -w4 --bind unix:/run/naemon-status/socket.sock app:app";
87 RuntimeDirectory = "naemon-status";
88 StandardOutput = "journal";
89 StandardError = "inherit";