Deploy Docker Scripts for Running a Private Network

Setup

Clone repository

1
git clone https://github.com/xdcorg/XDC01-docker-Nnodes.git
Copied!

Step 1: Install Docker & Docker-compose

1
sudo ./install_docker.sh
Copied!

Step 2: Pull image from Docker Hub

1
sudo docker pull xdcorg/quorum:v2.1.0
Copied!

Step 3: Launch the setup script

1
cd static-nodes
2
sudo ./setup.sh
Copied!
Enter the number of nodes, private IP of the host machine, and unique docker subnet. You can view the private IP of your machine using ipconfig.

To check the private IP address on Ubuntu GUI:

  • Open the Activities overview and start typing Network.
  • Click on Network to open the panel.
  • Choose the connection, Wi-Fi or Wired, from the left pane.
  • The IP address for a wired connection will be displayed on the right.
  • Click the settings button to see the IP address for the wireless Network in the Details panel.

Accessing console

1
sudo docker exec -it PROJECT_NAME_STATIC_NODES_node_1_1 geth attach /qdata/dd/geth.ipc
Copied!

Stopping the network

1
sudo docker-compose -p <PROJECT_NAME_STATIC_NODE> down
Copied!

Adding a new node to the existing network

Install docker and pull image on the new host machine as done earlier in Steps 1 and 2.
1
cd dynamic-node
2
sudo ./setup.sh
Copied!
Enter public IP of the new host machine (in case of local setup, private IP assigned by router). Enter the node number (e.g., if you have three nodes up with the initial setup, then the node number here would be 4)
Copy enodeID from enode-url.json, then attach to Geth console of any running node and execute.
1
raft.addPeer(enodeID)
Copied!

Start the new node

1
cd dynamic-node
2
sudo docker-compose -p <PROJECT_NAME_DYNAMIC_NODE> up -d
Copied!

Upgrade network

Pull a newer version of the image from the docker hub.
1
sudo docker pull xdcorg/quorum:v2.x.x
Copied!
Stop containers running the old version.
1
sudo docker-compose -p <PROJECT_NAME_STATIC/DYNAMIC_NODE> down
Copied!
Update docker-compose.yml to use a new image (specify quorum: TAG_NAME as argument).
1
sudo ./update_quorum.sh quorum:v2.x.x
Copied!
Run new version.
1
sudo docker-compose -p <PROJECT_NAME_STATIC/DYNAMIC_NODE> up -d
Copied!

Contact Us

Join our Telegram Developer Group to ask us questions or raise issues in our Github. We would love to help.