Search code examples
hyperledger-fabrichyperledgerhyperledger-chaincode

Hyperledger fabric 2.0 -chaincode as external service:Unknown chaincodeType: EXTERNAL


I am trying to set up the chain code as an external service as is specified in the official doc

First thing is to set up the externalBuilder variable

chaincode:
  externalBuilders:
  - name: my-golang-builder
    path: /builders/golang

In my peer configuration, I have added the following to override this

- CORE_CHAINCODE_EXTERNALBUILDERS_PATH=/var/hyperledger/builderpath
- CORE_CHAINCODE_EXTERNALBUILDERS_NAME=externalbuilder

But when I run the peer install lifecycle i am getting

docker build failed: platform builder failed: Failed to generate a Dockerfile: Unknown chaincodeType: EXTERNAL

Still, it tries to install as the old way seems like my external builder path is not detecting

Can anyone know the solution

UPDATE

peer.yaml

peer1.base.right:
    container_name: peer1.right.base
    extends:
      file: base.yaml
      service: peer-base
    environment:
      - CORE_PEER_ID=peer1.right.base
      - CORE_PEER_ADDRESS=peer1.right.base:9051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:9051
      - CORE_PEER_CHAINCODEADDRESS=peer1.right.base:9052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:9052
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.right.base:10051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.right.base:9051
      - CORE_PEER_LOCALMSPID=RightOrgMSP
    volumes:
        - /var/run/:/host/var/run/
        - ./crypto-config/peerOrganizations/base.right/peers/peer1.base.right/msp:/etc/hyperledger/fabric/msp
        - ./crypto-config/peerOrganizations/base.right/peers/peer1.base.right/tls:/etc/hyperledger/fabric/tls
        - ./chaincode/external_builder:/builders/external
        - ./fabric-config:/etc/hyperledger/fabric
        - peer1.base.right:/var/hyperledger/production
    ports:
      - 9051:9051
    networks:

- ./fabric-config:/etc/hyperledger/fabric is the path of core.yaml

core.yaml

 ......
 externalBuilders:
              - name: external-builder
                path: /builders/external
                environmentWhitelist:
                   - GOPROXY
 ......

Solution

  • Resolved the issue , i actually put the wrong path for the core.yaml file

    The actual should look like this. Edit your docker file and modify the peer docker volume section according to this

     - ./config/core.yaml:/etc/hyperledger/fabric/core.yaml