Skip to content

Commit

Permalink
Add CARDANO_NODE_RTS_OPTIONS env to docker image
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
ch1bo committed Mar 19, 2024
1 parent 381d27d commit aeaaf07
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions nix/docker/context/bin/run-node
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

#####################################################################
Expand Down Expand Up @@ -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[@]}
}
Expand All @@ -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[@]}
}
Expand Down

0 comments on commit aeaaf07

Please sign in to comment.