1

When I try to run a containerized version of Caliper I always get an error message stating that the attempt to connect to the orderer failed unlike happens if I try to run a non containerized version of Caliper in the host machine where Hyperledger Fabric is running. I suspect the problem is somehow related to the containerized version keeping trying to connect to localhost instead of the actual addresses of network nodes as you can see in the following error message:

caliper | 2021-01-07T00:46:02.077Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: orderer1-org0:7050, url:grpcs://localhost:7050, connected:false, connectAttempted:true

I made sure that the property caliper-fabric-gateway-localhost is set to false by creating a projec-level configuration file named caliper.yaml whose content is printed below:

caliper:
  fabric:
    gateway:
      localHost: false
      enabled: true

Another thing that caught my attention was that the node peer1-org1 of my HL Fabric network is reachable when I run the containerized version of Caliper as shown by the following log message:

021-01-07 00:45:59.059 UTC [comm.grpc.server] 1 -> INFO 09f unary call completed grpc.service=discovery.Discovery grpc.method=Discover grpc.peer_address=172.24.0.19:35732 grpc.peer_subject="CN=fabric-common" grpc.code=OK grpc.call_duration=872.721µs

The bottom line is that the current configuration is working for a non containerized version of docker, hence, it is set up correctly I guess but for some odd reason I am not aware when I try to run Caliper inside Docker it keeps trying to connect to localhost even though a successful connection is shown to one of the network nodes. Any ideas on how to make it work or at least force Caliper to use the actual ip addresses?


As requested follows the dump of some configuration files:

docker-compose.yaml

version: '3.5'

networks:
  default:
    external:
      name: net_test

services:
    caliper:
        container_name: caliper
        image: hyperledger/caliper:0.4.2
        command: launch manager --caliper-flow-only-test
        environment:
        - CALIPER_BIND_SUT=fabric:2.2
        - CALIPER_BENCHCONFIG=benchmarks/myAssetBenchmark.yaml
        - CALIPER_NETWORKCONFIG=networks/config.yaml
        volumes:
        - ../../../code/caliper-workspace:/hyperledger/caliper/workspace
        - ../../../bcdm-network:/bcdm-network

networkConfig.yaml

name: Caliper test
version: "2.0.0"

caliper:
  blockchain: fabric


channels:
  - channelName: mychannel
    contracts:
    - id: datamarket

organizations:
  - mspid: org1MSP
    identities:
      certificates:
      - name: 'User1'
        clientPrivateKey:
          path: '/bcdm-network/organizations/peerOrganizations/org1/users/User1@org1/msp/keystore/priv_sk'
        clientSignedCert:
          path: '/bcdm-network/organizations/peerOrganizations/org1/users/User1@org1/msp/signcerts/cert.pem'
    connectionProfile:
      path: '/bcdm-network/organizations/peerOrganizations/org1/connection-org1.json'
      discover: true
utxeee
  • 953
  • 1
  • 12
  • 24
  • caliper uses the fabric node sdk gateway implementation to connect to the fabric and the default chosen for the localHost value in both caliper and the node-sdk are true. So you have to ensure it is explicitly set to false. maybe in your containerized environment it's not picking up your file ? Can you confirm it is using the real hostnames in the non-containerized environment – david_k Jan 07 '21 at 10:58
  • I believe the containerized environment is indeed picking up the configuration file because I changed the property named enabled to false and a different error was printed. The non-containerized env is not using the real hostnames but instead the localhost address for every network node. – utxeee Jan 07 '21 at 16:56
  • what version have you specified in your network config file ? Also which version of caliper and what version of sut have you bound to ? – david_k Jan 07 '21 at 22:12
  • @david_k, I have edited the question with the dump of some configuration files. Hope it helps! – utxeee Jan 07 '21 at 23:13
  • could you try changing `localHost` to `localhost` ? If that's the case and it works then we need to fix the docs – david_k Jan 08 '21 at 09:37
  • Solved! Thank you for your help ;) – utxeee Jan 08 '21 at 17:35
  • Thanks for getting back, looks like its a documentation issue. Will raise an issue to get that fixed. – david_k Jan 08 '21 at 18:37

0 Answers0