-
Notifications
You must be signed in to change notification settings - Fork 720
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#2801] Allow docker container configuration through env vars
- Loading branch information
Showing
8 changed files
with
411 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"adaPerUTxOWord": 0, | ||
"executionPrices": { | ||
"prMem": 1, | ||
"prSteps": 1 | ||
}, | ||
"maxTxExUnits": { | ||
"exUnitsMem": 1, | ||
"exUnitsSteps": 1 | ||
}, | ||
"maxBlockExUnits": { | ||
"exUnitsMem": 1, | ||
"exUnitsSteps": 1 | ||
}, | ||
"maxValueSize": 1000, | ||
"collateralPercentage": 100, | ||
"maxCollateralInputs": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
|
||
## Build Cardano Node + Image | ||
|
||
https://docs.cardano.org/projects/cardano-node/en/latest/getting-started/building-the-node-using-nix.html | ||
|
||
``` | ||
# Build + Install the cardano node | ||
nix-build -A scripts.mainnet.node -o ~/bin/cardano-node | ||
# Build + Install the cardano Docker image | ||
docker load -i $(nix-build -A dockerImage --no-out-link) \ | ||
&& GITHASH=`git log -n1 --pretty='%H'` \ | ||
&& docker tag inputoutput/cardano-node:$GITHASH inputoutput/cardano-node:dev \ | ||
&& docker rmi inputoutput/cardano-node:$GITHASH | ||
GITTAG=`git describe --exact-match --tags $GITHASH` | ||
if [ $? -eq 0 ]; then | ||
echo "Current tag: $GITTAG" | ||
docker tag inputoutput/cardano-node:dev inputoutput/cardano-node:$GITTAG | ||
fi | ||
# Bash into the node to look around | ||
docker run --rm -it --entrypoint=bash \ | ||
-v node-data:/opt/cardano/data \ | ||
inputoutput/cardano-node:dev | ||
cardano-node run \ | ||
--config /opt/cardano/config/mainnet-config.json \ | ||
--topology /opt/cardano/config/mainnet-topology.json \ | ||
--socket-path /opt/cardano/ipc/socket \ | ||
--database-path /opt/cardano/data \ | ||
--host-addr 0.0.0.0 \ | ||
--port 3001 | ||
``` | ||
|
||
## Manual Testing | ||
|
||
1. Run -e NETWORK=mainnet and check graceful shutdown SIGINT with -it | ||
2. Run -e NETWORK=mainnet and check graceful shutdown SIGTERM with --detach | ||
3. Run without -e NETWORK and check graceful shutdown SIGINT with -it | ||
4. Run without -e NETWORK and check graceful shutdown SIGTERM with --detach | ||
5. Check cardano-cli access | ||
|
||
### Run with NETWORK | ||
|
||
Run -e NETWORK=mainnet and check graceful shutdown SIGINT with -it | ||
|
||
``` | ||
docker run --rm -it \ | ||
-p 3001:3001 \ | ||
-e NETWORK=mainnet \ | ||
-v node-data:/data/db \ | ||
inputoutput/cardano-node:dev | ||
``` | ||
|
||
Run -e NETWORK=mainnet and check graceful shutdown SIGTERM with --detach | ||
|
||
``` | ||
docker rm -f relay | ||
docker run --detach \ | ||
--name=relay \ | ||
-p 3001:3001 \ | ||
-e NETWORK=mainnet \ | ||
-v node-data:/data/db \ | ||
inputoutput/cardano-node:dev | ||
docker logs -f relay | ||
``` | ||
|
||
### Run without NETWORK | ||
|
||
Check graceful shutdown SIGINT with -it | ||
|
||
``` | ||
docker run --rm -it \ | ||
-p 3001:3001 \ | ||
-v node-data:/opt/cardano/data \ | ||
inputoutput/cardano-node:dev run | ||
``` | ||
|
||
Check graceful shutdown SIGTERM with --detach | ||
|
||
``` | ||
docker rm -f relay | ||
docker run --detach \ | ||
--name=relay \ | ||
-p 3001:3001 \ | ||
-v node-data:/opt/cardano/data \ | ||
-v node-ipc:/opt/cardano/ipc \ | ||
inputoutput/cardano-node:dev run | ||
docker logs -f relay | ||
``` | ||
|
||
### Check cardano-cli | ||
|
||
``` | ||
alias cardano-cli="docker run --rm -it \ | ||
-v node-ipc:/opt/cardano/ipc \ | ||
inputoutput/cardano-node:dev cli" | ||
cardano-cli query tip --mainnet | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/env bash | ||
|
||
if [[ -n $NETWORK ]]; then | ||
|
||
exec /usr/local/bin/run-network $@ | ||
|
||
elif [[ $1 == "run" ]]; then | ||
|
||
exec /usr/local/bin/run-node $@ | ||
|
||
elif [[ $1 == "cli" ]]; then | ||
|
||
exec /usr/local/bin/run-client $@ | ||
|
||
else | ||
|
||
echo "Nothing to do! Perhaps try [run|cli]" | ||
exit 1 | ||
|
||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/env bash | ||
|
||
# Shift the first option by one index | ||
shift | ||
|
||
if [[ -z $CARDANO_NODE_SOCKET_PATH ]]; then | ||
export CARDANO_NODE_SOCKET_PATH="/opt/cardano/ipc/socket" | ||
fi | ||
|
||
/usr/local/bin/cardano-cli $@ |
Oops, something went wrong.