Skip to content

Commit

Permalink
metadata topo mods for mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
johnalotoski committed Feb 24, 2021
1 parent 2298b31 commit 27719e9
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
4 changes: 2 additions & 2 deletions clusters/cardano.nix
Expand Up @@ -157,7 +157,7 @@ let
};
} def;
}) // (lib.optionalAttrs globals.withMetadataServer {
metadata = let def = (topology.metadataServer or {}); in mkNode {
metadata = let def = (topology.metadata or {}); in mkNode {
deployment.ec2 = {
region = "eu-central-1";
};
Expand All @@ -167,7 +167,7 @@ let
];
node = {
roles.isMetadataServer = true;
org = "IOHK";
org = def.org or "IOHK";
};
} def;
});
Expand Down
2 changes: 2 additions & 0 deletions globals-defaults.nix
Expand Up @@ -37,7 +37,9 @@ in {
withFaucet = false;
withFaucetOptions = {};
withSmash = false;

withMetadataServer = false;
metadataHostName = "tokens.${pkgs.globals.domain}";

initialPythonExplorerDBSyncDone = false;

Expand Down
3 changes: 3 additions & 0 deletions globals-mainnet.nix
Expand Up @@ -16,6 +16,9 @@ pkgs: {
withHighLoadRelays = true;
withSmash = true;

withMetadataServer = true;
metadataHostName = "tokens.cardano.org";

initialPythonExplorerDBSyncDone = true;

environmentName = "mainnet";
Expand Down
9 changes: 7 additions & 2 deletions modules/cardano-postgres.nix
Expand Up @@ -18,6 +18,11 @@ in {
type = types.nullOr types.str;
default = null;
};
withHighCapacityPostgres = mkOption {
description = "Configure postgresql to use additional resources to support high RAM and connection requirements.";
type = types.bool;
default = globals.withHighCapacityExplorer;
};
};
};
config = mkIf cfg.enable {
Expand All @@ -27,7 +32,7 @@ in {
dataDir = mkIf (cfg.postgresqlDataDir != null) cfg.postgresqlDataDir;
enableTCPIP = false;
} // (lib.optionalAttrs (!(lib.hasPrefix "20.03" lib.version)) {
settings = if globals.withHighCapacityExplorer then {
settings = if cfg.withHighCapacityPostgres then {
# Optimized for:
# DB Version: 12
# OS Type: linux
Expand Down Expand Up @@ -86,7 +91,7 @@ in {
"pg_stat_statements.track" = "all";
};
}) // (lib.optionalAttrs (lib.hasPrefix "20.03" lib.version) {
extraConfig = if globals.withHighCapacityExplorer then ''
extraConfig = if cfg.withHighCapacityPostgres then ''
# Optimized for:
# DB Version: 12
# OS Type: linux
Expand Down
6 changes: 3 additions & 3 deletions nix/sources.json
Expand Up @@ -126,10 +126,10 @@
"homepage": null,
"owner": "input-output-hk",
"repo": "metadata-server",
"rev": "7b89f0ece438cb2639aa3ba3b040aeb9c64e3464",
"sha256": "0a2x7qpvfhayiq2wmmgy46041mx8sxg0542y0yfv1f32gfzr6hg1",
"rev": "c47ea6c3a4105cfc0bc9003cbe545828bbbb6996",
"sha256": "1007s1qaz2djgiszvvn4a0abq7hy29is03fq5i62f4kr9xh2d9yi",
"type": "tarball",
"url": "https://github.com/input-output-hk/metadata-server/archive/7b89f0ece438cb2639aa3ba3b040aeb9c64e3464.tar.gz",
"url": "https://github.com/input-output-hk/metadata-server/archive/c47ea6c3a4105cfc0bc9003cbe545828bbbb6996.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
Expand Down
7 changes: 5 additions & 2 deletions roles/metadata-server.nix
Expand Up @@ -65,7 +65,10 @@ in {
numConnections = config.services.metadata-server.postgres.numConnections;
};
};
services.cardano-postgres.enable = true;
services.cardano-postgres = {
enable = true;
withHighCapacityPostgres = false;
};
services.postgresql = {
ensureDatabases = [ "${cfg.postgres.database}" ];
ensureUsers = [
Expand Down Expand Up @@ -175,7 +178,7 @@ in {
'';

virtualHosts = {
"metadata.${globals.domain}" = {
"${globals.metadataHostName}" = {
enableACME = true;
forceSSL = globals.explorerForceSSL;
locations =
Expand Down
4 changes: 4 additions & 0 deletions topologies/mainnet.nix
Expand Up @@ -130,4 +130,8 @@ in {
#TODO: use nginx caching directive instead of upscaling:
deployment.ec2.instanceType = lib.mkForce "t3a.2xlarge";
};

metadata = {
node.org = "CF";
};
}

0 comments on commit 27719e9

Please sign in to comment.