Commit Graph
16 Commits
Author SHA1 Message Date
root 71ae25a58c fix: move unsafe_routes to settings.tun.unsafe_routes (correct NixOS nebula option path)
buildbot/nix-eval Build done.
2026-04-01 17:13:37 -05:00
root 0e61efe5b5 fix: rename tun.dev to tun.device (correct NixOS option name)
buildbot/nix-eval Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-exodus Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-genesis Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-isaiah Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-zeke Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-jeremiah Build done.
buildbot/nix-build Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-hosea Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-linode Build done.
2026-04-01 17:07:47 -05:00
root 84e4c68f0e fix: move unsafeRoutes to module default, genesis overrides to []
buildbot/nix-eval Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-genesis Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-exodus Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-hosea Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-isaiah Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-jeremiah Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-linode Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-zeke Build done.
buildbot/nix-build Build done.
Per review feedback:
- nebula module now defaults unsafeRoutes to [{route=10.42.0.0/16 via=10.157.0.2}]
  so all regular nodes get home LAN routing automatically
- genesis overrides unsafeRoutes=[] since it IS the routing node (avoids loop)
- exodus and all k3s nodes (hosea, isaiah, jeremiah, zeke) simplified to
  nebula.enable = true only, relying on the new default
2026-04-01 16:45:59 -05:00
root 792217f640 feat: add Nebula mesh network overlay
buildbot/nix-eval Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-exodus Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-isaiah Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-genesis Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-linode Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-jeremiah Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-zeke Build done.
buildbot/nix-build gitea:greg/nixos#checks.x86_64-linux.nixos-hosea Build done.
buildbot/nix-build Build done.
Introduces a greg.nebula NixOS module and enables it across all managed
hosts for the nebula.thehellings.com overlay (CIDR: 10.157.0.0/16).

Architecture:
- linode: lighthouse + relay (public internet, UDP 4242)
- genesis: regular node + unsafe_routes router for 10.42.0.0/16 (home LAN)
- hosea, isaiah, jeremiah, zeke, exodus: regular nodes with unsafe_routes
  pointing to genesis to reach the home LAN

Changes:
- modules/nixos/nebula.nix: new greg.nebula module
  - isLighthouse / isRelay options
  - unsafeRoutes option (tun.unsafe_routes)
  - routesSubnet option: enables IP forwarding + nftables masquerade NAT
    on the gateway host (genesis) so Nebula peers reach 10.42.0.0/16
  - agenix secret reference per-host (secrets/nebula/<name>.key.age)
  - opens UDP/4242 in the firewall
- modules/nixos/default.nix: import nebula.nix
- hosts/unstable/linode/default.nix: greg.nebula.isLighthouse = true
- hosts/unstable/genesis/default.nix: greg.nebula.routesSubnet = "10.42.0.0/16"
- hosts/unstable/{hosea,isaiah,jeremiah,zeke,exodus}/default.nix:
  greg.nebula.enable = true with unsafeRoutes via genesis
- network.json: add nebulaIp field for each managed host
- secrets/secrets.nix: declare nebula/<host>.key.age entries
- secrets/nebula/README.md: full PKI bootstrap guide (CA, certs, agenix)
2026-03-28 23:24:52 -05:00
root 07b3601206 feat: add top-5 fullest PVs panel to Kubernetes dashboard
buildbot/nix-eval Build done. (1 warning)
buildbot/nix-build Build done.
Add a horizontal bar gauge showing the disk usage % of the 5 most-full
PersistentVolumes in the cluster, using kubelet volume stats already
scraped by Prometheus:

  topk(5, kubelet_volume_stats_used_bytes
           / kubelet_volume_stats_capacity_bytes * 100)

Labels show namespace/PVC name. Color thresholds: green <70%, yellow
70–90%, red >90%. Placed at the bottom of the dashboard (y=46).

Bump dashboard version to 3.
2026-03-27 09:06:19 -05:00
root de0b8fb07e fix: correct unpoller metric names in network dashboard
buildbot/nix-eval Build done. (1 warning)
buildbot/nix-build Build done.
All metrics had wrong prefix (unifipoller_ → unpoller_) and several
had incorrect names entirely. Corrected against unpoller master source
(pkg/promunifi/):

- unifipoller_device_uptime_seconds → unpoller_device_uptime_seconds
- unifipoller_port_receive_bytes_total → unpoller_device_port_receive_bytes_total
  (port metrics live under device_ namespace: unpoller_device_port_*)
