diff --git a/config/services/hydra/nix-config.nix b/config/services/hydra/nix-config.nix index 03d7fb3..d599d18 100644 --- a/config/services/hydra/nix-config.nix +++ b/config/services/hydra/nix-config.nix @@ -1,13 +1,12 @@ -{ config, ... }: { +{ config, lib, ... }: { nix.buildMachines = [ { hostName = "localhost"; - sshUser = "hydra-queue-runner"; - maxJobs = 20; - speedFactor = 17; + protocol = null; + maxJobs = 0; + speedFactor = 0; systems = [ "x86_64-linux" ]; supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ]; - sshKey = config.sops.secrets."services/hydra/id_ed25519_hydra".path; } { hostName = "integra.kyouma.net"; @@ -18,8 +17,8 @@ supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ]; sshKey = config.sops.secrets."services/hydra/id_ed25519_hydra".path; } - { - hostName = "build-worker-03.nyantec.com"; + ] ++ lib.forEach [ "03" "04" ] (num: { + hostName = "build-worker-${num}.nyantec.com"; sshUser = "nix-ssh"; maxJobs = 4; speedFactor = 18; @@ -27,16 +26,15 @@ supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" "gccarch-x86-64" "gccarch-x86-64-v2" "gccarch-x86-64-v3" ]; sshKey = config.sops.secrets."services/hydra/id_ed25519_hydra".path; } - { - hostName = "build-worker-04.nyantec.com"; - sshUser = "nix-ssh"; - maxJobs = 4; - speedFactor = 18; - systems = [ "x86_64-linux" "riscv64-linux" ]; + ) ++ lib.forEach [ "01" "02" "03" "04" ] (num: { + hostName = "build-worker-${num}"; + sshUser = "root"; + maxJobs = 6; + speedFactor = 20; + systems = [ "x86_64-linux" ]; supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" "gccarch-x86-64" "gccarch-x86-64-v2" "gccarch-x86-64-v3" ]; sshKey = config.sops.secrets."services/hydra/id_ed25519_hydra".path; - } - ]; + }); nix.settings = { allowed-uris = [ "github:" @@ -49,9 +47,29 @@ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE/vCXM3IaxJP9v2Y+xcQrQD2IcffgdzqtWhpMjj9Xl5 hydra@seras" ]; programs.ssh = { - knownHosts."build-worker-03.nyantec.com".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEGqTY74c5g15DSNPNM2Wdr5jAwS7BFgX1XRnhtGOnJc"; - knownHosts."build-worker-04.nyantec.com".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICOq+5I+nlAN2lJoOtoXrYEDuZ/TMPMa43pIlablYigK"; - knownHosts."integra.kyouma.net".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIBwEQiSfaDrUAwgul4mktusBPcIVxI4pLNDh9DPopVU"; - knownHosts."localhost".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPNVavo3YHVsrYwXRVISu7kDoknn+5inFGySn4azlB8P"; + knownHosts = { + "build-worker-03.nyantec.com".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEGqTY74c5g15DSNPNM2Wdr5jAwS7BFgX1XRnhtGOnJc"; + "build-worker-04.nyantec.com".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICOq+5I+nlAN2lJoOtoXrYEDuZ/TMPMa43pIlablYigK"; + "integra.kyouma.net".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIBwEQiSfaDrUAwgul4mktusBPcIVxI4pLNDh9DPopVU"; + "localhost".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPNVavo3YHVsrYwXRVISu7kDoknn+5inFGySn4azlB8P"; + "[build-worker-kyoumanet.fly.dev]:2201".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDL2M97UBHg9aUfjDUxzmzg1r0ga0m3/stummBVwuEAB"; + "[build-worker-kyoumanet.fly.dev]:2202".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOTwVKL0P0chPM2Gz23rbT94844+w1CGJdCaZdzfjThz"; + "[build-worker-kyoumanet.fly.dev]:2203".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAjy2eZGJQeAYy0+fLgW9jiS0jVY2LInY0NDMnzCvvKp"; + "[build-worker-kyoumanet.fly.dev]:2204".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN72OyD9LYy4hq0WZ7ie5RPV+G54UreEJiA/RubjGoe9"; + }; + extraConfig = '' + Host build-worker-01 + Hostname build-worker-kyoumanet.fly.dev + Port 2201 + Host build-worker-02 + Hostname build-worker-kyoumanet.fly.dev + Port 2202 + Host build-worker-03 + Hostname build-worker-kyoumanet.fly.dev + Port 2203 + Host build-worker-04 + Hostname build-worker-kyoumanet.fly.dev + Port 2204 + ''; }; } diff --git a/fly.toml b/fly.toml new file mode 100644 index 0000000..4cf700a --- /dev/null +++ b/fly.toml @@ -0,0 +1,77 @@ +app = 'build-worker-kyoumanet' +primary_region = 'ams' + +[build] + image = 'registry.fly.io/build-worker-kyoumanet:latest' + +[processes] + bw-01 = '/entrypoint.sh' + bw-02 = '/entrypoint.sh' + bw-03 = '/entrypoint.sh' + bw-04 = '/entrypoint.sh' + +[[mounts]] + source = 'bw01' + destination = '/mnt/data' + initial_size = '128GB' + processes = ['bw-01'] + +[[mounts]] + source = 'bw02' + destination = '/mnt/data' + initial_size = '128GB' + processes = ['bw-02'] + +[[mounts]] + source = 'bw03' + destination = '/mnt/data' + initial_size = '128GB' + processes = ['bw-03'] + +[[mounts]] + source = 'bw04' + destination = '/mnt/data' + initial_size = '128GB' + processes = ['bw-04'] + +[[services]] + protocol = 'tcp' + internal_port = 2222 + auto_stop_machines = 'off' + processes = ['bw-01'] + + [[services.ports]] + port = 2201 + +[[services]] + protocol = 'tcp' + internal_port = 2222 + auto_stop_machines = 'off' + processes = ['bw-02'] + + [[services.ports]] + port = 2202 + +[[services]] + protocol = 'tcp' + internal_port = 2222 + auto_stop_machines = 'off' + processes = ['bw-03'] + + [[services.ports]] + port = 2203 + +[[services]] + protocol = 'tcp' + internal_port = 2222 + auto_stop_machines = 'off' + processes = ['bw-04'] + + [[services.ports]] + port = 2204 + +[[restart]] + policy = 'never' + +[[vm]] + size = 'performance-16x'