Why containerized version of HL Caliper is always trying to connect to localhost?

248 Views Asked by At

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
0

There are 0 best solutions below