|
14 | 14 | , keepAlive ? true
|
15 | 15 | , launchGenesis ? false
|
16 | 16 | , configurationKey ? "default"
|
| 17 | +, useStackBinaries ? false |
17 | 18 | }:
|
18 | 19 |
|
19 | 20 | with localLib;
|
20 | 21 |
|
21 | 22 | let
|
22 |
| - executables = { |
23 |
| - corenode = "${iohkPkgs.cardano-sl-node-static}/bin/cardano-node-simple"; |
24 |
| - wallet = "${iohkPkgs.cardano-sl-wallet-new}/bin/cardano-node"; |
25 |
| - integration-test = "${iohkPkgs.cardano-sl-wallet-new}/bin/wal-integr-test"; |
26 |
| - keygen = "${iohkPkgs.cardano-sl-tools}/bin/cardano-keygen"; |
27 |
| - explorer = "${iohkPkgs.cardano-sl-explorer-static}/bin/cardano-explorer"; |
28 |
| - }; |
29 |
| - demoClusterDeps = with pkgs; (with iohkPkgs; [ jq coreutils pkgs.curl gnused openssl cardano-sl-tools cardano-sl-wallet-new cardano-sl-node-static ]); |
| 23 | + stackExec = optionalString useStackBinaries "stack exec -- "; |
| 24 | + cardanoDeps = with iohkPkgs; [ cardano-sl-tools cardano-sl-wallet-new cardano-sl-node-static ]; |
| 25 | + demoClusterDeps = with pkgs; [ jq coreutils curl gnused openssl ]; |
| 26 | + allDeps = demoClusterDeps ++ (optionals (!useStackBinaries ) cardanoDeps); |
30 | 27 | walletConfig = {
|
31 | 28 | inherit stateDir;
|
32 | 29 | topologyFile = walletTopologyFile;
|
|
39 | 36 | } else {
|
40 | 37 | environment = "demo";
|
41 | 38 | };
|
42 |
| - demoWallet = pkgs.callPackage ./../connect-to-cluster ({ inherit gitrev; debug = false; } // walletEnvironment // walletConfig); |
43 |
| - ifWallet = localLib.optionalString (runWallet); |
44 |
| - ifKeepAlive = localLib.optionalString (keepAlive); |
| 39 | + demoWallet = pkgs.callPackage ./../connect-to-cluster ({ inherit gitrev useStackBinaries; debug = false; } // walletEnvironment // walletConfig); |
| 40 | + ifWallet = optionalString (runWallet); |
| 41 | + ifKeepAlive = optionalString (keepAlive); |
45 | 42 | iohkPkgs = import ./../../.. { inherit config system pkgs gitrev; };
|
46 | 43 | src = ./../../..;
|
47 | 44 | topologyFile = import ./make-topology.nix { inherit (pkgs) lib; cores = numCoreNodes; relays = numRelayNodes; };
|
|
52 | 49 | fallbacks = 1;
|
53 | 50 | };
|
54 | 51 | });
|
55 |
| - assetLockFile = pkgs.writeText "asset-lock-file" (localLib.intersperse "\n" assetLockAddresses); |
56 |
| - ifAssetLock = localLib.optionalString (assetLockAddresses != []); |
| 52 | + assetLockFile = pkgs.writeText "asset-lock-file" (intersperse "\n" assetLockAddresses); |
| 53 | + ifAssetLock = optionalString (assetLockAddresses != []); |
57 | 54 | configFiles = pkgs.runCommand "cardano-config" {} ''
|
58 | 55 | mkdir -pv $out
|
59 | 56 | cd $out
|
|
69 | 66 |
|
70 | 67 | in pkgs.writeScript "demo-cluster" ''
|
71 | 68 | #!${pkgs.stdenv.shell}
|
72 |
| - export PATH=${pkgs.lib.makeBinPath demoClusterDeps} |
| 69 | + export PATH=${pkgs.lib.makeBinPath allDeps}:$PATH |
73 | 70 | # Set to 0 (passing) by default. Tests using this cluster can set this variable
|
74 | 71 | # to force the `stop_cardano` function to exit with a different code.
|
75 | 72 | EXIT_STATUS=0
|
@@ -120,15 +117,15 @@ in pkgs.writeScript "demo-cluster" ''
|
120 | 117 | do
|
121 | 118 | node_args="--db-path ${stateDir}/core-db$i --rebuild-db ${if launchGenesis then "--keyfile ${stateDir}/genesis-keys/generated-keys/rich/key$((i - 1)).sk" else "--genesis-secret $i"} --listen 127.0.0.1:$((3000 + i)) --json-log ${stateDir}/logs/core$i.json --logs-prefix ${stateDir}/logs --system-start $system_start --metrics +RTS -N2 -qg -A1m -I0 -T -RTS --node-id core$i --topology ${topologyFile} --configuration-file $config_files/configuration.yaml --configuration-key ${configurationKey} ${ifAssetLock "--asset-lock-file ${assetLockFile}"}"
|
122 | 119 | echo Launching core node $i: cardano-node-simple $node_args
|
123 |
| - cardano-node-simple $node_args &> ${stateDir}/logs/core$i.log & |
| 120 | + ${stackExec}cardano-node-simple $node_args &> ${stateDir}/logs/core$i.log & |
124 | 121 | core_pid[$i]=$!
|
125 | 122 |
|
126 | 123 | done
|
127 | 124 | for i in {1..${builtins.toString numRelayNodes}}
|
128 | 125 | do
|
129 | 126 | node_args="--db-path ${stateDir}/relay-db$i --rebuild-db --listen 127.0.0.1:$((3100 + i)) --json-log ${stateDir}/logs/relay$i.json --logs-prefix ${stateDir}/logs --system-start $system_start --metrics +RTS -N2 -qg -A1m -I0 -T -RTS --node-id relay$i --topology ${topologyFile} --configuration-file $config_files/configuration.yaml --configuration-key ${configurationKey}"
|
130 | 127 | echo Launching relay node $i: cardano-node-simple $node_args
|
131 |
| - cardano-node-simple $node_args &> ${stateDir}/logs/relay$i.log & |
| 128 | + ${stackExec}cardano-node-simple $node_args &> ${stateDir}/logs/relay$i.log & |
132 | 129 | relay_pid[$i]=$!
|
133 | 130 |
|
134 | 131 | done
|
|
0 commit comments