Ildkule: Move monitoring state directories to data volume #88

Merged
felixalb merged 2 commits from ildkule-data-volume into main 2024-11-10 02:30:11 +01:00
4 changed files with 23 additions and 7 deletions
Showing only changes of commit 11f6ef0572 - Show all commits

View File

@ -4,6 +4,7 @@
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi" ]; boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi" ];
boot.initrd.kernelModules = [ "nvme" ]; boot.initrd.kernelModules = [ "nvme" ];
fileSystems."/" = { device = "/dev/vda1"; fsType = "ext4"; }; fileSystems."/" = { device = "/dev/vda1"; fsType = "ext4"; };
fileSystems."/data" = { device = "/dev/vdb1"; fsType = "ext4"; };
networking.useDHCP = lib.mkDefault true; networking.useDHCP = lib.mkDefault true;
} }

View File

@ -2,6 +2,7 @@
let let
cfg = config.services.loki; cfg = config.services.loki;
stateDir = "/data/monitoring/loki";
in { in {
services.loki = { services.loki = {
enable = true; enable = true;
@ -16,7 +17,7 @@ in {
ingester = { ingester = {
wal = { wal = {
enabled = true; enabled = true;
dir = "/var/lib/loki/wal"; dir = "${stateDir}/wal";
}; };
lifecycler = { lifecycler = {
address = "127.0.0.1"; address = "127.0.0.1";
@ -48,12 +49,12 @@ in {
storage_config = { storage_config = {
boltdb_shipper = { boltdb_shipper = {
active_index_directory = "/var/lib/loki/boltdb-shipper-index"; active_index_directory = "${stateDir}/boltdb-shipper-index";
cache_location = "/var/lib/loki/boltdb-shipper-cache"; cache_location = "${stateDir}/boltdb-shipper-cache";
cache_ttl = "24h"; cache_ttl = "24h";
}; };
filesystem = { filesystem = {
directory = "/var/lib/loki/chunks"; directory = "${stateDir}/chunks";
}; };
}; };
@ -64,14 +65,14 @@ in {
}; };
compactor = { compactor = {
working_directory = "/var/lib/loki/compactor"; working_directory = "${stateDir}/compactor";
}; };
# ruler = { # ruler = {
# storage = { # storage = {
# type = "local"; # type = "local";
# local = { # local = {
# directory = "/var/lib/loki/rules"; # directory = "${stateDir}/rules";
# }; # };
# }; # };
# rule_path = "/etc/loki/rules"; # rule_path = "/etc/loki/rules";

View File

@ -1,4 +1,6 @@
{ config, ... }: { { config, ... }: let
stateDir = "/data/monitoring/prometheus";
in {
imports = [ imports = [
./gitea.nix ./gitea.nix
./matrix-synapse.nix ./matrix-synapse.nix
@ -10,9 +12,15 @@
services.prometheus = { services.prometheus = {
enable = true; enable = true;
listenAddress = "127.0.0.1"; listenAddress = "127.0.0.1";
port = 9001; port = 9001;
ruleFiles = [ rules/synapse-v2.rules ]; ruleFiles = [ rules/synapse-v2.rules ];
}; };
fileSystems."/var/lib/prometheus2" = {
device = stateDir;
options = [ "bind" ];
};
} }

View File

@ -2,6 +2,7 @@
let let
cfg = config.services.uptime-kuma; cfg = config.services.uptime-kuma;
domain = "status.pvv.ntnu.no"; domain = "status.pvv.ntnu.no";
stateDir = "/data/monitoring/uptime-kuma";
in { in {
services.uptime-kuma = { services.uptime-kuma = {
enable = true; enable = true;
@ -17,4 +18,9 @@ in {
kTLS = true; kTLS = true;
locations."/".proxyPass = "http://${cfg.settings.HOST}:${cfg.settings.PORT}"; locations."/".proxyPass = "http://${cfg.settings.HOST}:${cfg.settings.PORT}";
}; };
fileSystems."/var/lib/uptime-kuma" = {
device = stateDir;
options = [ "bind" ];
};
} }