killing exporters

This commit is contained in:
ari committed 2026-10-16 16:59:09 -04:00
1 parent 3b764654d2
commit e719674851
14 files changed
+25 -61

No files matched your search

+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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";
+1 -1
View File
@@ -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 ];
+1 -1
View File
@@ -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
```
+4 -6
View File
@@ -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 == "<name>"`,
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.<name>.* → custom networks (networks.nix)
+1 -5
View File
@@ -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";
};
};
}
+1 -10
View File
@@ -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 [ ]);
};
}
+4 -5
View File
@@ -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.<name>`
(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.<name> → timers.nix
skyg.server.acme.* → acme/
skyg.server.arrs.* → arrs/
+2 -2
View File
@@ -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.<name>`
helper in `timers.nix` rather than hand-writing `systemd.timers`/`systemd.services`.
+1 -1
View File
@@ -1,7 +1,7 @@
{ ... }:
{
imports = [
./exporters.nix
./admin.nix
./acme
./arrs
-20
View File
@@ -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;
};
};
};
}