- unifipoller_port_transmit_bytes_total → unpoller_device_port_transmit_bytes_total
- unifipoller_device_wan_receive_bytes_total → unpoller_wan_max_rx_bytes_rate
  (no per-device WAN bytes total counter; WAN ns is unpoller_wan_*;
   rate metrics are already instantaneous gauges, no rate() wrapper)
- unifipoller_device_wan_transmit_bytes_total → unpoller_wan_max_tx_bytes_rate
- unifipoller_client_wifi_tx_rate_bps → count(unpoller_client_uptime_seconds{wired="false"})
  (no wifi-specific rate metric; wired label distinguishes client types)
- unifipoller_client_wired_tx_rate_bps → count(unpoller_client_uptime_seconds{wired="true"})
- unifipoller_client_receive_bytes_total → unpoller_client_receive_bytes_total
- unifipoller_client_transmit_bytes_total → unpoller_client_transmit_bytes_total

Bump dashboard version to 3.
2026-03-27 08:44:12 -05:00
root 8e218a71e0 fix: add missing shire-zebra.ts.net DNS entries; update exodus Tailscale IP
buildbot/nix-eval Build done. (1 warning)
buildbot/nix-build Build done.
genesis, zeke, linode, and exodus were missing shire-zebra.ts.net
aliases in the genesis dnsmasq hosts file. Only hosea, isaiah,
jeremiah, gitlab, matrix, chronicles, and nas1 had them. Since
genesis is the DNS server for the whole network, Prometheus (and
everything else) couldn't resolve those four hostnames, causing
instant connection failures on scrape.

Also update exodus Tailscale IP from 100.80.99.48 to 100.70.99.91
(stale IP in both network.json and the hosts file).
2026-03-25 21:12:51 -05:00
root 053e383046 fix: disable Grafana enforce_domain to allow LAN proxy access
buildbot/nix-build Build done.
buildbot/nix-eval Build done. (1 warning)
With enforce_domain = true, Grafana redirects any request not matching
the configured domain (hosea.shire-zebra.ts.net) back to that hostname.
Since the nginx proxy serves Grafana at grafana.thehellings.lan, every
proxied request gets redirected to the Tailscale address, making the
proxy useless for non-Tailscale clients.

The domain setting is still correct for cookie scoping; enforce_domain
is only needed if direct port access is a concern, which is mitigated
by the firewall (port 3001 is not open on the LAN).
2026-03-25 17:40:38 -05:00
root a5719c4e02 fix: open ports 80/443 in proxy module when proxies are configured
buildbot/nix-eval Build done. (1 warning)
buildbot/nix-build Build done.
The greg.proxies module enables nginx but never opened the firewall,
so all proxied services (Jellyfin, Grafana, etc.) were unreachable
on the LAN. Add allowedTCPPorts [80 443] conditioned on the same
mkIf guard as the nginx virtualHosts config.
2026-03-25 17:35:52 -05:00
root b143543ba1 feat: add grafana DNS entries to genesis hosts file
buildbot/nix-eval Build done. (1 warning)
buildbot/nix-build Build done.
Add grafana.thehellings.lan (LAN) and grafana.home (Tailscale)
pointing at hosea's respective addresses, matching the pattern
used for jellyfin and other hosea-hosted services.
2026-03-25 17:22:54 -05:00
root fb5daa3be7 feat: proxy Grafana via nginx on hosea LAN hostnames
buildbot/nix-eval Build done. (1 warning)
Add grafana.home and grafana.thehellings.lan nginx proxy entries
pointing at localhost:3001. This allows LAN clients (and Klaatu)
to reach Grafana without Tailscale or direct port access, working
around the enforce_domain restriction on hosea.shire-zebra.ts.net.
2026-03-25 17:21:21 -05:00
root 2d874d3969 fix: two observability bugs from initial deployment
buildbot/nix-eval Build done. (1 warning)
buildbot/nix-build Build done.
Fix 1 - UnPoller 404 on UDM Pro:
  Remove :8443 from UP_UNIFI_DEFAULT_URL. UniFi OS devices (UDM Pro,
  UDM, UXG, CloudKey) use a different API path and do NOT use port 8443.
  URL should be https://10.42.1.1 (no port); unpoller handles the
  /proxy/network path internally for UniFi OS devices.

