Damounet
Damounet

Reputation: 120

Remote access to fabric-sample Fabric network

I deployed a Fabric network on a remote host using the fabric-samples project with the help of the test-network feature.

Here how I did:

./network.sh up createChannel -ca
./network.sh deployCC -ccl typescript -ccp ~/blockchain/ -cci initLedger

So that I deployed my own blockchain with an init function inside the network.

I have developt an application that calls the network and it works fine when testing all on my computer.
I want to deploy my Fabric network and chaincode on a remote VM so that my colleagues can continue develop the application and call the same fabric network.

To achieve this, I have deployed the network on my remote VM and downloaded in local the fabric-samples/test-network/organizations/peerOrganizations/org1.example.com folder on my local computer to retrieve the generated certificates and connection infos.
I edited the org1.example.com/connection-org1.json file to change the localhost address to the IP of my remote VM.

After configuring my application to use the correct connection-org1.json and fabric-ca-client-config.yaml files, I start my app.
I was able to enroll an admin and create a new user on the network.
But when I want to submit or evaluate a transaction I get the following error

2020-12-18T12:15:46.586Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: orderer.example.com:7050, url:grpcs://orderer.example.com:7050, connected:false, connectAttempted:true
2020-12-18T12:15:46.587Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server orderer.example.com:7050 url:grpcs://orderer.example.com:7050 timeout:3000
2020-12-18T12:15:46.587Z - error: [DiscoveryService]: _buildOrderer[mychannel] - Unable to connect to the discovered orderer orderer.example.com:7050 due to Error: Failed to connect before the deadline on Committer- name: orderer.example.com:7050, url:grpcs://orderer.example.com:7050, connected:false, connectAttempted:true
2020-12-18T12:15:49.591Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer0.org1.example.com:7051, url:grpcs://peer0.org1.example.com:7051, connected:false, connectAttempted:true
2020-12-18T12:15:49.591Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer0.org1.example.com:7051 url:grpcs://peer0.org1.example.com:7051 timeout:3000
2020-12-18T12:15:49.591Z - error: [DiscoveryService]: _buildPeer[mychannel] - Unable to connect to the discovered peer peer0.org1.example.com:7051 due to Error: Failed to connect before the deadline on Endorser- name: peer0.org1.example.com:7051, url:grpcs://peer0.org1.example.com:7051, connected:false, connectAttempted:true

It seems to look for grpcs://peer0.org1.example.com:7051 and not the ip I put in the configuration file.

Is there any more configuration file to retrieve or any modification to do in the test-network files in order to call the network not from localhost ?

Upvotes: 1

Views: 615

Answers (1)

Damounet
Damounet

Reputation: 120

I did find the trick !

Just add to your /etc/hosts the dns used by fabric sample like so:

1.2.3.4   orderer.example.com
1.2.3.4   peer0.org1.example.com
1.2.3.4   peer0.org2.example.com
1.2.3.4   ca.example.com

And voila !

Upvotes: 1

Related Questions