Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Legacy tracing and OCI update #6042

Merged
merged 5 commits into from
Nov 25, 2024
Merged
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
1 change: 1 addition & 0 deletions configuration/cardano/mainnet-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"TracingVerbosity": "NormalVerbosity",
"TurnOnLogMetrics": true,
"TurnOnLogging": true,
"UseTraceDispatcher": false,
"defaultBackends": [
"KatipBK"
],
Expand Down
3 changes: 3 additions & 0 deletions configuration/cardano/mainnet-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ TurnOnLogging: True
# be directed to the logs or monitoring backends.
TurnOnLogMetrics: True

# Use legacy tracing
UseTraceDispatcher: False

# Global logging severity filter. Messages must have at least this severity to
# pass. Typical values would be Warning, Notice, Info or Debug.
minSeverity: Info
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.5"

services:
cardano-node:
image: inputoutput/cardano-node:${CARDANO_NODE_VERSION:-8.0.0}
image: ghcr.io/intersectmbo/cardano-node:${CARDANO_NODE_VERSION:-10.1.2}
environment:
- NETWORK=${NETWORK:-mainnet}
volumes:
Expand All @@ -15,7 +15,7 @@ services:
max-file: "10"

cardano-submit-api:
image: inputoutput/cardano-submit-api:${CARDANO_SUBMIT_API_VERSION:-8.0.0}
image: ghcr.io/intersectmbo/cardano-submit-api:${CARDANO_SUBMIT_API_VERSION:-10.1.2}
environment:
- NETWORK=${NETWORK:-mainnet}
depends_on:
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 16 additions & 14 deletions nix/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,24 @@ https://github.com/input-output-hk/cardano-node-wiki/wiki/building-the-node-usin
# Build + Install the cardano node
nix build .#mainnet/node -o ~/bin/cardano-node

# Build + Install the cardano Docker image
nix run .#dockerImage/node/load \
&& 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`
# Build + Install the cardano Docker image from bash shell
nix build .#dockerImage/node \
&& RES=$(docker load -i result) \
&& LOADED="${RES##Loaded image: }" \
&& GITHASH=$(git log -n1 --pretty='%H') \
&& docker tag "$LOADED" ghcr.io/intersectmbo/cardano-node:dev \
&& docker rmi "$LOADED"

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
docker tag ghcr.io/intersectmbo/cardano-node:dev "ghcr.io/intersectmbo/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
ghcr.io/intersectmbo/cardano-node:dev

cardano-node run \
--config /opt/cardano/config/mainnet-config.json \
Expand Down Expand Up @@ -50,7 +52,7 @@ docker run --rm -it \
-p 3001:3001 \
-e NETWORK=mainnet \
-v node-data:/data/db \
inputoutput/cardano-node:dev
ghcr.io/intersectmbo/cardano-node:dev
```

Run -e NETWORK=mainnet and check graceful shutdown SIGTERM with --detach
Expand All @@ -62,7 +64,7 @@ docker run --detach \
-p 3001:3001 \
-e NETWORK=mainnet \
-v node-data:/data/db \
inputoutput/cardano-node:dev
ghcr.io/intersectmbo/cardano-node:dev

docker logs -f relay
```
Expand All @@ -75,7 +77,7 @@ Check graceful shutdown SIGINT with -it
docker run --rm -it \
-p 3001:3001 \
-v node-data:/opt/cardano/data \
inputoutput/cardano-node:dev run
ghcr.io/intersectmbo/cardano-node:dev run
```

Check graceful shutdown SIGTERM with --detach
Expand All @@ -87,7 +89,7 @@ docker run --detach \
-p 3001:3001 \
-v node-data:/opt/cardano/data \
-v node-ipc:/opt/cardano/ipc \
inputoutput/cardano-node:dev run
ghcr.io/intersectmbo/cardano-node:dev run

docker logs -f relay
```
Expand All @@ -97,7 +99,7 @@ docker logs -f relay
```
alias cardano-cli="docker run --rm -it \
-v node-ipc:/opt/cardano/ipc \
inputoutput/cardano-node:dev cli"
ghcr.io/intersectmbo/cardano-node:dev cli"

