Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@
// (with project.hsPkgs; {
# Add some executables from other relevant packages
inherit (bech32.components.exes) bech32;
# TODO-SRE
# inherit (dmq-node.components.exes) dmq-node;
inherit (ouroboros-consensus.components.exes) db-analyser db-synthesizer db-truncater snapshot-converter;
inherit (kes-agent.components.exes) kes-agent kes-agent-control;
# Add cardano-node, cardano-cli and tx-generator with their git revision stamp.
# Keep available an alternative without the git revision, like the other
# passthru (profiled and asserted in nix/haskell.nix) that
Expand Down Expand Up @@ -312,10 +315,17 @@
"db-analyser"
"db-synthesizer"
"db-truncater"
# TODO-SRE
# "dmq-node"
"kes-agent"
"kes-agent-control"
"snapshot-converter"
"tx-generator"
];

# Binaries only supported on Linux; excluded from Windows and Darwin releases.
linuxOnlyBins = ["kes-agent" "kes-agent-control"];

ciJobsVariants =
mapAttrs (
_: p:
Expand Down Expand Up @@ -383,7 +393,7 @@
inherit (exes.cardano-node.identifier) version;
platform = "win";
exes = collect isDerivation (
filterAttrs (n: _: elem n releaseBins) projectExes
filterAttrs (n: _: elem n releaseBins && !(elem n linuxOnlyBins)) projectExes
);
};
internal.roots.project = windowsProject.roots;
Expand All @@ -403,7 +413,7 @@
inherit (exes.cardano-node.identifier) version;
platform = "macos";
exes = collect isDerivation (
filterAttrs (n: _: elem n releaseBins) (collectExes project)
filterAttrs (n: _: elem n releaseBins && !(elem n linuxOnlyBins)) (collectExes project)
);
};
shells = removeAttrs devShells ["profiled"];
Expand Down Expand Up @@ -514,6 +524,8 @@
db-analyser
db-synthesizer
db-truncater
# TODO-SRE:
# dmq-node
locli
snapshot-converter
tx-generator;
Expand Down
22 changes: 12 additions & 10 deletions nix/docker/context/node/bin/entrypoint
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#!/bin/env bash
set -euo pipefail

[[ -n $DEBUG ]] && set -x
[[ -n ${DEBUG:-} ]] && set -x

# If the NETWORK env var is set to a valid cardano network, pre-defined
# configuration will be used.
if [[ -n $NETWORK ]]; then
if [[ -n ${NETWORK:-} ]]; then

# If either CARDANO_<CONFIG|TOPOLOGY>_JSON_MERGE env vars are set, iohk-nix
# pre-defined NETWORK configuration will be used as a starting point and
# merged with custom configuration provided as json in the environment
# variable(s).
if [[ -n $CARDANO_CONFIG_JSON_MERGE || -n $CARDANO_TOPOLOGY_JSON_MERGE ]]; then
if [[ -n ${CARDANO_CONFIG_JSON_MERGE:-} || -n ${CARDANO_TOPOLOGY_JSON_MERGE:-} ]]; then

CFG="/opt/cardano/config"
if ! [[ -f $CFG/$NETWORK/config.json && -f $CFG/$NETWORK/topology.json ]]; then
Expand All @@ -27,7 +28,9 @@ if [[ -n $NETWORK ]]; then
# In a jq deep merge, arrays are replaced, primitive values in the second
# object override the first, different types for the same key result in
# full replacement and null values persist.
if [[ -n $CARDANO_CONFIG_JSON_MERGE ]]; then
#
# jq -S sorts output keys alphabetically for deterministic diffs.
if [[ -n ${CARDANO_CONFIG_JSON_MERGE:-} ]]; then
jq -S \
--argjson deepMerge "$CARDANO_CONFIG_JSON_MERGE" \
'. * $deepMerge' \
Expand All @@ -38,7 +41,7 @@ if [[ -n $NETWORK ]]; then
export CARDANO_CONFIG="$CFG/$NETWORK/config.json"
fi

if [[ -n $CARDANO_TOPOLOGY_JSON_MERGE ]]; then
if [[ -n ${CARDANO_TOPOLOGY_JSON_MERGE:-} ]]; then
jq -S \
--argjson deepMerge "$CARDANO_TOPOLOGY_JSON_MERGE" \
'. * $deepMerge' \
Expand All @@ -49,7 +52,7 @@ if [[ -n $NETWORK ]]; then
export CARDANO_TOPOLOGY="$CFG/$NETWORK/topology.json"
fi

if [[ -n $DEBUG ]]; then
if [[ -n ${DEBUG:-} ]]; then
echo "Cardano config in merge mode is:"
cat "$CARDANO_CONFIG"
echo
Expand All @@ -61,7 +64,7 @@ if [[ -n $NETWORK ]]; then
# Run cardano-node using iohk-nix base config merged with provided custom
# config for the requested NETWORK.
unset NETWORK
if [[ $1 == "run" ]]; then
if [[ ${1:-} == "run" ]]; then
exec /usr/local/bin/run-node "$@"
else
exec /usr/local/bin/run-node run "$@"
Expand All @@ -72,16 +75,15 @@ if [[ -n $NETWORK ]]; then
exec /usr/local/bin/run-network "$@"
fi

elif [[ $1 == "run" ]]; then
elif [[ ${1:-} == "run" ]]; then
# Run cardano-node using "custom" mode.
exec /usr/local/bin/run-node "$@"

elif [[ $1 == "cli" ]]; then
elif [[ ${1:-} == "cli" ]]; then
# Run cardano-cli with the provided entrypoint args
exec /usr/local/bin/run-client "$@"

else

echo "Nothing to do! Available modes of operation are:"
echo
echo "Scripts mode:"
Expand Down
9 changes: 5 additions & 4 deletions nix/docker/context/node/bin/run-client
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/bin/env bash
set -euo pipefail

[[ -n $DEBUG ]] && set -x
[[ -n ${DEBUG:-} ]] && set -x

# Shift the first option by one index
# Discard the leading subcommand argument (e.g. "cli") passed by the entrypoint
shift

if [[ -z $CARDANO_NODE_SOCKET_PATH ]]; then
if [[ -z ${CARDANO_NODE_SOCKET_PATH:-} ]]; then
# Breaking change from the historical default of: /opt/cardano/ipc/socket
# in order to align both the "scripts" and "custom" modes of image operation.
export CARDANO_NODE_SOCKET_PATH="/ipc/node.socket"
fi

/usr/local/bin/cardano-cli "$@"
exec /usr/local/bin/cardano-cli "$@"
Loading
Loading