diff options
Diffstat (limited to 'hosts/p-body')
| -rw-r--r-- | hosts/p-body/default.nix | 3 | ||||
| -rw-r--r-- | hosts/p-body/loki.nix | 80 | ||||
| -rw-r--r-- | hosts/p-body/prometheus.nix | 8 |
3 files changed, 84 insertions, 7 deletions
diff --git a/hosts/p-body/default.nix b/hosts/p-body/default.nix index 10abfac..35cbabb 100644 --- a/hosts/p-body/default.nix +++ b/hosts/p-body/default.nix @@ -9,6 +9,7 @@ (modulesPath + "/virtualisation/digital-ocean-image.nix") ./forgejo.nix ./grafana.nix + ./loki.nix ./nginx.nix ./prometheus.nix ]; @@ -21,8 +22,6 @@ hermetic = false; }; - getchoo.server.services.loki.enable = true; - networking = { domain = "mydadleft.me"; hostName = "p-body"; diff --git a/hosts/p-body/loki.nix b/hosts/p-body/loki.nix new file mode 100644 index 0000000..84bb887 --- /dev/null +++ b/hosts/p-body/loki.nix @@ -0,0 +1,80 @@ +{config, ...}: { + networking.firewall.allowedTCPPorts = [config.services.loki.configuration.server.http_listen_port]; + + services.loki = { + enable = true; + configuration = { + server.http_listen_port = 3030; + auth_enabled = false; + + ingester = { + lifecycler = { + address = "127.0.0.1"; + ring = { + kvstore = { + store = "inmemory"; + }; + replication_factor = 1; + }; + }; + chunk_idle_period = "1h"; + max_chunk_age = "1h"; + chunk_target_size = 999999; + chunk_retain_period = "30s"; + max_transfer_retries = 0; + }; + + schema_config = { + configs = [ + { + from = "2022-06-06"; + store = "boltdb-shipper"; + object_store = "filesystem"; + schema = "v11"; + index = { + prefix = "index_"; + period = "24h"; + }; + } + ]; + }; + + storage_config = { + boltdb_shipper = { + active_index_directory = "/var/lib/loki/boltdb-shipper-active"; + cache_location = "/var/lib/loki/boltdb-shipper-cache"; + cache_ttl = "24h"; + shared_store = "filesystem"; + }; + + filesystem = { + directory = "/var/lib/loki/chunks"; + }; + }; + + limits_config = { + reject_old_samples = true; + reject_old_samples_max_age = "168h"; + }; + + chunk_store_config = { + max_look_back_period = "0s"; + }; + + table_manager = { + retention_deletes_enabled = false; + retention_period = "0s"; + }; + + compactor = { + working_directory = "/var/lib/loki"; + shared_store = "filesystem"; + compactor_ring = { + kvstore = { + store = "inmemory"; + }; + }; + }; + }; + }; +} diff --git a/hosts/p-body/prometheus.nix b/hosts/p-body/prometheus.nix index 56e05a9..26e9d0e 100644 --- a/hosts/p-body/prometheus.nix +++ b/hosts/p-body/prometheus.nix @@ -12,23 +12,21 @@ in { services.prometheus = { enable = true; - port = 5000; exporters = { node = { enable = true; enabledCollectors = ["systemd"]; - port = 5001; }; }; scrapeConfigs = [ - (scrapeExporter "p-body" "127.0.0.1" "${toString config.services.prometheus.exporters.node.port}") - (scrapeExporter "atlas" "atlas" "5001") + (scrapeExporter "p-body" "localhost" "${toString config.services.prometheus.exporters.node.port}") + (scrapeExporter "atlas" "atlas" "${toString config.services.prometheus.exporters.node.port}") ]; }; getchoo.server.services.promtail.clients = [ { - url = "http://127.0.0.1:${toString config.services.loki.configuration.server.http_listen_port}/loki/api/v1/push"; + url = "http://localhost:${toString config.services.loki.configuration.server.http_listen_port}/loki/api/v1/push"; } ]; } |
