From 77b8a36fac5bdc8226e183d0d712cb9af3bd932f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 19 Jul 2023 15:45:37 +0200 Subject: [PATCH 1/4] limit to 4Ghz --- modules/hetzner-ex101.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/hetzner-ex101.nix b/modules/hetzner-ex101.nix index 1021dee..9d19c5e 100644 --- a/modules/hetzner-ex101.nix +++ b/modules/hetzner-ex101.nix @@ -11,7 +11,7 @@ # looks like the Intel i9-13900 draws too much power and crashes the system systemd.services.limit-cpu-freq = { - description = "Limit CPU frequency to 4.2GHz"; + description = "Limit CPU frequency to 4GHz"; wantedBy = [ "multi-user.target" ]; after = [ "systemd-modules-load.service" ]; # Some cores do have a scaling max freq less than 5GHz, so we need to @@ -20,8 +20,8 @@ #!/bin/sh for f in /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq; do old_val="$(<"$f")" - if [[ "$old_val" -gt 4200000 ]]; then - echo 4200000 > "$f" + if [[ "$old_val" -gt 4000000 ]]; then + echo 4000000 > "$f" fi done ''; From 40899b46304603b4389ae927206af0c4bf2c834b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 19 Jul 2023 15:45:49 +0200 Subject: [PATCH 2/4] add telegraf to all hosts --- modules/flake-module.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/flake-module.nix b/modules/flake-module.nix index 542cc94..c16d15d 100644 --- a/modules/flake-module.nix +++ b/modules/flake-module.nix @@ -2,6 +2,7 @@ flake.nixosModules = { server.imports = [ inputs.srvos.nixosModules.server + inputs.srvos.nixosModules.mixins-telegraf inputs.sops-nix.nixosModules.default ]; From 4a0b6cf7850ec9e54bcb6fe2f6750fc054a898c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 19 Jul 2023 16:37:41 +0200 Subject: [PATCH 3/4] found a better workaround to avoid crashes on web01 --- modules/hetzner-ex101.nix | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/modules/hetzner-ex101.nix b/modules/hetzner-ex101.nix index 9d19c5e..436a824 100644 --- a/modules/hetzner-ex101.nix +++ b/modules/hetzner-ex101.nix @@ -9,24 +9,5 @@ # We are not limited by zfs, so we can use the latest kernel boot.kernelPackages = pkgs.linuxPackages_latest; - # looks like the Intel i9-13900 draws too much power and crashes the system - systemd.services.limit-cpu-freq = { - description = "Limit CPU frequency to 4GHz"; - wantedBy = [ "multi-user.target" ]; - after = [ "systemd-modules-load.service" ]; - # Some cores do have a scaling max freq less than 5GHz, so we need to - # check for that or else all cores will run at 800MHz - script = '' - #!/bin/sh - for f in /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq; do - old_val="$(<"$f")" - if [[ "$old_val" -gt 4000000 ]]; then - echo 4000000 > "$f" - fi - done - ''; - serviceConfig = { - Type = "oneshot"; - }; - }; + powerManagement.cpuFreqGovernor = "powersave"; } From dfdd854564b60f84d14d5a9f2620b3904cb21b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 20 Jul 2023 09:19:05 +0200 Subject: [PATCH 4/4] add script to reboot machine --- targets/web01/reboot.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 targets/web01/reboot.sh diff --git a/targets/web01/reboot.sh b/targets/web01/reboot.sh new file mode 100755 index 0000000..c29b677 --- /dev/null +++ b/targets/web01/reboot.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + + +HOST=clan.lol +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +ssh "root@$HOST" reboot +# wait till shutdown +while ping -4 -W 1 -c 1 "$HOST"; do + sleep 1 +done + +"$SCRIPT_DIR/decrypt.sh"