From 0fc322c20a605f876ae2ac53299be4cc56b95cfa Mon Sep 17 00:00:00 2001 From: Sebastian Nagel Date: Wed, 31 Jan 2024 10:18:58 +0100 Subject: [PATCH] Add CARDANO_NODE_RTS_OPTIONS env to docker image This allows to set Haskell RTS options through the docker image by providing an environment variable on a docker run command. For example: ``` docker run --rm -it -e CARDANO_NODE_RTS_OPTIONS="-N" cardano-node run ``` will start the node with RTS option -N (utilizing all cores): ``` Running the cardano node ... CARDANO_BIND_ADDR=0.0.0.0 CARDANO_BLOCK_PRODUCER=false CARDANO_CONFIG=/opt/cardano/config/mainnet-config.json CARDANO_DATABASE_PATH=/opt/cardano/data CARDANO_LOG_DIR=/opt/cardano/logs CARDANO_PORT=3001 CARDANO_SOCKET_PATH=/opt/cardano/ipc/socket CARDANO_TOPOLOGY=/opt/cardano/config/mainnet-topology.json CARDANO_NODE_RTS_OPTIONS=-N cardano-node run --config /opt/cardano/config/mainnet-config.json --topology /opt/cardano/config/mainnet-topology.json --database-path /opt/cardano/data --socket-path /opt/cardano/ipc/socket --host-addr 0.0.0.0 --port 3001 +RTS -N -RTS ``` --- nix/docker/context/bin/run-node | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nix/docker/context/bin/run-node b/nix/docker/context/bin/run-node index a0c1c49e61c..7a4d099c93c 100755 --- a/nix/docker/context/bin/run-node +++ b/nix/docker/context/bin/run-node @@ -73,6 +73,10 @@ printRunEnv () { echo "CARDANO_SHELLEY_VRF_KEY=$CARDANO_SHELLEY_VRF_KEY" echo "CARDANO_SHELLEY_OPERATIONAL_CERTIFICATE=$CARDANO_SHELLEY_OPERATIONAL_CERTIFICATE" fi + + if [ "${CARDANO_NODE_RTS_OPTIONS}" != "" ]; then + echo "CARDANO_NODE_RTS_OPTIONS=${CARDANO_NODE_RTS_OPTIONS}" + fi } ##################################################################### @@ -123,6 +127,10 @@ runRelayNode () { effopts+=(${options[@]}) + if [ "${CARDANO_NODE_RTS_OPTIONS}" != "" ]; then + effopts+=(+RTS ${CARDANO_NODE_RTS_OPTIONS} -RTS) + fi + echo "cardano-node run ${effopts[@]}" exec /usr/local/bin/cardano-node run ${effopts[@]} } @@ -145,6 +153,10 @@ runBlockProducerNode () { effopts+=(${options[@]}) + if [ "${CARDANO_NODE_RTS_OPTIONS}" != "" ]; then + effopts+=(+RTS ${CARDANO_NODE_RTS_OPTIONS} -RTS) + fi + echo "cardano-node run ${effopts[@]}" exec /usr/local/bin/cardano-node run ${effopts[@]} }