@cryptotaxi247 / infra-1 / commits / 713e6a05

Bring more machines in to prom

Graham Christensen committed Sep 26, 2019 at 04:28 UTC 713e6a0518bf336b74d0a8890f1d3094387c585c
1 file changed +11 -20
delft/eris.nix
+11 -20
@@ -1,6 +1,9 @@
1 -{ nodes, config, lib, pkgs, ... }:
1 +{ resources, config, lib, pkgs, ... }:
2 +let
3 + inherit (lib) filterAttrs flip mapAttrsToList;
4
3 -{
5 + macs = filterAttrs (_: v: (v.macosGuest or {}).enable or false) resources.machines;
6 +in {
7 imports =
8 [
9 ../modules/wireguard.nix
@@ -9,8 +12,8 @@
12 deployment.targetEnv = "hetzner";
13 deployment.hetzner.mainIPv4 = "138.201.32.77";
14
15 +
16 networking.extraHosts = ''
13 - 46.4.67.10 chef
17 147.75.198.47 packet-epyc-1
18 147.75.98.145 packet-t2-4
19 147.75.79.198 packet-t2a-2
@@ -19,13 +22,9 @@
22 147.75.107.178 packet-t2a6-ampere-1
23
24
22 - '' + (let
23 - nums = lib.lists.range 1 9;
24 - name = num: ''
25 - 37.153.215.191 mac${toString num}-host
26 - 37.153.215.191 mac${toString num}-guest
27 - '';
28 - in lib.strings.concatMapStrings name nums);
25 + '' + (toString (flip mapAttrsToList macs (machine: v: ''
26 + ${v.deployment.targetHost} ${machine}
27 + '')));
28
29 networking.firewall.allowedTCPPorts = [
30 443 80 # nginx
@@ -62,10 +61,7 @@
61 job_name = "node";
62 static_configs = [
63 {
65 - targets = [
66 - "chef:9100"
67 - ];
68 - labels.role = "hydra";
64 + targets = flip mapAttrsToList resources.machines (machine: v: "${v.networking.hostName}:9100");
65 }
66 {
67 targets = [
@@ -77,12 +73,7 @@
73 labels.role = "builder";
74 }
75 {
80 - targets = builtins.map (n: "mac${toString n}-host:6010") (lib.lists.range 1 9);
81 - labels.mac = "host";
82 - labels.role = "macos-hypervisor";
83 - }
84 - {
85 - targets = builtins.map (n: "mac${toString n}-guest:6010") (lib.lists.range 1 9);
76 + targets = flip mapAttrsToList macs (machine: v: "${machine}:9101");
77 labels.mac = "guest";
78 labels.role = "builder";
79 }