mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-13 12:13:36 +01:00
Merge pull request #329 from ryan4yin/youko-shushou-ssd-swap
hosts: swap youko/shushou roles to fix Jellyfin HDR transcoding
This commit is contained in:
8 files changed
+69
-56
No files matched your search
@@ -24,20 +24,6 @@
|
||||
config.imports = [ ../k8s/k3s-test-1-master-3 ];
|
||||
};
|
||||
|
||||
microvm.vms.k3s-test-1-worker-2 = {
|
||||
autostart = true;
|
||||
restartIfChanged = true;
|
||||
specialArgs = {
|
||||
inherit
|
||||
myvars
|
||||
mylib
|
||||
agenix
|
||||
mysecrets
|
||||
;
|
||||
};
|
||||
config.imports = [ ../k8s/k3s-test-1-worker-2 ];
|
||||
};
|
||||
|
||||
microvm.vms.k3s-test-1-worker-3 = {
|
||||
autostart = true;
|
||||
restartIfChanged = true;
|
||||
@@ -54,8 +40,7 @@
|
||||
|
||||
# Attach the guest's tap to the VM bridge, the same way the physical NIC is
|
||||
# attached. The tap name is derived from the guest IP (192.168.5.116 -> vm116,
|
||||
# 192.168.5.112 -> vm112, 192.168.5.113 -> vm113), as IFNAMSIZ caps interface
|
||||
# names at 15 characters.
|
||||
# 192.168.5.113 -> vm113), as IFNAMSIZ caps interface names at 15 characters.
|
||||
systemd.network.networks."20-vm116" = {
|
||||
matchConfig.Name = [ "vm116" ];
|
||||
networkConfig = {
|
||||
@@ -64,14 +49,6 @@
|
||||
};
|
||||
linkConfig.RequiredForOnline = "no";
|
||||
};
|
||||
systemd.network.networks."20-vm112" = {
|
||||
matchConfig.Name = [ "vm112" ];
|
||||
networkConfig = {
|
||||
LinkLocalAddressing = "no";
|
||||
Bridge = "br0";
|
||||
};
|
||||
linkConfig.RequiredForOnline = "no";
|
||||
};
|
||||
systemd.network.networks."20-vm113" = {
|
||||
matchConfig.Name = [ "vm113" ];
|
||||
networkConfig = {
|
||||
|
||||
@@ -100,10 +100,12 @@ in
|
||||
params.ups = [ "homelab" ];
|
||||
static_configs = [
|
||||
{
|
||||
targets = [ "${myvars.networking.hostsAddr.shushou.ipv4}:9199" ];
|
||||
# same-host nut exporter bound to loopback (127.0.0.1:9199); the
|
||||
# UPS moved to this host with the SSD swap
|
||||
targets = [ "127.0.0.1:9199" ];
|
||||
labels.type = "app";
|
||||
labels.app = "nut";
|
||||
labels.host = "shushou";
|
||||
labels.host = "youko";
|
||||
labels.env = "homelab";
|
||||
labels.cluster = "homelab";
|
||||
}
|
||||
|
||||
@@ -24,8 +24,25 @@
|
||||
config.imports = [ ../k8s/k3s-test-1-master-2 ];
|
||||
};
|
||||
|
||||
# Moved here from shushou after the SSD swap: the 5625U there is weaker and has
|
||||
# only 22 GiB, too little for this 16 GiB worker.
|
||||
microvm.vms.k3s-test-1-worker-2 = {
|
||||
autostart = true;
|
||||
restartIfChanged = true;
|
||||
specialArgs = {
|
||||
inherit
|
||||
myvars
|
||||
mylib
|
||||
agenix
|
||||
mysecrets
|
||||
;
|
||||
};
|
||||
config.imports = [ ../k8s/k3s-test-1-worker-2 ];
|
||||
};
|
||||
|
||||
# Attach the guest's tap to the VM bridge, the same way the physical NIC is
|
||||
# attached. The tap name is derived from the guest IP (192.168.5.115 -> vm115).
|
||||
# attached. The tap name is derived from the guest IP (192.168.5.115 -> vm115,
|
||||
# 192.168.5.112 -> vm112), as IFNAMSIZ caps interface names at 15 characters.
|
||||
systemd.network.networks."20-vm115" = {
|
||||
matchConfig.Name = [ "vm115" ];
|
||||
networkConfig = {
|
||||
@@ -34,4 +51,12 @@
|
||||
};
|
||||
linkConfig.RequiredForOnline = "no";
|
||||
};
|
||||
systemd.network.networks."20-vm112" = {
|
||||
matchConfig.Name = [ "vm112" ];
|
||||
networkConfig = {
|
||||
LinkLocalAddressing = "no";
|
||||
Bridge = "br0";
|
||||
};
|
||||
linkConfig.RequiredForOnline = "no";
|
||||
};
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
{ myvars, ... }:
|
||||
let
|
||||
hostAddress = myvars.networking.hostsAddr.shushou.ipv4;
|
||||
in
|
||||
{ ... }:
|
||||
{
|
||||
# The UPS (Cypress USB-to-serial, 0665:5161) is attached to this host, which is
|
||||
# now the homelab core. Metrics only for now; coordinated shutdown of all
|
||||
# homelab hosts is a separate feature.
|
||||
power.ups = {
|
||||
enable = true;
|
||||
mode = "standalone";
|
||||
|
||||
# Metrics only. Coordinated shutdown of all homelab hosts is a separate feature.
|
||||
upsmon = {
|
||||
enable = false;
|
||||
settings.POWERDOWNFLAG = null;
|
||||
@@ -33,7 +32,7 @@ in
|
||||
|
||||
services.prometheus.exporters.nut = {
|
||||
enable = true;
|
||||
listenAddress = hostAddress;
|
||||
listenAddress = "127.0.0.1";
|
||||
port = 9199;
|
||||
nutServer = "127.0.0.1";
|
||||
|
||||
+17
-8
@@ -34,20 +34,29 @@ Named after characters from "Frieren: Beyond Journey's End":
|
||||
|
||||
Named after "Twelve Kingdoms":
|
||||
|
||||
| Host | Platform | Hardware | Purpose | Status |
|
||||
| --------- | -------- | -------------------------------------- | ---------------------- | --------- |
|
||||
| `shoukei` | NixOS | MacBook Pro M2 | NixOS on Apple Silicon | ✅ Active |
|
||||
| `shoryu` | NixOS | MoreFine S500Plus (AMD Ryzen 9 5900HX) | VM Host | ✅ Active |
|
||||
| `shushou` | NixOS | MinisForum UM560 (AMD Ryzen 5 5625U) | VM Host | ✅ Active |
|
||||
| `youko` | NixOS | MinisForum HX99G (AMD Ryzen 9 6900HX) | VM Host | ✅ Active |
|
||||
| Host | Platform | Hardware | Purpose | Status |
|
||||
| --------- | -------- | ------------------------------------ | ---------------------- | --------- |
|
||||
| `shoukei` | NixOS | MacBook Pro M2 | NixOS on Apple Silicon | ✅ Active |
|
||||
| `shoryu` | NixOS | MoreFine S500+ (AMD Ryzen 7 5825U) | VM Host | ✅ Active |
|
||||
| `shushou` | NixOS | MinisForum UM560 (AMD Ryzen 5 5625U) | VM Host | ✅ Active |
|
||||
| `youko` | NixOS | Beelink GTR5 (AMD Ryzen 9 5900HX) | Homelab Core | ✅ Active |
|
||||
|
||||
On 2026-09-29 the NVMe SSDs of `youko` and `shushou` were physically swapped, and the 2×4TB USB HDDs
|
||||
moved with the `youko` role to the other chassis. The reason was Jellyfin: HDR transcoding on the
|
||||
5625U's Barceló iGPU could not keep up (~0.4–0.8×), while the 5900HX's Cezanne iGPU can (~1.68× for
|
||||
1080p HDR). So the homelab-core role (all services + one k3s VM + the HDDs + the UPS) now runs on
|
||||
the Beelink GTR5 and the k3s VM-host role on the UM560; the other services moving along is a side
|
||||
effect of swapping the role's disk, not a separate migration. Hostnames, IPs, and state followed the
|
||||
disks.
|
||||
|
||||
### Virtual Machines & Clusters
|
||||
|
||||
#### `k8s` - Kubernetes Infrastructure
|
||||
|
||||
- **VM Cluster**: 3 physical mini PCs (shoryu, shushou, youko) running all VMs
|
||||
- **K3s Testing**: `k3s-test-1-master-{1,2,3}` (control plane) + `k3s-test-1-worker-{1,2,3}`
|
||||
(workloads; two on `shushou`, one on `shoryu`), running as microVMs
|
||||
- **K3s Testing**: `k3s-test-1-master-{1,2,3}` (control plane; one per host) +
|
||||
`k3s-test-1-worker-{1,2,3}` (workloads; `worker-1` on `shoryu`, `worker-2` on `youko`, `worker-3`
|
||||
on `shushou`), running as microVMs
|
||||
|
||||
### External Systems
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ let
|
||||
inherit pkgs hostName;
|
||||
inherit (myvars) networking;
|
||||
vcpu = 2;
|
||||
mem = 8192;
|
||||
mem = 4096;
|
||||
varSize = 20480;
|
||||
};
|
||||
k3sModule = mylib.genK3sServerModule {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
exporter = {
|
||||
enable = true;
|
||||
listenAddress = "192.168.5.182";
|
||||
listenAddress = "127.0.0.1";
|
||||
port = 9199;
|
||||
nutServer = "127.0.0.1";
|
||||
exportsAllNumericVariables = true;
|
||||
@@ -32,11 +32,11 @@
|
||||
scrape_interval = "30s";
|
||||
metrics_path = "/ups_metrics";
|
||||
params.ups = [ "homelab" ];
|
||||
target = "192.168.5.182:9199";
|
||||
target = "127.0.0.1:9199";
|
||||
labels = {
|
||||
type = "app";
|
||||
app = "nut";
|
||||
host = "shushou";
|
||||
host = "youko";
|
||||
env = "homelab";
|
||||
cluster = "homelab";
|
||||
};
|
||||
|
||||
@@ -4,27 +4,28 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
shushou = outputs.nixosConfigurations.shushou.config;
|
||||
aquamarine = outputs.nixosConfigurations.youko.config;
|
||||
ups = shushou.power.ups.ups.homelab or { };
|
||||
exporter = shushou.services.prometheus.exporters.nut;
|
||||
# The UPS moved to youko with the SSD swap; the NUT daemons, the exporter, and
|
||||
# the victoriametrics scrape job now all live on the same host.
|
||||
youko = outputs.nixosConfigurations.youko.config;
|
||||
ups = youko.power.ups.ups.homelab or { };
|
||||
exporter = youko.services.prometheus.exporters.nut;
|
||||
exporterService =
|
||||
shushou.systemd.services.prometheus-nut-exporter or {
|
||||
youko.systemd.services.prometheus-nut-exporter or {
|
||||
after = [ ];
|
||||
requires = [ ];
|
||||
};
|
||||
scrapeJobs = builtins.filter (
|
||||
job: (job.job_name or "") == "nut-exporter-homelab-ups"
|
||||
) aquamarine.services.victoriametrics.prometheusConfig.scrape_configs;
|
||||
) youko.services.victoriametrics.prometheusConfig.scrape_configs;
|
||||
scrapeJob = if builtins.length scrapeJobs == 1 then builtins.head scrapeJobs else null;
|
||||
in
|
||||
{
|
||||
nut = {
|
||||
enable = shushou.power.ups.enable;
|
||||
mode = shushou.power.ups.mode;
|
||||
upsmonEnable = shushou.power.ups.upsmon.enable;
|
||||
killPowerEnable = shushou.systemd.services.ups-killpower.enable or false;
|
||||
upsdListen = shushou.power.ups.upsd.listen;
|
||||
enable = youko.power.ups.enable;
|
||||
mode = youko.power.ups.mode;
|
||||
upsmonEnable = youko.power.ups.upsmon.enable;
|
||||
killPowerEnable = youko.systemd.services.ups-killpower.enable or false;
|
||||
upsdListen = youko.power.ups.upsd.listen;
|
||||
driver = ups.driver or null;
|
||||
port = ups.port or null;
|
||||
vendorId = builtins.elem "vendorid = 0665" (ups.directives or [ ]);
|
||||
|
||||
Reference in new issue
Block a user