Closed michaelerose closed 6 years ago
you can add it in docker-compose file yourself, export port 22000 outside. Or you can modify create_dev_network.sh yourself
function addNodeToDC(){
echo " node"$1: >> $projectName/docker-compose.yml
echo " container_name: node"$1 >> $projectName/docker-compose.yml
echo " image: "$dockerImage >> $projectName/docker-compose.yml
echo " working_dir: /node"$1 >> $projectName/docker-compose.yml
echo " command: [\"bash\" , \"start.sh\"]" >> $projectName/docker-compose.yml
echo " volumes:" >> $projectName/docker-compose.yml
echo " - ./node$1:/node$1" >> $projectName/docker-compose.yml
echo " - ./node$1:/home" >> $projectName/docker-compose.yml
echo " - ./node1:/master" >> $projectName/docker-compose.yml
if [ -f .qm_export_ports ]; then
i=$1
if [ $i -lt 10 ]; then
i="0"$i
fi
echo " ports:" >> $projectName/docker-compose.yml
echo " - \"2${i}04:22004\"" >> $projectName/docker-compose.yml
echo " - \"2${i}00:22000\"" >> $projectName/docker-compose.yml
fi
echo " networks:" >> $projectName/docker-compose.yml
echo " vpcbr:" >> $projectName/docker-compose.yml
echo " ipv4_address: $DOCKER_NETWORK_IP$(($1+1))" >> $projectName/docker-compose.yml
}
adding echo " - \"2${i}00:22000\"" >> $projectName/docker-compose.yml
into it.
It would export the rpc port to 20100
@michaelerose I assume you are running QM2 on Linux. On Linux we use docker bridges and each node has it's own IP address starting from 10.50.0.2. So the RPC end point of first node is 10.50.0.2:22000 and second node is 10.50.0.3:22000 and third node is 10.50.0.4:22000 etc. You can access these IP address from your host Linux box. Same way you can access QM2 UI also from a web browser on host Linux pointing to http://10.50.0.2:22004, http://10.50.0.3:22004, http://10.50.0.4:22004 etc. In short you dont have to modify the setup.sh or docker compose file to access RPC port QM2 UI running on Linux
On Mac OS, docker can not export an internal bridge to host OS. To work around this problem, on Mac OS, QM2 automatically exports ports to host. The second and third digits auto increments and currently QM2 can create maximum 99 nodes. So the port number exposed is 20100, 20200, 20300 and so on. Same is the case for Constallation, Raft and QM2 UI ports. So the RPC url for node one is localhost:20100, node two is localhost:20200, node 3 is localhost:20300 and so on. And QM2 UI can be opened from node 1 at localhost:20104, node two at localhost:20204, node three at localhost:20304.
If you running QM2 on Vagrant using the Vagrantfile included in QM2, ports are exposed same way, and the IP of the virtual machine is 192.168.33.11 by default. So you if you want to connect to RPC ports from host OS while running using Vagant, node one is available at 192.168.33.11:20100, node two is available at 192.168.33.11:20200, node three is available at 192.168.33.11:20300 and so on. Same way QM2 UI can be accessed 20104, 20204, 20204 on IP Addreess 192.168.33.11. You can connectt to these URLs from your host Windows or Mac OS.
PS: In Linux, if you really want to expose ports and access directly using localhost rather than 10.50.0.2, 10.50.0.3 and so on, you can create a hidden file ".qm_export_ports" on quorum-maker directory (notice the "." in the beginning of the file name) and setup the Dev/Test Network and docker-compose.yml will have ports exported automatically. The exported ports are 20100, 20200, 20300 and so on just like the case of MacOS or Vagrant.
Thank you for responding so quickly ... trying this now
From: JerryZhao1988 notifications@github.com Sent: Friday, June 22, 2018 3:35 AM To: synechron-finlabs/quorum-maker Cc: michaelerose; Author Subject: Re: [synechron-finlabs/quorum-maker] RPC port (#28)
you can add it in docker-compose file yourself, export port 22000 outside. Or you can modify create_dev_network.sh yourself
function addNodeToDC(){ echo " node"$1: >> $projectName/docker-compose.yml echo " container_name: node"$1 >> $projectName/docker-compose.yml echo " image: "$dockerImage >> $projectName/docker-compose.yml echo " working_dir: /node"$1 >> $projectName/docker-compose.yml echo " command: [\"bash\" , \"start.sh\"]" >> $projectName/docker-compose.yml echo " volumes:" >> $projectName/docker-compose.yml echo " - ./node$1:/node$1" >> $projectName/docker-compose.yml echo " - ./node$1:/home" >> $projectName/docker-compose.yml echo " - ./node1:/master" >> $projectName/docker-compose.yml
if [ -f .qm_export_ports ]; then
i=$1
if [ $i -lt 10 ]; then
i="0"$i
fi
echo " ports:" >> $projectName/docker-compose.yml
echo " - \"2${i}04:22004\"" >> $projectName/docker-compose.yml
echo " - \"2${i}00:22000\"" >> $projectName/docker-compose.yml
fi
echo " networks:" >> $projectName/docker-compose.yml
echo " vpcbr:" >> $projectName/docker-compose.yml
echo " ipv4_address: $DOCKER_NETWORK_IP$(($1+1))" >> $projectName/docker-compose.yml
}
adding echo " - \"2${i}00:22000\"" >> $projectName/docker-compose.yml into it. It would export the rpc port to 20100
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/synechron-finlabs/quorum-maker/issues/28#issuecomment-399350713, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ADAl4QbbEJ1ScnbpZ-K_DtmM_4Ce8kM0ks5t_J5ZgaJpZM4UzIym.
This is not an issue. Features to access RPC and other ports exist.
Jerry -
This almost works ... I had to comment out the if/fi statements to get the changes to show up in docker-compose.yml. When I do that, port 20100 is exported and I have checked that I can
connect successfully with ethers.js/web3.js
So the only remaining issue is why the lines
if [ -f .qm_export_ports ]
....
fi
needed to be commented out
Once again, thanks for your help and advice
From: JerryZhao1988 notifications@github.com Sent: Friday, June 22, 2018 3:35 AM To: synechron-finlabs/quorum-maker Cc: michaelerose; Author Subject: Re: [synechron-finlabs/quorum-maker] RPC port (#28)
you can add it in docker-compose file yourself, export port 22000 outside. Or you can modify create_dev_network.sh yourself
function addNodeToDC(){ echo " node"$1: >> $projectName/docker-compose.yml echo " container_name: node"$1 >> $projectName/docker-compose.yml echo " image: "$dockerImage >> $projectName/docker-compose.yml echo " working_dir: /node"$1 >> $projectName/docker-compose.yml echo " command: [\"bash\" , \"start.sh\"]" >> $projectName/docker-compose.yml echo " volumes:" >> $projectName/docker-compose.yml echo " - ./node$1:/node$1" >> $projectName/docker-compose.yml echo " - ./node$1:/home" >> $projectName/docker-compose.yml echo " - ./node1:/master" >> $projectName/docker-compose.yml
if [ -f .qm_export_ports ]; then
i=$1
if [ $i -lt 10 ]; then
i="0"$i
fi
echo " ports:" >> $projectName/docker-compose.yml
echo " - \"2${i}04:22004\"" >> $projectName/docker-compose.yml
echo " - \"2${i}00:22000\"" >> $projectName/docker-compose.yml
fi
echo " networks:" >> $projectName/docker-compose.yml
echo " vpcbr:" >> $projectName/docker-compose.yml
echo " ipv4_address: $DOCKER_NETWORK_IP$(($1+1))" >> $projectName/docker-compose.yml
}
adding echo " - \"2${i}00:22000\"" >> $projectName/docker-compose.yml into it. It would export the rpc port to 20100
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/synechron-finlabs/quorum-maker/issues/28#issuecomment-399350713, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ADAl4QbbEJ1ScnbpZ-K_DtmM_4Ce8kM0ks5t_J5ZgaJpZM4UzIym.
In the previous version of quorum-maker, default RPC port 22000 was available and could be used by RPC-JSON-based applications like web3js and ethers.js. For version 2.1 test/development network (option 1 in setup.sh) the RPC port is not available even though the correct RPC port shows up on the UI screen. Since my node.js application depends on connecting to the blockchain via JSON-RPC, this is a serious issue.