ethereum-pocr / ethereum-pocr.github.io

Apache License 2.0
4 stars 0 forks source link

Docker build

** Prerequesites It is required to have docker-compose v2.3.3 installed for the scripts to work (or you get a nonsense misleading python error). To upgrade:

sudo apt update
sudo apt install docker-compose-plugin
docker compose version
sudo rm /usr/local/bin/docker-compose
echo 'alias docker-compose="docker compose"' >> ~/.bashrc
source ~/.bashrc
docker-compose version

** Build monitoring.dockerfile

docker build -f monitoring.dockerfile -t pocr-mon . 

docker-compose.yml content

In the root of the pocr-monorepo folder there is a docker-compose.yml that bootstrap many services

.env file This file is used by docker-compose.yml to read the default environment variables

pocr-network/genesis directory Everytime the smartcontracts changes the CICD will build and publish 2 genesis files kerleano.jsonand local.json, the sealer download the genesis of the blockchain (check pocr-network/sealer/Dockerfile ) and then use geth init with the file downloaded to init the network before the start

Deprecated This directory contains some genesis files used as example to bootstrap the blockchain locally. Example:

You can start the local network with any genesis file you want by changing in .env file the path to genesis MOUNT_GENESIS_FILE_PATH=<path_to_genesis_file> and the network id NETWORK_ID=<network_id_of_the_genesis>

Start/stop the stack

in the root folder there are start.sh and stop.sh scripts to start and stop the stack.

Those scripts use docker-compose.yml to start all or some specific services

By default start.sh will only start portainer if no arguments are passed to the script

./start.sh

If you want to start all the services (network, monitoring and lb) use all as argument

./start.sh all 

If you want to start just the network use network as argument

./start.sh network

If you want to start just the monitoring use monitoring as argument

./start.sh monitoring

You can also combine arguments if needed, like starting networkservices and monitoring services

./start.sh network monitoring

If you want to run process in background add -d option to the start command, example:

# start monitoring in background
./start.sh monitoring -d

# start network in background
./start.sh network -d

To stop the stack use

./stop.sh

Use the initialized CRC

The account 0x3D0a5f7514906c02178c6Ce5c4ec33256F08Ce58 is initialized with some CRC (6000 for now) in the genesis. To use it you have in the pocr-network/keystore folder the json wallet (which password is password) or the auditor private key.

persistance

The docker-compose persiste the data of sealers by mounting the volumes to the host using the keys in .env file MOUNT_DATADIR_NODE_1=./pocr-network/data/node1/ MOUNT_DATADIR_NODE_2=./pocr-network/data/node2/ MOUNT_DATADIR_NODE_3=./pocr-network/data/node3/

If you want to reset the blockchain then delete /pocr-network/data directory (rm -rf /pocr-network/data/)

apps and access

When you start the stack you can access the diffrent services at the urls bellow: