forked from input-output-hk/cardano-ops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
globals-bench-txgen-simple.nix
109 lines (101 loc) · 4.48 KB
/
globals-bench-txgen-simple.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
pkgs:
let
benchmarkingParamsFile = ./benchmarking-cluster-params.json;
benchmarkingParams =
if __pathExists benchmarkingParamsFile
then let r = __fromJSON (__readFile benchmarkingParamsFile);
in if __hasAttr "meta" r
then if __hasAttr "default_profile" r.meta then r
else abort "${benchmarkingParamsFile} must define 'meta.default_profile'"
else abort "${benchmarkingParamsFile} must defined the 'meta' section"
else abort "Benchmarking requires ${toString benchmarkingParamsFile} to exist. Please, refer to documentation.";
benchmarkingTopologyFile =
./topologies + "/bench-txgen-simple-${toString (__length benchmarkingParams.meta.node_names)}.nix";
benchmarkingTopology =
if __pathExists benchmarkingTopologyFile
then __trace "Using topology: ${benchmarkingTopologyFile}"
(import benchmarkingTopologyFile)
else abort "Benchmarking topology file implied by configured node count ${__length benchmarkingParams.meta.node_names} does not exist: ${benchmarkingTopologyFile}";
### Benchmarking profiles are, currently, essentially name-tagger
### generator configs.
benchmarkingProfileNameEnv = __getEnv("BENCHMARKING_PROFILE");
## WARNING: this logic must correspond to select_benchmarking_profile
## in bench.sh.
benchmarkingProfileName = if benchmarkingProfileNameEnv == ""
then benchmarkingParams.meta.default_profile
else benchmarkingProfileNameEnv;
benchmarkingProfile =
if __hasAttr benchmarkingProfileName benchmarkingParams
then __trace "Using profile: ${benchmarkingProfileName}"
benchmarkingParams."${benchmarkingProfileName}"
else abort "${benchmarkingParamsFile} does not define benchmarking profile '${benchmarkingProfileName}'.";
metadata = {
inherit benchmarkingProfileName benchmarkingProfile benchmarkingTopology;
};
reportDeployment = x:
__trace "DEPLOYMENT_METADATA=${__toFile "nixops-metadata.json" (__toJSON metadata)}" x;
in reportDeployment (rec {
withMonitoring = false;
withLegacyExplorer = false;
environmentName = "bench-txgen-simple-${benchmarkingProfileName}";
sourcesJsonOverride = ./nix/sources.bench-txgen-simple.json;
environmentConfig = rec {
consensusProtocol = ""; ## We're not at Shelley stage yet.
relays = "relays.${pkgs.globals.domain}";
edgePort = pkgs.globals.cardanoNodePort;
confKey = abort "legacy nodes not supported by benchmarking environment";
genesisFile = ./keys/genesis.json;
genesisHash = builtins.replaceStrings ["\n"] [""] (builtins.readFile ./keys/GENHASH);
private = true;
networkConfig = pkgs.iohkNix.cardanoLib.environments.shelley_staging_short.networkConfig // {
GenesisFile = genesisFile;
GenesisHash = genesisHash;
NumCoreNodes = builtins.length topology.coreNodes;
};
nodeConfig = pkgs.iohkNix.cardanoLib.environments.shelley_staging_short.nodeConfig // {
GenesisFile = genesisFile;
GenesisHash = genesisHash;
NumCoreNodes = builtins.length topology.coreNodes;
};
txSubmitConfig = {
inherit (networkConfig) RequiresNetworkMagic;
GenesisFile = genesisFile;
GenesisHash = genesisHash;
} // pkgs.iohkNix.cardanoLib.defaultExplorerLogConfig;
## This is overlaid atop the defaults in the tx-generator service,
## as specified in the 'cardano-benchmarking' repository.
generatorConfig = benchmarkingProfile.generator;
};
topology = benchmarkingTopology // {
explorer = {
imports = [
pkgs.cardano-ops.roles.tx-generator
];
services.cardano-graphql.enable = pkgs.lib.mkForce false;
services.graphql-engine.enable = pkgs.lib.mkForce false;
};
coreNodes = map (n : n // {
services.cardano-node.nodeConfig = pkgs.globals.environmentConfig.nodeConfig // {
defaultScribes = [
[ "StdoutSK" "stdout" ]
[ "FileSK" "/var/lib/cardano-node/logs/node.json" ]
];
setupScribes = [
{ scKind = "StdoutSK"; scName = "stdout"; scFormat = "ScJson"; }
{ scKind = "FileSK"; scName = "/var/lib/cardano-node/logs/node.json"; scFormat = "ScJson"; "scRotation" = null; }
];
minSeverity = "Debug";
TracingVerbosity = "MaximalVerbosity";
TurnOnLogMetrics = false;
};
}) (benchmarkingTopology.coreNodes or []);
};
ec2 = {
credentials = {
accessKeyIds = {
IOHK = "dev-deployer";
dns = "dev-deployer";
};
};
};
})