{"id":13464776,"url":"https://github.com/tdiesler/nessus-cardano","last_synced_at":"2025-03-25T11:32:09.296Z","repository":{"id":40471193,"uuid":"323099477","full_name":"tdiesler/nessus-cardano","owner":"tdiesler","description":"A Cardano playground that explores various build/runtime aspects of the project. Something like an incubation space, before we are propose changes upstream. The initial focus is on \"container first\" for the Cardano node.","archived":true,"fork":false,"pushed_at":"2022-05-05T14:11:12.000Z","size":887,"stargazers_count":91,"open_issues_count":0,"forks_count":29,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-10-29T17:55:29.793Z","etag":null,"topics":["amd64","arm64","cardano","docker"],"latest_commit_sha":null,"homepage":"","language":"Tcl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tdiesler.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-20T15:10:06.000Z","updated_at":"2024-08-15T10:05:03.000Z","dependencies_parsed_at":"2022-08-22T15:00:32.253Z","dependency_job_id":null,"html_url":"https://github.com/tdiesler/nessus-cardano","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdiesler%2Fnessus-cardano","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdiesler%2Fnessus-cardano/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdiesler%2Fnessus-cardano/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdiesler%2Fnessus-cardano/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tdiesler","download_url":"https://codeload.github.com/tdiesler/nessus-cardano/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245454205,"owners_count":20617991,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amd64","arm64","cardano","docker"],"created_at":"2024-07-31T14:00:50.132Z","updated_at":"2025-03-25T11:32:08.295Z","avatar_url":"https://github.com/tdiesler.png","language":"Tcl","funding_links":[],"categories":["Shell","Tcl"],"sub_categories":[],"readme":"\n# Nessus Cardano\n\nWith Nessus Cardano we explore, praise, comment, contribute to various technical aspects of [Cardano](https://cardano.org).\nThis is our contribution to \"Making The World Work Better For All\".\n\nInitially, we focus on a \"container first\" approach for the Cardano node.\n\n## Running a Node\n\nTo get up and running with [Cardano](https://cardano.org), you can spin up a node like this ...\n\n```\ndocker run --detach \\\n    --name=relay \\\n    -p 3001:3001 \\\n    -v node-data:/opt/cardano/data \\\n    -v node-ipc:/opt/cardano/ipc \\\n    nessusio/cardano-node run\n\ndocker logs -f relay\n```\n\nThis works on [x86_64](https://hub.docker.com/r/nessusio/cardano-node/tags?name=amd64) and [arm64](https://hub.docker.com/r/nessusio/cardano-node/tags?name=arm64).\n\nThe [nessusio/cardano-node](https://hub.docker.com/r/nessusio/cardano-node) image is built from source in multiple stages like [this](nix/cardano/Dockerfile) and then\nwith [Nix](https://nixos.org) like [this](nix/docker/node/default.nix).\n\n## Running a Node on the Testnet\n\n```\ndocker run --detach \\\n    --name=testrl \\\n    -p 3001:3001 \\\n    -e CARDANO_NETWORK=testnet \\\n    -v test-data:/opt/cardano/data \\\n    -v node-ipc:/opt/cardano/ipc \\\n    nessusio/cardano-node run\n\ndocker logs -f testrl\n```\n\n## Accessing the build-in gLiveView\n\nThe image has [gLiveView](https://github.com/cardano-community/guild-operators/blob/alpha/scripts/cnode-helper-scripts/gLiveView.sh) monitoring built in.\n\nFor a running container, you can do ...\n\n```\ndocker exec -it relay gLiveView\n```\n\n\u003cimg src=\"docs/img/relay-glview.png\" width=\"500\"\u003e\n\n## Accessing the build-in topology updater\n\nThere is currently no P2P module activated in cardano-1.26.1. Your node may call out to well known relay nodes, but you may never have incoming connections.\nAccording to [this](https://github.com/cardano-community/guild-operators/blob/alpha/docs/Scripts/topologyupdater.md) it is necessary to update your topology\nevery hour. At the time of writing, cardano-node doesn't do this on its own.\n\nThis functionality has been built into nessus/cardano-node as well. On startup, you should see a log similar to this ...\n\n```\ndocker run --detach \\\n    --name=relay \\\n    -p 3001:3001 \\\n    -e CARDANO_UPDATE_TOPOLOGY=true \\\n    -v node-data:/opt/cardano/data \\\n    nessusio/cardano-node run\n\n$ docker exec -it relay tail /opt/cardano/logs/topologyUpdateResult\n{ \"resultcode\": \"201\", \"datetime\":\"2021-01-10 18:30:06\", \"clientIp\": \"209.250.233.200\", \"iptype\": 4, \"msg\": \"nice to meet you\" }\n{ \"resultcode\": \"203\", \"datetime\":\"2021-01-10 19:30:03\", \"clientIp\": \"209.250.233.200\", \"iptype\": 4, \"msg\": \"welcome to the topology\" }\n{ \"resultcode\": \"204\", \"datetime\":\"2021-01-10 20:30:04\", \"clientIp\": \"209.250.233.200\", \"iptype\": 4, \"msg\": \"glad you're staying with us\" }\n```\n\nThe topologyUpdater is triggered by `CARDANO_UPDATE_TOPOLOGY`. Without it, the cron job is not installed.\n\n## External storage for block data\n\nIn this configuration, we map the node's `--database-path` to a mounted directory.\n\n```\ndocker run --detach \\\n    --name=relay \\\n    -p 3001:3001 \\\n    -v /mnt/disks/data00:/opt/cardano/data \\\n    nessusio/cardano-node run\n\ndocker logs -f relay\n```\n\n## Using custom configurations\n\nHere we define a config volume called `cardano-relay-config`. It holds the `mainnet-topology.json` file that we setup externally.\nNote, that our custom config lives in `/var/cardano/config` and not in the default location `/opt/cardano/config`.\n\n```\ndocker run --detach \\\n    --name=relay \\\n    -p 3001:3001 \\\n    -e CARDANO_UPDATE_TOPOLOGY=true \\\n    -e CARDANO_CUSTOM_PEERS=\"$PRODUCER_IP:3001\" \\\n    -e CARDANO_TOPOLOGY=\"/var/cardano/config/mainnet-topology.json\" \\\n    -v cardano-relay-config:/var/cardano/config  \\\n    -v /mnt/disks/data00:/opt/cardano/data \\\n    nessusio/cardano-node run\n\ndocker logs -f relay\n```\n\n## Running a Block Producer Node\n\nA producer node is configured in the same way as a Relay node, except that it has some additional key/cert files configured and does not need to update its topology.\n\n```\ndocker run --detach \\\n    --name=bprod \\\n    -p 3001:3001 \\\n    -e CARDANO_BLOCK_PRODUCER=true \\\n    -e CARDANO_TOPOLOGY=\"/var/cardano/config/mainnet-topology.json\" \\\n    -e CARDANO_SHELLEY_KES_KEY=\"/var/cardano/config/keys/pool/kes.skey\" \\\n    -e CARDANO_SHELLEY_VRF_KEY=\"/var/cardano/config/keys/pool/vrf.skey\" \\\n    -e CARDANO_SHELLEY_OPERATIONAL_CERTIFICATE=\"/var/cardano/config/keys/pool/node.cert\" \\\n    -v cardano-prod-config:/var/cardano/config  \\\n    -v /mnt/disks/data01:/opt/cardano/data \\\n    nessusio/cardano-node run\n\ndocker logs -f bprod\n\ndocker exec -it bprod gLiveView\n```\n\n## Running the Cardano CLI\n\nWe can also use the image to run Cardano CLI commands.\n\nFor this to work, the node must share its IPC socket location, which can then\nbe use in the alias definition.\n\n```\nalias cardano-cli=\"docker run -it --rm \\\n  -v ~/cardano:/var/cardano/local \\\n  -v node-ipc:/opt/cardano/ipc \\\n  nessusio/cardano-node cardano-cli\"\n\ncardano-cli query tip --mainnet\n{\n    \"blockNo\": 5102089,\n    \"headerHash\": \"e5984f27d1d3b5dcc296b33ccd919a28618ff2d77513971bd316cffd35afecda\",\n    \"slotNo\": 16910651\n}\n```\n\n## Docker Compose\n\nWe sometimes may prefer somm middle ground between manually spinning up individual docker containers and the full blown enterprise Kubernetes account.\n\nPerhaps we'd like to use [Docker Compose](https://docs.docker.com/compose).\n\n```\n$ docker-compose -f nix/docker/compose/cardano-node-relay.yaml up --detach\n\nCreating relay ... done\nCreating nginx ... done\n\n$ docker-compose -f nix/docker/compose/cardano-node-bprod.yaml up --detach\n\nCreating bprod ... done\nCreating nginx ... done\n```\n\nFor details you may want to have a look at [nix/docker/compose/cardano-nodes.yaml](https://github.com/tdiesler/nessus-cardano/blob/master/nix/docker/compose/cardano-nodes.yaml).\n\n## Kubernetes\n\nThis project has started as an incubator space for stuff that may eventually become available upstream. As part of this, we want to\n\"[provide high quality multiarch docker images and k8s support](https://forum.cardano.org/t/provide-high-quality-multiarch-docker-image-and-k8s-support/47906)\"\n\nWith Kubernetes as the de-facto standard for container deployment, orchestration, monitoring, scaling , etc, it should be as easy as this to run Cardano nodes …\n\n\n```\nkubectl apply -f nix/docker/k8s/cardano-nodes.yaml\n\nstorageclass.storage.k8s.io/cardano-standard-rwo created\npersistentvolumeclaim/relay-data created\npod/relay created\nservice/relay-np created\nservice/relay-clip created\npersistentvolumeclaim/bprod-data created\npod/bprod created\nservice/bprod-clip created\n```\n\nThis is documented in detail [over here](https://tdiesler.gitbook.io/cardano/k8s/cardano-k8s).\n\nFor details you may want to have a look at [nix/docker/k8s/cardano-nodes.yaml](https://github.com/tdiesler/nessus-cardano/blob/master/nix/docker/k8s/cardano-nodes.yaml).\n\n## Leader logs\n\nFor a Stake Pool Operator it is important to know when the node is scheduled to produce the next block. We definitely want to be online at that important moment and fullfil our block producing duties. There are better times to do node maintenance.\n\nThis important functionality has also been built into the [nessusio/cardano-tools](https://hub.docker.com/r/nessusio/cardano-tools) image.\n\nFirst, lets define an alias and ping the node that we want to work with.\n\nDetails about this API are [here](https://github.com/AndrewWestberg/cncli/blob/develop/USAGE.md).\n\n```\n$ alias cncli=\"docker run -it --rm \\\n  -v ~/cardano:/var/cardano/local \\\n  -v cncli:/var/cardano/cncli \\\n  nessusio/cardano-tools cncli\"\n\nNODE_IP=192.168.0.30\n\ncncli ping --host $NODE_IP\n{\n  \"status\": \"ok\",\n  \"host\": \"10.128.0.31\",\n  \"port\": 3001,\n  \"connectDurationMs\": 0,\n  \"durationMs\": 53\n}\n```\n\n### Syncing the database\n\nThis command connects to a remote node and synchronizes blocks to a local sqlite database.\n\n```\n$ cncli sync --host $NODE_IP \\\n  --db /var/cardano/cncli/cncli.db \\\n  --no-service\n\n...\n2021-03-04T10:23:19.719Z INFO  cardano_ouroboros_network::protocols::chainsync   \u003e block 5417518 of 5417518, 100.00% synced\n2021-03-04T10:23:23.459Z INFO  cncli::nodeclient::sync                           \u003e Exiting...\n```\n\n### Slot Leader Schedule\n\nWe can now obtain the leader schedule for our pool.\n\n```\nSTAKE_SNAPSHOT=$HOME/cardano/scratch/stake-snapshot.json\ncardano-cli query stake-snapshot --stake-pool-id 9e8009b249142d80144dfb681984e08d96d51c2085e8bb6d9d1831d2 --mainnet | \\\n  tee $STAKE_SNAPSHOT\n\n# Prev\nLEDGER_SET=prev\nPOOL_STAKE=$(cat $STAKE_SNAPSHOT | jq .poolStakeGo)\nACTIVE_STAKE=$(cat $STAKE_SNAPSHOT | jq .activeStakeGo)\n\n# Current\nLEDGER_SET=current\nPOOL_STAKE=$(cat $STAKE_SNAPSHOT | jq .poolStakeSet)\nACTIVE_STAKE=$(cat $STAKE_SNAPSHOT | jq .activeStakeSet)\n\n# Next\nLEDGER_SET=next\nPOOL_STAKE=$(cat $STAKE_SNAPSHOT | jq .poolStakeMark)\nACTIVE_STAKE=$(cat $STAKE_SNAPSHOT | jq .activeStakeMark)\n\n$ cncli leaderlog \\\n  --pool-id 9e8009b249142d80144dfb681984e08d96d51c2085e8bb6d9d1831d2 \\\n  --shelley-genesis /opt/cardano/config/mainnet-shelley-genesis.json \\\n  --byron-genesis /opt/cardano/config/mainnet-byron-genesis.json \\\n  --pool-vrf-skey /var/cardano/local/mainnet/keys/pool/vrf.skey \\\n  --db /var/cardano/cncli/cncli.db \\\n  --active-stake $ACTIVE_STAKE \\\n  --pool-stake $POOL_STAKE \\\n  --tz Europe/Berlin \\\n  --ledger-set $LEDGER_SET | tee leaderlog.json\n\ncat leaderlog.json | jq -c \".assignedSlots[] | {no: .no, slot: .slotInEpoch, at: .at}\"\n\n{\"no\":1,\"slot\":165351,\"at\":\"2021-02-26T20:40:42+01:00\"}\n{\"no\":2,\"slot\":312656,\"at\":\"2021-02-28T13:35:47+01:00\"}\n{\"no\":3,\"slot\":330588,\"at\":\"2021-02-28T18:34:39+01:00\"}\n{\"no\":4,\"slot\":401912,\"at\":\"2021-03-01T14:23:23+01:00\"}\n```\n\n# Build the Images\n\nIn line with the [upstream project](https://github.com/input-output-hk/cardano-node) we also us\na [Nix](https://nixos.org/guides/install-nix.html) based build. The build requires Nix and a\nworking Docker environment. This works on x86_64 and arm64.\n\nSpinning up a build/test environment on GCE is documented [here](./vps/gce-centos8.md)\n\nTo build all images and their respective dependencies, run ...\n\n```\n./build.sh all\n```\n\nEnjoy!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftdiesler%2Fnessus-cardano","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftdiesler%2Fnessus-cardano","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftdiesler%2Fnessus-cardano/lists"}