Docker files for setting up Cardano Node environment and more.
You can support this repository by delegating to Berry pool [BERRY] 🙏
** These Dockerfiles are meant to be run along with Docker-Compose.
- GHC version: 9.10.2
- Cabal version: 3.12.1.0
- Supported cardano-node version: 10.5.3
- Supported cardano-cli version: 10.13.1.0
- Supported cardano-submit-api version: 10.1.1
- Supported mithril version: 2543.1-hotfix
- Supported DB-SYNC version: 13.6.0.6
Most images are built on top of the cardano_env:latest images, make sure to build it first.
This image install dependencies and compilation tooling required by other images.
- Build Environment image
- Cardano Node image
- Submit API image
- DB-Sync image
- Mithril Signer image
- Mithril Client image
- Mithril Relay (squid) image
ARCHITECTURE=<PROCESSOR_ARCHITECTURE(x86_64 or aarch64)>
docker build \
-t cardano_env:latest \
./Dockerfiles/build_env/${ARCHITECTURE}
** Tip: _Add `--no-cache` to rebuild from scratch_ **
ARCHITECTURE=<PROCESSOR_ARCHITECTURE(x86_64 or aarch64)>
NODE_TAG=<VERSION_TAG>
CLI_TAG=<VERSION_TAG> # only version number, omit the leading 'cardano-cli'
docker build \
--build-arg ARCHITECTURE=${ARCHITECTURE} \
--build-arg NODE_TAG=${NODE_TAG} \
--build-arg CLI_TAG=${CLI_TAG} \
-t cardano_node:${NODE_TAG} Dockerfiles/nodeARCHITECTURE=<PROCESSOR_ARCHITECTURE(x86_64 or aarch64)>
NODE_TAG=<VERSION_TAG>
API_VERSION=<Submit API version, see cardano-submit-api.cabal file>
docker build \
--build-arg ARCHITECTURE=${ARCHITECTURE} \
--build-arg NODE_TAG=${NODE_TAG} \
--build-arg API_VERSION=${API_VERSION} \
-t cardano_submit:${API_VERSION} Dockerfiles/submitARCHITECTURE=<PROCESSOR_ARCHITECTURE(x86_64 or aarch64)>
DBSYNC_TAG=<db-sync release tag>
docker build \
--build-arg ARCHITECTURE=${ARCHITECTURE} \
--build-arg RELEASE=${DBSYNC_TAG} \
-t cardano_db_sync:${DBSYNC_TAG} Dockerfiles/db-syncARCHITECTURE=<PROCESSOR_ARCHITECTURE(x86_64 or aarch64)>
NODE_TAG=<VERSION_TAG>
CLI_TAG=<VERSION_TAG>
MITHRIL_TAG=<VERSION_TAG>
docker build \
--build-arg ARCHITECTURE=${ARCHITECTURE} \
--build-arg NODE_TAG=${NODE_TAG} \
--build-arg MITHRIL_TAG=${MITHRIL_TAG} \
--build-arg CLI_TAG=${CLI_TAG} \
-t mithril_signer:${MITHRIL_TAG} Dockerfiles/mithril-signer** See: mithril.network/doc/
MITHRIL_TAG=<VERSION_TAG>
docker build \
--build-arg MITHRIL_TAG=${MITHRIL_TAG} \
-t mithril_client:${MITHRIL_TAG} Dockerfiles/mithril-client** See: mithril.network/doc/
-
Edit
/Dockerfiles/squid/file/squid.confto add your producer internal ip address. -
Add the configuration file in a
./squidfolder next to yourdocker-compose.ymlfile.docker build -t squid:latest Dockerfiles/squid
** See: mithril.network/doc/
In order to have access to your node files directly on your host, we will use docker bind volumes. This allows you to attach a folder on your host to a folder inside your node container. They do not have to bare the same name nor the same path.
To make things simple, create the following folders structure:
~/Cardano/{bp|relay1|relayX}/config
~/Cardano/{bp|relay1|relayX}/socket
~/Cardano/{bp|relay1|relayX}/db
** ~ is equivalent to your home folder, ie: /home/your_user_name
Now you've created yours images, it's time to create your config folder, if this is not already done.
Your container will bind to this folder, so you can access your configuration from within.
mkdir config
cd config
You can find required configuration files here: https://book.play.dev.cardano.org/env-mainnet.html.
Here's the files you'll need:
config.jsontopology.jsonbyron-genesis.json(referenced to in config.json)shelley-genesis.json(referenced to in config.json)alonzo-genesis.json(referenced to in config.json)conway-genesis.json(referenced to in config.json)
Note that a producer node will need 3 more file to run:
node.cert(node operational certificat)vrf.skeykes.skey
All node are listening to the port 3000 inside the container. You can bind that port to the host port you like.
Now you need to configure your topology.json file with your Relay and Producer node information.
If using docker-compose, a virtual network named cardano will be created. This allow to isolate the block producer node
from the host network, making it reachable only by the relay nodes. You can reference them in your topology.json file by using
their generated hostname or the given alias.
Generated hostname will have the following form:
{service name}.{project name}_{network name}
Whereas the Project Name is determined by the folder holding the docker-compose.yaml file. In our case, /Cardano as seen previously.
** Note that the generated hostname is all lowercase.
See prometheus.yml for hostname examples.
Docker Compose required cardano_node and cardano_monitor images.
To build the cardano_monitor image, read: Monitoring with Grafana.
You can copy the docker-compose.yaml where your config/ folder reside. Then start your containers with the
following command:
docker-compose up -d
** Tips: To start a node as producer instead of relay, swap the comment on CMD line in the docker-compose.yaml file.
Genesis peer snapshot file can be updated periodically via system CRON.
# Once per week at 00:00 on Sunday
0 0 * * 0 docker exec cardano-relay cardano-cli query ledger-peer-snapshot --mainnet --out-file /cardano/config/peer-snapshot.json