summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2020-10-03 13:44:30 +0200
committertv <tv@krebsco.de>2020-10-03 13:44:30 +0200
commitd1e52425e0d5d79a33b11c92cc2afb498075d953 (patch)
tree29277982f014eaae680e006b6afc7fdb42e8d9b2
parent654f64f05935a69607a540f2e8d15619cee9e15e (diff)
parent7e7499d86302d261c8f8404fb34f2ac091318d0e (diff)
Merge remote-tracking branch 'prism/master'
-rw-r--r--krebs/0tests/data/secrets/shack/telegram_bot.env0
-rw-r--r--krebs/1systems/puyak/config.nix1
-rw-r--r--krebs/1systems/wolf/config.nix18
-rw-r--r--krebs/2configs/go.nix2
-rw-r--r--krebs/2configs/reaktor2.nix2
-rw-r--r--krebs/2configs/shack/glados/default.nix25
-rw-r--r--krebs/2configs/shack/glados/multi/rollos.nix53
-rw-r--r--krebs/2configs/shack/glados/multi/wasser.nix12
-rw-r--r--krebs/2configs/shack/influx.nix5
-rw-r--r--krebs/2configs/shack/light.shack.nix12
-rw-r--r--krebs/2configs/shack/muell_mail.nix4
-rw-r--r--krebs/2configs/shack/node-light.nix3
-rw-r--r--krebs/2configs/shack/prometheus/alert-rules.nix140
-rw-r--r--krebs/2configs/shack/prometheus/alertmanager-telegram.nix17
-rw-r--r--krebs/2configs/shack/prometheus/server.nix23
-rw-r--r--krebs/2configs/shack/prometheus/templates/shack.tmpl25
-rw-r--r--krebs/3modules/external/mic92.nix28
-rw-r--r--krebs/3modules/hosts.nix2
-rw-r--r--krebs/3modules/lass/default.nix4
-rw-r--r--krebs/3modules/newsbot-js.nix2
-rw-r--r--krebs/5pkgs/simple/alertmanager-bot-telegram/default.nix26
-rw-r--r--krebs/5pkgs/simple/flameshot-once/profile.nix2
-rw-r--r--krebs/5pkgs/simple/realwallpaper/default.nix2
-rw-r--r--lass/1systems/blue/config.nix21
-rw-r--r--lass/1systems/morpheus/config.nix1
-rw-r--r--lass/1systems/mors/config.nix2
-rw-r--r--lass/1systems/mors/physical.nix2
-rw-r--r--lass/1systems/prism/config.nix9
-rw-r--r--lass/1systems/prism/physical.nix10
-rw-r--r--lass/1systems/shodan/physical.nix2
-rwxr-xr-xlass/1systems/wizard/run-vm.sh7
-rw-r--r--lass/1systems/wizard/test.nix2
-rw-r--r--lass/1systems/xerxes/config.nix26
-rw-r--r--lass/1systems/yellow/config.nix26
-rw-r--r--lass/2configs/baseX.nix5
-rw-r--r--lass/2configs/blue-host.nix90
-rw-r--r--lass/2configs/blue.nix7
-rw-r--r--lass/2configs/default.nix11
-rw-r--r--lass/2configs/exim-smarthost.nix8
-rw-r--r--lass/2configs/games.nix18
-rw-r--r--lass/2configs/gc.nix1
-rw-r--r--lass/2configs/git.nix4
-rw-r--r--lass/2configs/hass/default.nix1
-rw-r--r--lass/2configs/hass/rooms/bett.nix31
-rw-r--r--lass/2configs/hw/x220.nix11
-rw-r--r--lass/2configs/mail.nix19
-rw-r--r--lass/2configs/mpv.nix2
-rw-r--r--lass/2configs/paste.nix31
-rw-r--r--lass/2configs/radio.nix29
-rw-r--r--lass/2configs/steam.nix6
-rw-r--r--lass/2configs/syncthing.nix1
-rw-r--r--lass/2configs/websites/domsen.nix18
-rw-r--r--lass/2configs/websites/lassulus.nix5
-rw-r--r--lass/2configs/wine.nix3
-rw-r--r--lass/2configs/zsh.nix13
-rw-r--r--lass/3modules/hass.nix17
-rw-r--r--lass/5pkgs/custom/xmonad-lass/default.nix29
-rw-r--r--lass/5pkgs/emot-menu/default.nix2
-rw-r--r--lass/5pkgs/init/default.nix45
-rwxr-xr-xlass/5pkgs/init/run-vm.sh7
-rw-r--r--lass/5pkgs/init/test.nix13
-rwxr-xr-xlass/5pkgs/init/test.sh11
-rw-r--r--makefu/1systems/wbob/config.nix4
-rw-r--r--makefu/2configs/bureautomation/kalauerbot.nix17
-rw-r--r--makefu/2configs/deployment/docker/template.md23
-rw-r--r--makefu/2configs/ham/default.nix13
-rw-r--r--makefu/2configs/ham/device_tracker/openwrt.nix10
-rw-r--r--makefu/2configs/home-manager/cli.nix25
-rw-r--r--makefu/2configs/hw/switch.nix6
-rw-r--r--makefu/2configs/stats/server.nix33
-rw-r--r--makefu/2configs/tools/consoles.nix1
-rw-r--r--makefu/2configs/tools/dev.nix3
-rw-r--r--makefu/5pkgs/awesomecfg/default.nix4
-rw-r--r--makefu/5pkgs/awesomecfg/full.cfg21
-rw-r--r--makefu/5pkgs/chapter-marker/default.nix9
-rw-r--r--makefu/5pkgs/kalauerbot/default.nix18
-rw-r--r--makefu/5pkgs/kalauerbot/matrixbot.patch12
-rw-r--r--makefu/5pkgs/kalauerbot/python-matrixbot.nix31
-rw-r--r--makefu/5pkgs/kalauerbot/translate.patch17
-rw-r--r--makefu/5pkgs/nsrenamer/default.nix3
-rwxr-xr-xmakefu/5pkgs/nsrenamer/nsrenamer.sh58
-rw-r--r--makefu/5pkgs/tt-rss/default.nix25
82 files changed, 869 insertions, 418 deletions
diff --git a/krebs/0tests/data/secrets/shack/telegram_bot.env b/krebs/0tests/data/secrets/shack/telegram_bot.env
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/krebs/0tests/data/secrets/shack/telegram_bot.env
diff --git a/krebs/1systems/puyak/config.nix b/krebs/1systems/puyak/config.nix
index c84887eaa..08a3392bd 100644
--- a/krebs/1systems/puyak/config.nix
+++ b/krebs/1systems/puyak/config.nix
@@ -18,6 +18,7 @@
<stockholm/krebs/2configs/shack/prometheus/server.nix>
<stockholm/krebs/2configs/shack/prometheus/blackbox.nix>
<stockholm/krebs/2configs/shack/prometheus/unifi.nix>
+ <stockholm/krebs/2configs/shack/prometheus/alertmanager-telegram.nix>
<stockholm/krebs/2configs/shack/gitlab-runner.nix>
## Collect local statistics via collectd and send to collectd
diff --git a/krebs/1systems/wolf/config.nix b/krebs/1systems/wolf/config.nix
index 029644ca6..0160f9ebb 100644
--- a/krebs/1systems/wolf/config.nix
+++ b/krebs/1systems/wolf/config.nix
@@ -27,6 +27,8 @@ in
<stockholm/krebs/2configs/shack/muellshack.nix>
# provide light control api
<stockholm/krebs/2configs/shack/node-light.nix>
+ # light.shack web-ui
+ <stockholm/krebs/2configs/shack/light.shack.nix>
# send mail if muell was not handled
<stockholm/krebs/2configs/shack/muell_mail.nix>
# send mail if muell was not handled
@@ -34,6 +36,22 @@ in
# powerraw usb serial to mqtt and raw socket
<stockholm/krebs/2configs/shack/powerraw.nix>
+ { # do not log to /var/spool/log
+ services.nginx.appendHttpConfig = ''
+ map $request_method $loggable {
+ default 1;
+ GET 0;
+ }
+ log_format vhost '$host $remote_addr - $remote_user '
+ '[$time_local] "$request" $status '
+ '$body_bytes_sent "$http_referer" '
+ '"$http_user_agent"';
+ error_log stderr;
+ access_log syslog:server=unix:/dev/log vhost;
+ '';
+ services.journald.rateLimitBurst = 10000;
+ }
+
# create samba share for anonymous usage with the laser and 3d printer pc
<stockholm/krebs/2configs/shack/share.nix>
diff --git a/krebs/2configs/go.nix b/krebs/2configs/go.nix
index f4c1290c2..c39b08a8e 100644
--- a/krebs/2configs/go.nix
+++ b/krebs/2configs/go.nix
@@ -13,7 +13,7 @@ with import <stockholm/lib>;
enable = true;
virtualHosts.go = {
locations."/".extraConfig = ''
- proxy_set_header Host go;
+ proxy_set_header Host go.r;
proxy_pass http://localhost:1337;
'';
serverAliases = [
diff --git a/krebs/2configs/reaktor2.nix b/krebs/2configs/reaktor2.nix
index 72eff176b..061dc9ab9 100644
--- a/krebs/2configs/reaktor2.nix
+++ b/krebs/2configs/reaktor2.nix
@@ -76,7 +76,7 @@ let
};
}
{
- pattern = ''^([\w-]*):?\s+([+-][1-9][0-9]*)\s+(\S+)$'';
+ pattern = ''^([\H-]*):?\s+([+-][1-9][0-9]*)\s+(\S+)$'';
activate = "match";
arguments = [1 2 3];
command = {
diff --git a/krebs/2configs/shack/glados/default.nix b/krebs/2configs/shack/glados/default.nix
index 9bf90bca4..f47bca2db 100644
--- a/krebs/2configs/shack/glados/default.nix
+++ b/krebs/2configs/shack/glados/default.nix
@@ -3,6 +3,7 @@ let
shackopen = import ./multi/shackopen.nix;
wasser = import ./multi/wasser.nix;
badair = import ./multi/schlechte_luft.nix;
+ rollos = import ./multi/rollos.nix;
in {
services.nginx.virtualHosts."hass.shack" = {
serverAliases = [ "glados.shack" ];
@@ -62,13 +63,18 @@ in {
];
};
# https://www.home-assistant.io/components/influxdb/
- #influxdb = {
- # database = "hass";
- # tags = {
- # instance = "wolf";
- # source = "hass";
- # };
- #};
+ influxdb = {
+ database = "glados";
+ host = "influx.shack";
+ component_config_glob = {
+ "sensor.*particulate_matter_2_5um_concentration".override_measurement = "2_5um particles";
+ "sensor.*particulate_matter_10_0um_concentration".override_measurement ="10um particles";
+ };
+ tags = {
+ instance = "wolf";
+ source = "glados";
+ };
+ };
esphome = {};
api = {};
mqtt = {
@@ -93,8 +99,7 @@ in {
};
};
switch =
- wasser.switch
- ++ (import ./switch/power.nix)
+ (import ./switch/power.nix)
;
light = [];
media_player = [
@@ -113,6 +118,7 @@ in {
++ (import ./sensors/mate.nix)
++ (import ./sensors/darksky.nix { inherit lib;})
++ shackopen.sensor
+ ++ wasser.sensor
;
air_quality = (import ./sensors/sensemap.nix );
@@ -147,6 +153,7 @@ in {
automation = wasser.automation
++ badair.automation
+ ++ rollos.automation
++ (import ./automation/shack-startup.nix)
++ (import ./automation/party-time.nix)
++ (import ./automation/hass-restart.nix);
diff --git a/krebs/2configs/shack/glados/multi/rollos.nix b/krebs/2configs/shack/glados/multi/rollos.nix
index 1febad525..4e6494936 100644
--- a/krebs/2configs/shack/glados/multi/rollos.nix
+++ b/krebs/2configs/shack/glados/multi/rollos.nix
@@ -1,13 +1,56 @@
+#
+
let
glados = import ../lib;
+ tempsensor = "sensor.dark_sky_temperature";
+ all_covers = [
+ "cover.crafting_rollo"
+ "cover.elab_rollo"
+ "cover.or2_rollo"
+ "cover.retroraum_rollo"
+ ];
in
{
- # LED
- light = [
- ];
- sensor = [
- ];
automation =
[
+ { alias = "Rollos fahren Runter";
+ trigger = [
+ {
+ platform = "numeric_state";
+ entity_id = tempsensor;
+ above = 25;
+ for = "00:30:00";
+ }
+ ];
+ condition =
+ [
+ {
+ condition = "state";
+ entity_id = "sun.sun";
+ state = "above_horizon";
+ }
+ ];
+ action =
+ [
+ { service = "cover.close_cover";
+ entity_id = all_covers;
+ }
+ ];
+ }
+ { alias = "Rollos fahren Hoch";
+ trigger = [
+ {
+ platform = "sun";
+ event = "sunset";
+ }
+ ];
+ condition = [ ];
+ action =
+ [
+ { service = "cover.open_cover";
+ entity_id = all_covers;
+ }
+ ];
+ }
];
}
diff --git a/krebs/2configs/shack/glados/multi/wasser.nix b/krebs/2configs/shack/glados/multi/wasser.nix
index 6f3dc98ad..74ce736a6 100644
--- a/krebs/2configs/shack/glados/multi/wasser.nix
+++ b/krebs/2configs/shack/glados/multi/wasser.nix
@@ -2,13 +2,17 @@
# switch.crafting_giesskanne_relay
let
glados = import ../lib;
- seconds = 10;
+ seconds = 20;
wasser = "switch.crafting_giesskanne_relay";
in
{
- switch = [
- (glados.tasmota.plug { host = "Wasser"; topic = "plug";} )
- ];
+ sensor = map ( entity_id: {
+ platform = "statistics";
+ name = "Statistics for ${entity_id}";
+ inherit entity_id;
+ max_age.minutes = "60";
+ }) ["sensor.crafting_brotbox_soil_moisture"];
+
automation =
[
diff --git a/krebs/2configs/shack/influx.nix b/krebs/2configs/shack/influx.nix
index 92cb24bf3..93d83a59b 100644
--- a/krebs/2configs/shack/influx.nix
+++ b/krebs/2configs/shack/influx.nix
@@ -8,6 +8,11 @@ in
networking.firewall.allowedTCPPorts = [ port ]; # for legacy applications
networking.firewall.allowedUDPPorts = [ collectd-port ];
services.nginx.virtualHosts."influx.shack" = {
+ # Disable constant GET request logging.
+ # $loggable map is defined in 1/wolf
+ extraConfig = ''
+ access_log syslog:server=unix:/dev/log combined if=$loggable;
+ '';
locations."/" = {
proxyPass = "http://localhost:${toString port}/";
};
diff --git a/krebs/2configs/shack/light.shack.nix b/krebs/2configs/shack/light.shack.nix
new file mode 100644
index 000000000..8e01cb1bf
--- /dev/null
+++ b/krebs/2configs/shack/light.shack.nix
@@ -0,0 +1,12 @@
+{ config, pkgs, ... }:
+let
+ light-shack-src = pkgs.fetchgit {
+ url = "https://git.shackspace.de/rz/standby.shack";
+ rev = "e1b90a0a";
+ sha256 = "07fmz63arc5rxa0a3778srwz0jflp4ad6xnwkkc56hwybby0bclh";
+ };
+ web-dir = "${light-shack-src}/client/www/";
+in
+{
+ services.nginx.virtualHosts."light.shack".locations."/".root = web-dir;
+}
diff --git a/krebs/2configs/shack/muell_mail.nix b/krebs/2configs/shack/muell_mail.nix
index 409278954..481564719 100644
--- a/krebs/2configs/shack/muell_mail.nix
+++ b/krebs/2configs/shack/muell_mail.nix
@@ -4,8 +4,8 @@ let
pkg = pkgs.callPackage (
pkgs.fetchgit {
url = "https://git.shackspace.de/rz/muell_mail";
- rev = "57b67c95052d90044137b2c89007a371dc389afd";
- sha256 = "1grkzs6fxjnc2bv4kskj63d5sb4qxz6yyr85nj0da9hn7qkk4jkj";
+ rev = "c3e43687879f95e01a82ef176fa15678543b2eb8";
+ sha256 = "0hgchwam5ma96s2v6mx2jfkh833psadmisjbm3k3153rlxp46frx";
}) { mkYarnPackage = pkgs.yarn2nix-moretea.mkYarnPackage; };
home = "/var/lib/muell_mail";
cfg = toString <secrets/shack/muell_mail.js>;
diff --git a/krebs/2configs/shack/node-light.nix b/krebs/2configs/shack/node-light.nix
index b471f2af5..4a981ea87 100644
--- a/krebs/2configs/shack/node-light.nix
+++ b/krebs/2configs/shack/node-light.nix
@@ -28,6 +28,9 @@ in {
};
services.nginx.virtualHosts."openhab.shack" = {
+ extraConfig = ''
+ access_log syslog:server=unix:/dev/log combined if=$loggable;
+ '';
serverAliases = [ "lightapi.shack" ];
locations."/power/".proxyPass = "http://localhost:${port}/power/";
locations."/lounge/".proxyPass = "http://localhost:${port}/lounge/";
diff --git a/krebs/2configs/shack/prometheus/alert-rules.nix b/krebs/2configs/shack/prometheus/alert-rules.nix
index 096c551ba..1c2d0b1ad 100644
--- a/krebs/2configs/shack/prometheus/alert-rules.nix
+++ b/krebs/2configs/shack/prometheus/alert-rules.nix
@@ -1,102 +1,42 @@
-{ lib }:
-with lib;
-
+{ lib,... }:
let
- deviceFilter = ''device!="ramfs",device!="rpc_pipefs",device!="lxcfs",device!="nsfs",device!="borgfs"'';
-in mapAttrsToList (name: opts: {
- alert = name;
- expr = opts.condition;
- for = opts.time or "2m";
- labels = if (opts.page or true) then { severity = "page"; } else {};
- annotations = {
- summary = opts.summary;
- description = opts.description;
- };
-}) {
- node_down = {
- condition = ''up{job="node"} == 0'';
- summary = "{{$labels.alias}}: Node is down.";
- description = "{{$labels.alias}} has been down for more than 2 minutes.";
- };
- node_systemd_service_failed = {
- condition = ''node_systemd_unit_state{state="failed"} == 1'';
- summary = "{{$labels.alias}}: Service {{$labels.name}} failed to start.";
- description = "{{$labels.alias}} failed to (re)start service {{$labels.name}}.";
- };
- node_filesystem_full_80percent = {
- condition = ''sort(node_filesystem_free_bytes{${deviceFilter}} < node_filesystem_size_bytes{${deviceFilter}} * 0.2) / 1024^3'';
- time = "10m";
- summary = "{{$labels.alias}}: Filesystem is running out of space soon.";
- description = "{{$labels.alias}} device {{$labels.device}} on {{$labels.mountpoint}} got less than 20% space left on its filesystem.";
- };
- node_filesystem_full_in_7d = {
- condition = ''predict_linear(node_filesystem_free_bytes{${deviceFilter}}[2d], 7*24*3600) <= 0'';
- time = "1h";
- summary = "{{$labels.alias}}: Filesystem is running out of space in 7 days.";
- description = "{{$labels.alias}} device {{$labels.dev