Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

Commit

Permalink
nixfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
manveru committed Nov 17, 2020
1 parent 7b9dcc7 commit 9a81bd4
Show file tree
Hide file tree
Showing 9 changed files with 146 additions and 121 deletions.
7 changes: 3 additions & 4 deletions clusters/mantis/testnet/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,7 @@ in {
privateIP = "172.16.0.20";
subnet = cluster.vpc.subnets.core-1;
volumeSize = 500;
route53.domains = [
"*.${cluster.domain}"
];
route53.domains = [ "*.${cluster.domain}" ];

modules = let
extraConfig = pkgs.writeText "extra-config.nix" ''
Expand All @@ -201,7 +199,8 @@ in {
];

securityGroupRules = {
inherit (securityGroupRules) internet internal ssh http mantis-server-public;
inherit (securityGroupRules)
internet internal ssh http mantis-server-public;
};
};
};
Expand Down
4 changes: 1 addition & 3 deletions clusters/mantis/testnet/seaweedfs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ in {

services.seaweedfs.mount = {
enable = true;
mounts = {
nomad = "nomad";
};
mounts = { nomad = "nomad"; };
};

services.nomad.client = {
Expand Down
3 changes: 2 additions & 1 deletion docker/darkhttpd.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ lib, mkEnv, buildLayeredImage, writeShellScript, darkhttpd, mime-types, mantis-explorer }:
{ lib, mkEnv, buildLayeredImage, writeShellScript, darkhttpd, mime-types
, mantis-explorer }:
let
entrypoint = writeShellScript "darkhttpd" ''
set -exuo pipefail
Expand Down
10 changes: 7 additions & 3 deletions docker/mantis.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ lib, mkEnv, buildLayeredImage, writeShellScript, mantis, mantis-faucet, coreutils, gnused, gnugrep }:
{ lib, mkEnv, buildLayeredImage, writeShellScript, mantis, mantis-faucet
, coreutils, gnused, gnugrep }:
let
mantis-entrypoint = writeShellScript "mantis" ''
set -exuo pipefail
Expand Down Expand Up @@ -42,7 +43,8 @@ in {
config = {
Entrypoint = [ mantis-entrypoint ];

Env = mkEnv { PATH = lib.makeBinPath [ coreutils gnugrep gnused mantis ]; };
Env =
mkEnv { PATH = lib.makeBinPath [ coreutils gnugrep gnused mantis ]; };
};
};

Expand All @@ -51,7 +53,9 @@ in {
config = {
Entrypoint = [ faucet-entrypoint ];

Env = mkEnv { PATH = lib.makeBinPath [ coreutils gnugrep gnused mantis-faucet ]; };
Env = mkEnv {
PATH = lib.makeBinPath [ coreutils gnugrep gnused mantis-faucet ];
};
};
};
}
13 changes: 7 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
utils.url = "github:numtide/flake-utils";
ops-lib.url = "github:input-output-hk/ops-lib/zfs-image?dir=zfs";
midnight-automation = {
url = "git+ssh://github.com/input-output-hk/midnight-automation?ref=etcm-99-mantis-agen";
url =
"git+ssh://github.com/input-output-hk/midnight-automation?ref=etcm-99-mantis-agen";
flake = false;
};
mantis-explorer = {
Expand All @@ -36,14 +37,14 @@
inherit (legacyPackages) devShell;

packages = {
inherit (legacyPackages) bitte nixFlakes sops generate-mantis-keys
terraform-with-plugins cfssl consul;
inherit (legacyPackages)
bitte nixFlakes sops generate-mantis-keys terraform-with-plugins cfssl
consul;
};

hydraJobs = packages // {
prebuilt-devshell = devShell.overrideAttrs (_: {
nobuildPhase = "touch $out";
});
prebuilt-devshell =
devShell.overrideAttrs (_: { nobuildPhase = "touch $out"; });
};

apps.bitte = utils.lib.mkApp { drv = legacyPackages.bitte; };
Expand Down
97 changes: 48 additions & 49 deletions jobs/mantis-qa-fastsync.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,28 @@ let

