shamon shamsudeen
shamon shamsudeen

Reputation: 5848

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
 ......

Upvotes: 6

Views: 1343

Answers (3)

shamon shamsudeen
shamon shamsudeen

Reputation: 5848

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
 

Upvotes: 0

Jani Lintunen
Jani Lintunen

Reputation: 9

I had this exactly same issue and oh boy I had trouble to find the cause.

So, what ended up happening for me was that the external builder wasn't executed and then the peer tried to install the chaincode by the traditional way where it generates the Dockerfile and at that part of the execution it gives the error because "external" type is not one of the default platforms (java, golang, node).

Then I started testing stuff and eventually went through core.yaml line by line to try to figure out what could cause it to skip my external builder. For me the cause was that the externalBuilders definition in core.yaml was indented too much to right so it wasn't under chaincode definition anymore. And for that reason of course the peer was setup wrongly in a way that it didn't even try to use the external builder.

So, make sure your yaml files are formatted properly.

Upvotes: 0

lindluni
lindluni

Reputation: 505

You cant override the chaincode.externalbuilders with environment properties. It is a complex object not a set of individual properties. Not all properties in core.yaml can be overriden with environment variables.

Upvotes: 2

Related Questions