Skip to content
Snippets Groups Projects
grid.nix 1.96 KiB
Newer Older
let lib = import ../../lib;
in lib.make-grid {
  # Make a morph configuration for this grid.  We share this function
  # with the other grids and have one fewer possible point of divergence.
  name = "LocalDev";
  config = ./config.json;
  nodes = cfg:
  let
    sshUsers = import ./secrets/users.nix;
    # Get absolute vpn key directory path, as a string:
    monitoringvpnKeyDir = toString ./. + "/${cfg.monitoringvpnKeyDir}";

    # TBD: derive these automatically:
Florian Sesser's avatar
Florian Sesser committed
    hostsMap = {
      "172.23.23.1"  = [ "monitoring" "monitoring.monitoringvpn" ];
      "172.23.23.11" = [ "payments" "payments.monitoringvpn" ];
Florian Sesser's avatar
Florian Sesser committed
      "172.23.23.12" = [ "storage1" "storage1.monitoringvpn" ];
      "172.23.23.13" = [ "storage2" "storage2.monitoringvpn" ];
    };
    vpnClientIPs = [ "172.23.23.11" "172.23.23.12" "172.23.23.13" ];
    nodeExporterTargets = [ "monitoring" "payments" "storage1" "storage2" ];
      imports = [
        lib.issuer
        (import ./virtual-hardware.nix ({ publicIPv4 = "192.168.67.21"; }))
        (lib.customize-issuer cfg sshUsers monitoringvpnKeyDir "172.23.23.11" "19.03")
      ];
    };
    storage1 = let publicIPv4 = "192.168.67.22"; in {
      imports = [
        lib.storage
        (import ./virtual-hardware.nix ({ inherit publicIPv4; }))
        (lib.customize-storage cfg sshUsers publicIPv4 monitoringvpnKeyDir "172.23.23.12" "19.09")
      ];
    };
    storage2 = let publicIPv4 = "192.168.67.23"; in {
      imports = [
        lib.storage
        (import ./virtual-hardware.nix ({ inherit publicIPv4; }))
        (lib.customize-storage cfg sshUsers publicIPv4 monitoringvpnKeyDir "172.23.23.13" "19.09")
      ];
    };
Florian Sesser's avatar
Florian Sesser committed

    monitoring = let publicIPv4 = "192.168.67.24"; in {
      imports = [
        lib.monitoring
        (import ./virtual-hardware.nix ({ inherit publicIPv4; }))
        (lib.customize-monitoring hostsMap monitoringvpnKeyDir publicIPv4 "172.23.23.1" vpnClientIPs nodeExporterTargets [] "19.09")
      ];
    };