templatesFor = { name ? null, mining-enabled ? false }:
let secret = key: ''{{ with secret "${key}" }}{{.Data.data.value}}{{end}}'';
in [
{
data = ''
include "${mantis}/conf/etc.conf"
logging.json-output = true
logging.logs-file = "logs"
mantis.client-id = "${name}"
mantis.sync.do-fast-sync = true
mantis.consensus.coinbase = "{{ with secret "kv/data/nomad-cluster/${namespace}/${name}/coinbase" }}{{ .Data.data.value }}{{ end }}"
mantis.node-key-file = "{{ env "NOMAD_SECRETS_DIR" }}/secret-key"
mantis.datadir = "/local/mantis"
mantis.ethash.ethash-dir = "/local/ethash"
mantis.metrics.enabled = true
mantis.metrics.port = {{ env "NOMAD_PORT_metrics" }}
mantis.network.rpc.http.interface = "0.0.0.0"
mantis.network.rpc.http.port = {{ env "NOMAD_PORT_rpc" }}
mantis.network.server-address.port = {{ env "NOMAD_PORT_server" }}
'';
destination = "local/mantis.conf";
changeMode = "noop";
}
] ++ (lib.optional mining-enabled {
in [{
data = ''
include "${mantis}/conf/etc.conf"
logging.json-output = true
logging.logs-file = "logs"
mantis.client-id = "${name}"
mantis.sync.do-fast-sync = true
mantis.consensus.coinbase = "{{ with secret "kv/data/nomad-cluster/${namespace}/${name}/coinbase" }}{{ .Data.data.value }}{{ end }}"
mantis.node-key-file = "{{ env "NOMAD_SECRETS_DIR" }}/secret-key"
mantis.datadir = "/local/mantis"
mantis.ethash.ethash-dir = "/local/ethash"
mantis.metrics.enabled = true
mantis.metrics.port = {{ env "NOMAD_PORT_metrics" }}
mantis.network.rpc.http.interface = "0.0.0.0"
mantis.network.rpc.http.port = {{ env "NOMAD_PORT_rpc" }}
mantis.network.server-address.port = {{ env "NOMAD_PORT_server" }}
'';
destination = "local/mantis.conf";
changeMode = "noop";
}] ++ (lib.optional mining-enabled {
data = ''
${secret "kv/data/nomad-cluster/${namespace}/${name}/secret-key"}
${secret "kv/data/nomad-cluster/${namespace}/${name}/enode-hash"}
Expand Down Expand Up @@ -158,7 +156,7 @@ let
config = {
image = dockerImages.mantis.id;
args = [ "-Dconfig.file=running.conf" ];
ports = ["rpc" "server" "metrics"];
ports = [ "rpc" "server" "metrics" ];
labels = [{
inherit namespace name;
imageTag = dockerImages.mantis.image.imageTag;
Expand Down Expand Up @@ -251,29 +249,27 @@ let
};
};

templates = [
{
data = ''
include "${mantis}/conf/etc.conf"
logging.json-output = true
logging.logs-file = "logs"
mantis.client-id = "${name}"
mantis.sync.do-fast-sync = true
mantis.consensus.mining-enabled = false
mantis.datadir = "/local/mantis"
mantis.ethash.ethash-dir = "/local/ethash"
mantis.metrics.enabled = true
mantis.metrics.port = {{ env "NOMAD_PORT_metrics" }}
mantis.network.rpc.http.interface = "0.0.0.0"
mantis.network.rpc.http.port = {{ env "NOMAD_PORT_rpc" }}
mantis.network.server-address.port = {{ env "NOMAD_PORT_server" }}
'';
changeMode = "restart";
destination = "local/mantis.conf";
}
];
templates = [{
data = ''
include "${mantis}/conf/etc.conf"
logging.json-output = true
logging.logs-file = "logs"
mantis.client-id = "${name}"
mantis.sync.do-fast-sync = true
mantis.consensus.mining-enabled = false
mantis.datadir = "/local/mantis"
mantis.ethash.ethash-dir = "/local/ethash"
mantis.metrics.enabled = true
mantis.metrics.port = {{ env "NOMAD_PORT_metrics" }}
mantis.network.rpc.http.interface = "0.0.0.0"
mantis.network.rpc.http.port = {{ env "NOMAD_PORT_rpc" }}
mantis.network.server-address.port = {{ env "NOMAD_PORT_server" }}
'';
changeMode = "restart";
destination = "local/mantis.conf";
}];
};

amountOfMiners = 0;
Expand Down Expand Up @@ -307,4 +303,7 @@ in {
};
}

// (import ./mantis-active-gen.nix { inherit mkNomadJob dockerImages; namespace = "mantis-qa-fastsync"; })
// (import ./mantis-active-gen.nix {
inherit mkNomadJob dockerImages;
namespace = "mantis-qa-fastsync";
})
7 changes: 5 additions & 2 deletions jobs/mantis-qa-load.nix
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ let
config = {
image = dockerImages.mantis.id;
args = [ "-Dconfig.file=running.conf" ];
ports = ["rpc" "server" "metrics"];
ports = [ "rpc" "server" "metrics" ];
labels = [{
inherit namespace name;
imageTag = dockerImages.mantis.image.imageTag;
Expand Down Expand Up @@ -534,4 +534,7 @@ in {
};
}

// (import ./mantis-active-gen.nix { inherit mkNomadJob dockerImages; namespace = "mantis-qa-load"; })
// (import ./mantis-active-gen.nix {
inherit mkNomadJob dockerImages;
namespace = "mantis-qa-load";
})
34 changes: 23 additions & 11 deletions jobs/mantis.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ mkNomadJob, lib, mantis, mantis-source, mantis-faucet, mantis-faucet-source, dockerImages }:
{ mkNomadJob, lib, mantis, mantis-source, mantis-faucet, mantis-faucet-source
, dockerImages }:
let
# NOTE: Copy this file and change the next line if you want to start your own cluster!
namespace = "mantis-testnet";
Expand Down Expand Up @@ -177,7 +178,7 @@ let
config = {
image = dockerImages.mantis.id;
args = [ "-Dconfig.file=running.conf" ];
ports = ["rpc" "server" "metrics"];
ports = [ "rpc" "server" "metrics" ];
labels = [{
inherit namespace name;
imageTag = dockerImages.mantis.image.imageTag;
Expand Down Expand Up @@ -326,7 +327,8 @@ let
ingressHost = "${name}.mantis.ws";
ingressMode = "http";
ingressBind = "*:443";
ingressIf = "! { path_beg -i /rpc/node } ! { path_beg -i /sockjs-node }";
ingressIf =
"! { path_beg -i /rpc/node } ! { path_beg -i /sockjs-node }";
ingressServer = "_${name}._tcp.service.consul";
};

Expand Down Expand Up @@ -380,7 +382,8 @@ let
addressMode = "host";
portLabel = "rpc";

tags = [ "ingress" namespace "faucet" faucetName mantis-faucet-source.rev ];
tags =
[ "ingress" namespace "faucet" faucetName mantis-faucet-source.rev ];

meta = {
name = faucetName;
Expand All @@ -394,7 +397,13 @@ let
"${faucetName}-prometheus" = {
addressMode = "host";
portLabel = "metrics";
tags = [ "prometheus" namespace "faucet" faucetName mantis-faucet-source.rev ];
tags = [
"prometheus"
namespace
"faucet"
faucetName
mantis-faucet-source.rev
];
};
};

Expand All @@ -403,7 +412,7 @@ let
metrics.to = 7000;
rpc.to = 8000;
};
}];
}];

tasks.telegraf = {
driver = "docker";
Expand Down Expand Up @@ -473,7 +482,7 @@ let
config = {
image = dockerImages.mantis-faucet.id;
args = [ "-Dconfig.file=running.conf" ];
ports = ["rpc" "metrics"];
ports = [ "rpc" "metrics" ];
labels = [{
inherit namespace;
name = "faucet";
Expand Down Expand Up @@ -601,9 +610,9 @@ in {
minHealthyTime = "30s";
healthyDeadline = "5m";
progressDeadline = "10m";
autoRevert = true;
autoPromote = true;
canary = 1;
autoRevert = false;
autoPromote = false;
canary = 0;
stagger = "30s";
};

Expand All @@ -629,4 +638,7 @@ in {
};
}

// (import ./mantis-active-gen.nix { inherit mkNomadJob dockerImages; namespace = "mantis-testnet"; })
// (import ./mantis-active-gen.nix {
inherit mkNomadJob dockerImages;
namespace = "mantis-testnet";
})

0 comments on commit 9a81bd4

Please sign in to comment.