From e719674851838cdd4d446769ccc98aff5f3be998 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Fri, 16 Oct 2026 16:59:09 -0400 Subject: [PATCH] killing exporters --- hosts/hl-bigbox1/default.nix | 4 ++-- hosts/hl-bigbox2/default.nix | 4 ++-- hosts/hl-minipc1/default.nix | 4 ++-- hosts/hl-minipc2/default.nix | 4 ++-- hosts/hl-minipc3/default.nix | 4 ++-- hosts/hl-terra1/default.nix | 2 +- modules/nixos/ABOUTME.md | 2 +- modules/nixos/common/containers/ABOUTME.md | 10 ++++------ modules/nixos/common/containers/default.nix | 6 +----- modules/nixos/common/containers/docker.nix | 11 +---------- modules/nixos/server/ABOUTME.md | 9 ++++----- modules/nixos/server/GUIDELINES.md | 4 ++-- modules/nixos/server/default.nix | 2 +- modules/nixos/server/exporters.nix | 20 -------------------- 14 files changed, 25 insertions(+), 61 deletions(-) delete mode 100644 modules/nixos/server/exporters.nix diff --git a/hosts/hl-bigbox1/default.nix b/hosts/hl-bigbox1/default.nix index e4d8b76..899debe 100644 --- a/hosts/hl-bigbox1/default.nix +++ b/hosts/hl-bigbox1/default.nix @@ -10,14 +10,14 @@ skyg = { user.enable = true; server.admin.enable = true; - server.exporters.enable = true; + nixos = { desktop = { enable = false; gnome.enable = false; }; common.ssh-server.enable = true; - common.containers.openMetricsPort = true; + common.hardware = { nvidia.enable = true; amdgpu.enable = true; diff --git a/hosts/hl-bigbox2/default.nix b/hosts/hl-bigbox2/default.nix index 9d187a3..10d4410 100644 --- a/hosts/hl-bigbox2/default.nix +++ b/hosts/hl-bigbox2/default.nix @@ -13,14 +13,14 @@ user.enable = true; nixos.common = { ssh-server.enable = true; - containers.openMetricsPort = true; + containers.networks.ipvlanLab = { enable = true; parent = "enp3s0"; }; cachePush.enable = false; }; - server.exporters.enable = true; + networkDrives = { enable = true; bigBox2.enable = false; diff --git a/hosts/hl-minipc1/default.nix b/hosts/hl-minipc1/default.nix index 4eb40c0..6f08f0d 100644 --- a/hosts/hl-minipc1/default.nix +++ b/hosts/hl-minipc1/default.nix @@ -44,13 +44,13 @@ in addressesSecretName = "dns-addresses.conf"; }; skyg.nixos.common.containers.runtime = "docker"; - skyg.nixos.common.containers.openMetricsPort = true; + skyg.nixos.common.containers.networks.ipvlanLab = { enable = true; parent = "eno1"; }; skyg.server.admin.enable = true; - skyg.server.exporters.enable = true; + skyg.nixos.server.k3s.enable = false; skyg.networkDrives.enable = true; diff --git a/hosts/hl-minipc2/default.nix b/hosts/hl-minipc2/default.nix index 1013d72..dfea8ec 100644 --- a/hosts/hl-minipc2/default.nix +++ b/hosts/hl-minipc2/default.nix @@ -23,8 +23,8 @@ in openFirewall = true; addressesSecretName = "dns-addresses.conf"; }; - skyg.nixos.common.containers.openMetricsPort = true; - skyg.server.exporters.enable = true; + + skyg.networkDrives.enable = true; networking.firewall.enable = false; diff --git a/hosts/hl-minipc3/default.nix b/hosts/hl-minipc3/default.nix index 2508b92..c163341 100644 --- a/hosts/hl-minipc3/default.nix +++ b/hosts/hl-minipc3/default.nix @@ -14,8 +14,8 @@ openFirewall = true; addressesSecretName = "dns-addresses.conf"; }; - skyg.nixos.common.containers.openMetricsPort = true; - skyg.server.exporters.enable = true; + + skyg.nixos.server.k3s = { enable = true; envPath = "/opt/k3s/k3s.env"; diff --git a/hosts/hl-terra1/default.nix b/hosts/hl-terra1/default.nix index 01f017f..8efc626 100644 --- a/hosts/hl-terra1/default.nix +++ b/hosts/hl-terra1/default.nix @@ -28,7 +28,7 @@ in }; skyg.nixos.desktop.enable = false; skyg.server.admin.enable = true; - skyg.server.exporters.enable = true; + environment.systemPackages = with pkgs; [ btrfs-progs ]; diff --git a/modules/nixos/ABOUTME.md b/modules/nixos/ABOUTME.md index c7ef994..8bcd45b 100644 --- a/modules/nixos/ABOUTME.md +++ b/modules/nixos/ABOUTME.md @@ -28,7 +28,7 @@ nixos/ skyg.nixos.common.* → common/ skyg.nixos.desktop.* → desktop/ skyg.nixos.server.* → server/ (most services) -skyg.server.* → server/ (arrs, admin, exporters, timers, dns — legacy prefix) +skyg.server.* → server/ (arrs, admin, timers, dns — legacy prefix) skyg.core.qemu.* → common/qemu.nix ``` diff --git a/modules/nixos/common/containers/ABOUTME.md b/modules/nixos/common/containers/ABOUTME.md index dea21d1..f361bbe 100644 --- a/modules/nixos/common/containers/ABOUTME.md +++ b/modules/nixos/common/containers/ABOUTME.md @@ -24,17 +24,16 @@ containers/ ## Runtime selection (`skyg.nixos.common.containers`) Picks **one** of Docker or Podman based on `runtime` and configures it -consistently (compose tooling, user group membership, OCI backend, metrics). +consistently (compose tooling, user group membership, OCI backend). - `runtime` defaults to `"docker"`. Each backend file gates on `cfg.runtime == ""`, so exactly one applies. - **Docker** enables autoprune, sets `insecure-registries` from `localDockerRegistries` - (default `minipc1.lab.internal:5001`), exposes metrics on `metricsPort` (9323), adds the - user to the `docker` group, and installs `docker-compose`. + (default `minipc1.lab.internal:5001`), adds the user to the `docker` group, and installs + `docker-compose`. Engine metrics are deliberately off (removed; no scraper, unauthenticated). - **Podman** enables `dockerCompat` + docker socket so `docker`/`oci-containers` keep working, allows plain-HTTP pulls from `localDockerRegistries` via `virtualisation.containers.registries.insecure`, and installs `podman-compose` + `podman-tui`. -- `openMetricsPort` opens the metrics port in the firewall (Docker only). ### Option namespace @@ -43,8 +42,7 @@ skyg.nixos.common.containers.enable → false to disable the con skyg.nixos.common.containers.runtime → "docker" | "podman" skyg.nixos.common.containers.enableOnBoot skyg.nixos.common.containers.localDockerRegistries -skyg.nixos.common.containers.metricsPort -skyg.nixos.common.containers.openMetricsPort + skyg.nixos.common.containers.networks.macvlanLab.* → predefined macvlan lab network skyg.nixos.common.containers.networks.ipvlanLab.* → predefined ipvlan lab network skyg.nixos.common.containers.networks.extra..* → custom networks (networks.nix) diff --git a/modules/nixos/common/containers/default.nix b/modules/nixos/common/containers/default.nix index d7ff091..f091a6e 100644 --- a/modules/nixos/common/containers/default.nix +++ b/modules/nixos/common/containers/default.nix @@ -27,11 +27,7 @@ type = lib.types.listOf lib.types.str; default = [ "minipc1.lab.internal:5001" ]; }; - metricsPort = lib.mkOption { - type = lib.types.number; - default = 9323; - }; - openMetricsPort = lib.mkEnableOption "Open container metrics port"; + }; }; } diff --git a/modules/nixos/common/containers/docker.nix b/modules/nixos/common/containers/docker.nix index bc715b7..e1bb77f 100644 --- a/modules/nixos/common/containers/docker.nix +++ b/modules/nixos/common/containers/docker.nix @@ -12,20 +12,11 @@ in liveRestore = false; daemon.settings = { insecure-registries = cfg.localDockerRegistries; - metrics-addr = "0.0.0.0:${toString cfg.metricsPort}"; + }; }; environment.systemPackages = with pkgs; [ docker-compose ]; users.users.${config.skyg.user.name}.extraGroups = [ "docker" ]; virtualisation.oci-containers.backend = "docker"; - networking.firewall.allowedUDPPorts = - (if cfg.openMetricsPort then [ - cfg.metricsPort - ] else [ ]); - networking.firewall.allowedTCPPorts = - (if cfg.openMetricsPort then [ - cfg.metricsPort - ] else [ ]); - }; } diff --git a/modules/nixos/server/ABOUTME.md b/modules/nixos/server/ABOUTME.md index 5a8f288..1e1866c 100644 --- a/modules/nixos/server/ABOUTME.md +++ b/modules/nixos/server/ABOUTME.md @@ -10,7 +10,7 @@ switch, so a host only runs what it explicitly turns on. server/ ├── default.nix # imports everything below ├── admin.nix # skyg.server.admin — www-data group/user for shared web data -├── exporters.nix # skyg.server.exporters — Prometheus node exporter (:9100) + ├── timers.nix # skyg.server.timers — generic attrset → systemd timer+oneshot service ├── acme/ # skyg.server.acme — Let's Encrypt certs via DNS-01 (lego), no internet exposure ├── arrs/ # *arr media-automation stack (prowlarr/sonarr/radarr) + postgres @@ -26,17 +26,16 @@ server/ - **`timers.nix`** is a reusable helper: anything added to `skyg.server.timers.` (with `script`, `OnCalendar`, `wantedBy`) becomes a systemd timer + oneshot service. Host files (e.g. `hosts/hl-minipc2.nix`'s scrypted-backups) use it for backups/auto-updates. -- **`exporters.nix`** enables the Prometheus node exporter with the systemd collector and - opens port 9100. +- No Prometheus exporters: the node exporter module was removed (unauthenticated, no scraper). - Naming: this tree mostly uses the legacy `skyg.server.*` prefix for cross-cutting modules - (admin/exporters/timers/arrs/dns) and `skyg.nixos.server.*` for the K3s/K8s roles and the + (admin/timers/arrs/dns) and `skyg.nixos.server.*` for the K3s/K8s roles and the service modules under `services/`. ## Option Namespace ``` skyg.server.admin.enable → admin.nix -skyg.server.exporters.enable → exporters.nix + skyg.server.timers. → timers.nix skyg.server.acme.* → acme/ skyg.server.arrs.* → arrs/ diff --git a/modules/nixos/server/GUIDELINES.md b/modules/nixos/server/GUIDELINES.md index 721174c..03410b5 100644 --- a/modules/nixos/server/GUIDELINES.md +++ b/modules/nixos/server/GUIDELINES.md @@ -35,12 +35,12 @@ Then add it to `services/default.nix`'s `imports` list (and to the `services/ABO the `allowedTCPPorts`/`allowedUDPPorts` in `lib.mkIf cfg.openFirewall`. 3. **Pick the namespace that matches the neighbours.** Service modules under `services/` and the K3s/K8s roles use `skyg.nixos.server.*`; the older cross-cutting modules - (`admin`, `exporters`, `timers`, `arrs`, `dns`) use `skyg.server.*`. Don't invent a third. + (`admin`, `timers`, `arrs`, `dns`) use `skyg.server.*`. Don't invent a third. 4. **Containers go through `virtualisation.oci-containers`.** This honours the Docker/Podman choice from `modules/nixos/common/containers/`. Don't hardcode `docker run` in a service (the `openwrt` deploy script is the only sanctioned shell-out, and it lives elsewhere). 5. **NFS-backed volumes**: create them with `system.activationScripts` + `docker volume - create --driver local --opt type=nfs`, and reference homelab hosts by +create --driver local --opt type=nfs`, and reference homelab hosts by their `*.lab.internal` names. 6. **Scheduled jobs** (backups, auto-updates) should use the `skyg.server.timers.` helper in `timers.nix` rather than hand-writing `systemd.timers`/`systemd.services`. diff --git a/modules/nixos/server/default.nix b/modules/nixos/server/default.nix index b23d6a0..502aa38 100644 --- a/modules/nixos/server/default.nix +++ b/modules/nixos/server/default.nix @@ -1,7 +1,7 @@ { ... }: { imports = [ - ./exporters.nix + ./admin.nix ./acme ./arrs diff --git a/modules/nixos/server/exporters.nix b/modules/nixos/server/exporters.nix deleted file mode 100644 index 26389e0..0000000 --- a/modules/nixos/server/exporters.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ config, lib, ... }: -let cfg = config.skyg.server.exporters; -in { - options = { - skyg.server.exporters = { - enable = lib.mkEnableOption - "Enable Special prom exporters for servers"; - }; - }; - config = lib.mkIf cfg.enable { - services.prometheus.exporters = { - node = { - enable = true; - enabledCollectors = [ "systemd" ]; - openFirewall = true; - port = 9100; - }; - }; - }; -}