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

Commit

Permalink
add explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
manveru committed Oct 15, 2020
1 parent 41aaa44 commit b3e35ab
Show file tree
Hide file tree
Showing 7 changed files with 10,345 additions and 9 deletions.
16 changes: 12 additions & 4 deletions clusters/mantis/testnet/ingress.nix
@@ -1,16 +1,24 @@
{ config, ... }: {
services.ingress.extraHttpsAcls = ''
acl is_explorer hdr(host) -i explorer.${config.cluster.domain}
acl is_explorer_web hdr(host) -i explorer.${config.cluster.domain}
acl is_explorer_rpc path_beg -i /rpc/node
'';

services.ingress.extraHttpsBackends = ''
use_backend explorer if is_explorer
use_backend explorer_rpc if is_explorer_web is_explorer_rpc
use_backend explorer_web if is_explorer_web
'';

services.ingress.extraConfig = ''
backend explorer
backend explorer_web
default-server resolve-prefer ipv4 resolvers consul resolve-opts allow-dup-ip check maxconn 2000
server explorer _testnet-explorer._tcp.service.consul
server explorer-web _testnet-explorer._tcp.service.consul
backend explorer_rpc
mode http
default-server resolve-prefer ipv4 resolvers consul resolve-opts allow-dup-ip check maxconn 2000
http-request set-path /
server-template explorer-rpc 2 _testnet-mantis-passive-rpc._tcp.service.consul
backend mantis_1
default-server resolve-prefer ipv4 resolvers consul resolve-opts allow-dup-ip
Expand Down
17 changes: 17 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions flake.nix
Expand Up @@ -10,6 +10,10 @@
terranix.follows = "bitte/terranix";
utils.url = "github:numtide/flake-utils";
ops-lib.url = "github:input-output-hk/ops-lib/zfs-image?dir=zfs";
mantis-explorer = {
url = "github:input-output-hk/mantis-explorer";
flake = false;
};
};

outputs = { self, nixpkgs, utils, ops-lib, bitte, ... }:
Expand Down
8 changes: 6 additions & 2 deletions jobs/mantis.nix
Expand Up @@ -183,6 +183,11 @@ let
portLabel = "metrics";
};

services."${serviceName}-rpc" = {
tags = [ prefix "rpc" ];
portLabel = "rpc";
};

services.${serviceName} = {
tags = [ serviceName mantis-source.rev ] ++ tags;
meta = {
Expand Down Expand Up @@ -314,8 +319,7 @@ let
}];
};
};

};
};
in {
"${prefix}-mantis" = mkNomadJob "${prefix}-mantis" {
datacenters = [ "us-east-2" "eu-central-1" ];
Expand Down
5 changes: 2 additions & 3 deletions overlay.nix
Expand Up @@ -208,9 +208,8 @@ in {
};
in bitte-nixpkgs.bitte;

mantis-explorer = import self.inputs.mantis-explorer {
inherit system;
};
mantis-explorer =
final.callPackage ./pkgs/mantis-explorer.nix { src = self.inputs.mantis-explorer; };

nixosConfigurations =
self.inputs.bitte.legacyPackages.${system}.mkNixosConfigurations
Expand Down
22 changes: 22 additions & 0 deletions pkgs/mantis-explorer.nix
@@ -0,0 +1,22 @@
{ src, web3Provider ? "/rpc/node", mkYarnPackage }:

mkYarnPackage {
inherit src;

patches = [ ./mantis-explorer.patch ];

WEB3_PROVIDER = web3Provider;

doCheck = true;
checkPhase = "yarn test --coverage --ci";
distPhase = "true";

buildPhase = ''
export HOME="$NIX_BUILD_TOP"
yarn run build
'';

installPhase = ''
mv deps/$pname/build $out
'';
}

0 comments on commit b3e35ab

Please sign in to comment.