Skip to content
Snippets Groups Projects
grid.nix 1.71 KiB
Newer Older
# See morph/grid/local/grid.nix for additional commentary.
let
  pkgs = import <nixpkgs> { };
  rawConfig = pkgs.lib.trivial.importJSON ./config.json;
  config = rawConfig // {
    sshUsers = import ./secrets/users.nix;
Florian Sesser's avatar
Florian Sesser committed

    # Get absolute vpn key directory path, as a string:
    monitoringvpnKeyDir = toString ./. + "/${rawConfig.monitoringvpnKeyDir}";
  };
Florian Sesser's avatar
Florian Sesser committed

  payments = {
    imports = [
      (gridlib.customize-issuer (config // {
        monitoringvpnIPv4 = "172.23.23.11";
      }))
    ];
  };

  storage001 = let publicIPv4 = "3.120.26.190"; in {
    imports = [
      ./testing001-hardware.nix
      (gridlib.customize-storage (config // {
        inherit publicIPv4;
        monitoringvpnIPv4 = "172.23.23.12";
        stateVersion = "19.03";
      }))
  monitoring = let publicIPv4 = "18.156.171.217"; in {
    imports = [
      gridlib.monitoring
      gridlib.hardware-aws
      (gridlib.customize-monitoring {
        inherit hostsMap publicIPv4 vpnClientIPs nodeExporterTargets;
        inherit (config) monitoringvpnKeyDir;
        monitoringvpnIPv4 = "172.23.23.1";
        stateVersion = "19.09";
      })
    ];
  };

  # TBD: derive these automatically:
  hostsMap = {
    "172.23.23.1"  = [ "monitoring" "monitoring.monitoringvpn" ];
    "172.23.23.11" = [ "payments"   "payments.monitoringvpn"   ];
    "172.23.23.12" = [ "storage001" "storage001.monitoringvpn" ];
  };
  vpnClientIPs = [ "172.23.23.11" "172.23.23.12" ];
  nodeExporterTargets = [ "monitoring" "payments" "storage001" ];
Florian Sesser's avatar
Florian Sesser committed

in {
  network = {
    description = "PrivateStorage.io Testing Grid";
  inherit payments monitoring storage001;