diff options
Diffstat (limited to 'lass/1systems')
-rw-r--r-- | lass/1systems/mors.nix | 150 | ||||
-rw-r--r-- | lass/1systems/prism.nix | 29 |
2 files changed, 148 insertions, 31 deletions
diff --git a/lass/1systems/mors.nix b/lass/1systems/mors.nix index 4553cc15b..3498f662b 100644 --- a/lass/1systems/mors.nix +++ b/lass/1systems/mors.nix @@ -17,7 +17,6 @@ with import <stockholm/lib>; ../2configs/steam.nix ../2configs/wine.nix ../2configs/git.nix - ../2configs/skype.nix ../2configs/libvirt.nix ../2configs/fetchWallpaper.nix #../2configs/c-base.nix @@ -66,20 +65,18 @@ with import <stockholm/lib>; }; } { - krebs.nginx = { + services.nginx = { enable = true; - servers.default = { - server-names = [ + virtualHosts.default = { + serverAliases = [ "localhost" "${config.krebs.build.host.name}" "${config.krebs.build.host.name}.r" "${config.krebs.build.host.name}.retiolum" ]; - locations = [ - (nameValuePair "~ ^/~(.+?)(/.*)?\$" '' - alias /home/$1/public_html$2; - '') - ]; + locations."~ ^/~(.+?)(/.*)?\$".extraConfig = '' + alias /home/$1/public_html$2; + ''; }; }; } @@ -89,6 +86,137 @@ with import <stockholm/lib>; { virtualisation.libvirtd.enable = true; } + { + services.nginx = { + enable = mkDefault true; + virtualHosts = { + "stats.mors" = { + locations = { + "/" = { + proxyPass = "http://localhost:3000/"; + extraConfig = '' + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + ''; + }; + }; + }; + }; + }; + + services.grafana = { + enable = true; + addr = "127.0.0.1"; + users.allowSignUp = false; + users.allowOrgCreate = false; + users.autoAssignOrg = false; + auth.anonymous.enable = true; + security = import <secrets/grafana_security.nix>; # { AdminUser = ""; adminPassword = ""} + }; + + services.graphite = { + api = { + enable = true; + listenAddress = "127.0.0.1"; + port = 18080; + }; + carbon = { + enableCache = true; + # save disk usage by restricting to 1 bulk update per second + config = '' + [cache] + MAX_CACHE_SIZE = inf + MAX_UPDATES_PER_SECOND = 1 + MAX_CREATES_PER_MINUTE = 500 + ''; + storageSchemas = '' + [carbon] + pattern = ^carbon\. + retentions = 60:90d + + [elchos] + patterhn = ^elchos\. + retentions = 10s:30d,60s:3y + + [default] + pattern = .* + retentions = 30s:30d,300s:1y + ''; + }; + }; + + services.collectd = { + enable = true; + include = [ (toString (pkgs.writeText "collectd-graphite-cfg" '' + LoadPlugin write_graphite + <Plugin "write_graphite"> + <Carbon> + Host "localhost" + Port "2003" + EscapeCharacter "_" + StoreRates false + AlwaysAppendDS false + </Carbon> + </Plugin> + '')) + ]; + extraConfig = '' + LoadPlugin interface + LoadPlugin battery + LoadPlugin load + LoadPlugin cpu + LoadPlugin entropy + LoadPlugin write_graphite + <Plugin "interface"> + Interface "et0" + Interface "wl0" + Interface "retiolum" + </Plugin> + ''; + }; + services.graphite.beacon = { + enable = true; + config = { + graphite_url = "http://localhost:18080"; + cli = { + command = ''${pkgs.irc-announce}/bin/irc-announce irc.freenode.org 6667 mors-beacon-alert \#krebs ' ''${level} ''${name} ''${value}' ''; + }; + smtp = { + from = "beacon@mors.r"; + to = [ + "lass@mors.r" + ]; + }; + normal_handlers = [ + "smtp" + "cli" + ]; + warning_handlers = [ + "smtp" + "cli" + ]; + critical_handlers = [ + "smtp" + "cli" + ]; + alerts = [ + { + name = "testbattery"; + query = "*.battery-0.capacity"; + method = "last_value"; + interval = "1minute"; + logging = "info"; + repeat_interval = "5minute"; + rules = [ + "warning: < 30.0" + "critical: < 10.0" + ]; + } + ]; + }; + }; + } ]; krebs.build.host = config.krebs.hosts.mors; @@ -238,8 +366,4 @@ with import <stockholm/lib>; krebs.repo-sync.timerConfig = { OnCalendar = "00:37"; }; - - services.mongodb = { - enable = true; - }; } diff --git a/lass/1systems/prism.nix b/lass/1systems/prism.nix index 6c11a2f62..39026d102 100644 --- a/lass/1systems/prism.nix +++ b/lass/1systems/prism.nix @@ -24,6 +24,8 @@ in { ../2configs/repo-sync.nix ../2configs/binary-cache/server.nix ../2configs/iodined.nix + ../2configs/libvirt.nix + ../2configs/hfos.nix { users.extraGroups = { # ● systemd-tmpfiles-setup.service - Create Volatile Files and Directories @@ -178,11 +180,9 @@ in { imports = [ ../2configs/realwallpaper.nix ]; - krebs.nginx.servers."lassul.us".locations = [ - (lib.nameValuePair "/wallpaper.png" '' - alias /tmp/wallpaper.png; - '') - ]; + services.nginx.virtualHosts."lassul.us".locations."/wallpaper.png".extraConfig = '' + alias /tmp/wallpaper.png; + ''; } { environment.systemPackages = with pkgs; [ @@ -202,16 +202,13 @@ in { }; } { - krebs.nginx = { + services.nginx = { enable = true; - servers.public = { - listen = [ "8088" ]; - server-names = [ "default" ]; - locations = [ - (nameValuePair "~ ^/~(.+?)(/.*)?\$" '' - alias /home/$1/public_html$2; - '') - ]; + virtualHosts.public = { + port = 8088; + locations."~ ^/~(.+?)(/.*)?\$".extraConfig = '' + alias /home/$1/public_html$2; + ''; }; }; krebs.iptables.tables.filter.INPUT.rules = [ @@ -228,10 +225,6 @@ in { enable = true; }; } - { - virtualisation.libvirtd.enable = true; - users.users.mainUser.extraGroups = [ "libvirtd" ]; - } ]; krebs.build.host = config.krebs.hosts.prism; |