Skip to content
This repository was archived by the owner on Feb 19, 2024. It is now read-only.

Latest commit

 

History

History

docker

Running local Radix networks with docker

Setup

  1. Install Docker for Mac or Docker for Linux version 20.10.10 or newer
  2. Be happy :)

File structure

A highly configurable Radix client image is implemented in Dockerfile. Configuration is done by means of environment variables passed to Docker containers at startup.

Different network setups are implemented in docker-compose files. (*.yml).

Ready to use configuration files are provided for 1-5 nodes: 1, 2, 3, 4 and 5 nodes. If configuration with other number of nodes is necessary, it can be generated using configuration generator.

Description below refers single node configuration. In order to run other configurations just replace docker/node-1.yml with relative path to necessary configuration file.

Generating New Configuration

In order to generate .yml file for necessary number of nodes, just run following command from docker/script subdirectory:

$ ./generate-yml.sh <number of nodes>

Script will generate configuration file named node-<number of nodes>.yml in the same directory where other node-X.yml files reside.

Build the radixdlt debian package

The Dockerfile depends on the radixdlt_*_all.deb package which is built with:

$ ./gradlew deb4docker

Create and start the single node network

$ docker-compose -f docker/node-1.yml up -d --build

To see the individual radixdlt containers:

$ docker ps

Destroy the network

$ docker-compose -f docker/node-1.yml down

Follow combined logs

docker-compose -f docker/node-1.yml logs -f

See the container metrics

$ docker stats docker_explorer_1

Start an interactive shell session in a container

$ docker exec -it docker_explorer_1 bash

Make an API call

$ docker exec docker_explorer_1 curl -s http://explorer:8080/api/system

Start spamathon

The API port is not exported by default, so we go through one of the containers:

$ docker exec docker_explorer_1 curl -s 'http://validator:8080/api/atoms/spamathon?iterations=100000&rate=1000'

Debugging, profiling, etc.

VisualVM is your friend.

The JMX ports are exposed to ports 9010-90xx on the docker host. Use docker ps to find the specific JMX port you want to connect VisualVM to. (The JMX host is thus localhost).

Heapdumps don't work from VisualVM currently - the alternate is to use jmap, for example:

$ docker exec docker_explorer_1 jmap -dump:live,format=b,file=/tmp/radixdlt.hprof 1
$ docker cp docker_explorer_1:/tmp/radixdlt.hprof .

Running from Jenkins

Ephemeral networks are supported by using the -p argument with docker-compose.

Build the radixdlt debian package

The Dockerfile depends on the radixdlt_*_all.deb package which is built with:

$ ./gradlew deb4docker

Create and start the network

Create an ephemeral network called test$BUILD_NUMBER, in example test123.

$ docker-compose -p test$BUILD_NUMBER -f docker/jenkins-network.yml up -d --build

Find the IP number of the core0 node

$ docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' test${BUILD_NUMBER}_core0_1

Find the IP of all core nodes

$ for i in 0 1 2 3 4 5; do docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' test${BUILD_NUMBER}_core${i}_1; done

kill the network

$ docker-compose -p  test$BUILD_NUMBER -f docker/node-1.yml down