cardano-cli query tip --mainnet
```
26 changes: 13 additions & 13 deletions nix/docker/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@
#
# To build and load into the Docker engine:
#
# nix run .#dockerImage/node/load
# nix build .#dockerImage/node
# docker load -i result
#
# To launch with pre-loaded configuration, using the NETWORK env.
# An example using a docker volume to persist state:
#
# docker run -v /data -e NETWORK=mainnet inputoutput/cardano-node
# docker run -v /data -e NETWORK=mainnet ghcr.io/intersectmbo/cardano-node
#
# Provide a complete command otherwise:
#
# docker run -v $PWD/configuration/defaults/byron-mainnet:/configuration \
# inputoutput/cardano-node run \
# --config /configuration/configuration.yaml \
# --topology /configuration/topology.json \
# docker run -v $PWD/configuration/cardano:/configuration \
# ghcr.io/intersectmbo/cardano-node run \
# --config /configuration/mainnet-config.yaml \
# --topology /configuration/mainnet-topology.json \
# --database-path /db
#
# Mount a volume into /ipc for establishing cross-container communication via node.socket
#
# docker run -v node-ipc:/ipc inputoutput/cardano-node
# docker run -v node-ipc:/ipc inputoutput/some-node-client
# docker run -v node-ipc:/ipc -e NETWORK=mainnet ghcr.io/intersectmbo/cardano-node
# docker run -v node-ipc:/ipc -e NETWORK=mainnet ghcr.io/intersectmbo/some-node-client
############################################################################

{ pkgs
Expand All @@ -38,7 +39,6 @@

# Other things to include in the image.
, bashInteractive
, buildPackages
, cacert
, coreutils
, curl
Expand All @@ -48,12 +48,10 @@
, iputils
, socat
, utillinux
, writeScriptBin
, runtimeShell
, lib
, exe
, script
, repoName ? "inputoutput/${exe}"
, repoName ? "ghcr.io/intersectmbo/${exe}"
}:

let
Expand Down Expand Up @@ -83,6 +81,7 @@ let
mkdir -m 0777 tmp
'';
};

# Image with all iohk-nix network configs or utilizes a configuration volume mount
# To choose a network, use `-e NETWORK testnet`
clusterStatements = lib.concatStringsSep "\n" (lib.mapAttrsToList (env: scripts: let
Expand All @@ -109,7 +108,7 @@ let
# Mainnet configuration used by the 'run' option
mainnetConfigFile = builtins.toFile "mainnet-config.json"
(builtins.toJSON commonLib.environments.mainnet.nodeConfig);
mainnetTopologyFile = commonLib.mkEdgeTopology { edgeNodes = [ commonLib.environments.mainnet.relaysNew ]; valency = 2; };
mainnetTopologyFile = commonLib.mkTopology commonLib.environments.mainnet;

in
dockerTools.buildImage {
Expand All @@ -135,6 +134,7 @@ in
ln -s ${cardano-node}/bin/cardano-node usr/local/bin/cardano-node
ln -s ${cardano-cli}/bin/cardano-cli usr/local/bin/cardano-cli
'';

config = {
EntryPoint = [ "entrypoint" ];
};
Expand Down
22 changes: 14 additions & 8 deletions nix/docker/submit-api.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@
#
# To build and load into the Docker engine:
#
# nix run .#DockerImage/submit-api/load
# nix run .#dockerImage/submit-api
# docker load -i result
#
# cardano-submit-api
# To launch with provided mainnet configuration
#
# docker run -e NETWORK=mainnet inputoutput/cardano-submit-api:<TAG>
# docker run -e NETWORK=mainnet ghcr.io/intersectmbo/cardano-submit-api:<TAG>
#
# To launch with provided testnet configuration
# To launch with provided testnet configuration
#
# docker run -e NETWORK=testnet inputoutput/cardano-submit-api:<TAG>
# docker run -e NETWORK=testnet ghcr.io/intersectmbo/cardano-submit-api:<TAG>
#
# Provide a complete command otherwise:
#
# docker run -v $PWD/config.yaml:/config.yaml inputoutput/cardano-submit-api:<TAG> \
# --config /config.yaml --mainnet --socket-path /node-ipc/node.socket
# docker run -v $PWD/config.yaml:/config.yaml ghcr.io/intersectmbo/cardano-submit-api:<TAG> \
# --config /config.yaml --mainnet --socket-path /node-ipc/node.socket
#
# See the docker-compose.yml for demonstration of using Docker secrets instead of mounting a pgpass
# See the docker-compose.yml for demonstration of using Docker secrets instead of mounting a pgpass
#
############################################################################

Expand Down Expand Up @@ -50,7 +51,7 @@
, lib
, exe
, script
, repoName ? "inputoutput/${exe}"
, repoName ? "ghcr.io/intersectmbo/${exe}"
}:

let
Expand Down Expand Up @@ -79,6 +80,7 @@ let
mkdir -m 0777 tmp
'';
};

# Image with all iohk-nix network configs or utilizes a configuration volume mount
# To choose a network, use `-e NETWORK testnet`
clusterStatements = lib.concatStringsSep "\n" (lib.mapAttrsToList (env: scripts: let
Expand All @@ -87,6 +89,7 @@ let
elif [[ "$NETWORK" == "${env}" ]]; then
exec ${scriptBin}/bin/${scriptBin.name} $@
'') scripts);

nodeDockerImage = let
entry-point = writeScriptBin "entry-point" ''
#!${runtimeShell}
Expand All @@ -97,16 +100,19 @@ let
echo "Managed configuration for network "$NETWORK" does not exist"
fi
'';

in dockerTools.buildImage {
name = "${repoName}";
fromImage = baseImage;
tag = "${gitrev}";
created = "now"; # Set creation date to build time. Breaks reproducibility

copyToRoot = pkgs.buildEnv {
name = "image-root";
pathsToLink = ["/"];
paths = [entry-point];
};

config = {
EntryPoint = [ "${entry-point}/bin/entry-point" ];
ExposedPorts = {
Expand Down
3 changes: 3 additions & 0 deletions nix/nixos/cardano-node-service.nix
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ let
options = {};
}
else baseConfig //
{
UseTraceDispatcher = false;
} //
(optionalAttrs (baseConfig ? hasEKG) {
hasEKG = baseConfig.hasEKG + i;
}) //
Expand Down
Loading