Fix 2 - Grafana dashboards showing invalid datasource:
  Add uid = "prometheus" to the provisioned Prometheus datasource.
  Without an explicit UID, Grafana auto-generates one on first run.
  All dashboard JSON references datasource uid "prometheus" which
  only works if the provisioning explicitly sets that UID.
2026-03-25 12:37:29 -05:00
root 4eebf07f6b fix: scope prometheus exporter firewall rules to home hosts only
buildbot/nix-eval Build done.
Move allowedTCPPorts for node/ping/systemd/blackbox exporters from
hosts/baseline.nix (applies to ALL hosts including linode) into
modules/nixos/home.nix (applies only to greg.home = true hosts).

This prevents ports 9100/9115/9427/9558 from being opened on linode,
which is internet-facing. All LAN hosts set greg.home = true and will
still get the ports opened; linode sets greg.home = false and will not.
2026-03-25 09:46:26 -05:00
root df2f9d69fe fix: address PR feedback + expand infrastructure coverage
buildbot/nix-eval Build done. (1 warning)
- Replace unpoller-credentials plain Secret with ExternalSecret
  pulling from Bitwarden item 15bfc957-5de5-49b2-ab6c-b41800e71564
  via bitwarden-login ClusterSecretStore (username + password)
- Pull UP_UNIFI_DEFAULT_USER from secret as well (was hardcoded)

- Add OpenWRT access point (10.42.0.3) to genesis DNS hosts file
  as ap.thehellings.lan (discovered during network scan)

- Add blackbox exporter to genesis (port 9115, ICMP module)
  for probing non-NixOS infrastructure that has no node_exporter:
  OpenWRT AP, Joel, pve1, chronicles, nas1, odoo, mattermost,
  homeassistant, USW-Pro-HD-24 UniFi switch

- Add infra_ping scrape job to Prometheus using blackbox prober
  targeting all non-NixOS LAN hosts via genesis blackbox exporter
2026-03-25 09:25:16 -05:00
root ab6e1d24fe feat: comprehensive observability stack
- Add restic_backups and mattermost scrape jobs to Prometheus config
- Add UnPoller deployment+service+secret for UniFi metrics (unpoller.yaml)
- Add unifi scrape job targeting unpoller in-cluster
- Add 4 Grafana dashboards as NixOS-managed etc files on hosea:
  - system-health: CPU, memory, disk, network per host
  - backup-health: restic backup freshness and duration
  - kubernetes: pod counts, restart rates, node resources
  - network: DNS queries, DHCP leases, UniFi ports, ping latency
- Add grafana-api-token agenix secret placeholder on hosea
- Open firewall ports 9100/9427/9558 for prometheus exporters in baseline.nix
2026-03-25 09:23:31 -05:00
root 7fee882488 fix: security and monitoring improvements
buildbot/nix-eval Build done.
Issue 1 - Grafana secret key:
- Replace hardcoded '123456789' secret_key in hosea Grafana config
  with an agenix-managed secret ($__file interpolation)
- Add age.secrets.grafana-secret-key declaration to hosea config
- Register grafana-secret-key.age in secrets/secrets.nix (publicKeys=everyone)
- NOTE: The .age file still needs to be created by running:
    agenix -e secrets/grafana-secret-key.age
  and entering a strong random secret (e.g. from 'pwgen -s 64 1')

Issue 2 - Prometheus stale targets:
- Remove retired vm-gitlab host from all three scrape jobs
  (node, systemd, ping) in manifests/monitoring/config.yaml
- linode was already present in all scrape jobs

Issue 3 - Prometheus alerting gaps:
- Wire up rule_files in prometheus.yml pointing at alerts.yml
- Add manifests/monitoring/alerts.yaml with alerting rules:
    * HostDown (node unreachable > 2m) - critical
    * HighCPULoad (>90% for 10m) - warning
    * LowDiskSpace (<10% free) - warning
    * CriticalDiskSpace (<5% free) - critical
    * HighMemoryUsage (>90% for 10m) - warning
    * ResticBackupStaleness (no success > 26h) - warning
    * PodCrashLooping - warning
    * PodNotReady (>10m) - warning
- Mount alerts ConfigMap as separate volume subPath in deployment
  so prometheus.yml and alerts.yml are both accessible at
  /etc/prometheus/ without conflicts
2026-03-25 06:02:17 -05:00