hyperledger / bevel-operator-fabric

Hyperledger Fabric Kubernetes operator - Hyperledger Fabric operator for Kubernetes (v2.3, v2.4 and v2.5, soon 3.0)
https://hyperledger.github.io/bevel-operator-fabric/
Apache License 2.0
270 stars 91 forks source link

Chaincode as an external service #62

Closed snitrama closed 2 years ago

snitrama commented 2 years ago

Hi, thanks for the amazing work done in this project. Does the operator supports chaincode as an external service?

I am having troubles understanding how we could customize the existing instructions on how to do it. Does it requires configuring an external builder with the scripts presented in the HLF docs? Is there any example/docs on how to do this?

dviejokfs commented 2 years ago

Hi @snitrama

External chaincode as a service will be supported in 1.6.0.

This PR #56 it's implementing this feature.

snitrama commented 2 years ago

How far away is it from completion and how can I contribute to it?

dviejokfs commented 2 years ago

25th of March maximum, I need to fix the tests which are failing, if you want to can take a look at that.

Though you can start using it by checking out that branch and following the instructions in the README.md which are updated to use the chaincode as an external service.

https://github.com/kfsoftware/hlf-operator/tree/feature/chaincode-as-a-service-crd

snitrama commented 2 years ago

While following the new instructions, executing:

kubectl hlf chaincode install --path=./asset-transfer-basic-external.tgz \
 --config=org1.yaml --language=golang --label=$CHAINCODE_LABEL --user=admin --peer=org1-peer0.default

Gives the following error:

Error: Transaction processing for endorser [172.27.0.2:32208]: Chaincode status Code: (500) UNKNOWN. Description: failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker build is disabled

Any idea on what may be causing this, or how can I debug it?

Note: Installing non external chaincode works without issues:

kubectl hlf chaincode install --path=./fixtures/chaincodes/fabcar/go \
     --config=org1.yaml --language=golang --label=fabcar --user=admin --peer=org1-peer0.default
dviejokfs commented 2 years ago

Hi @snitrama

I think that problem is related to #63.

Will create 1.6.0-beta12 which should fix this issue.

nkaramolegos commented 2 years ago

The exact opposite here for version 1.6.4

srinathln7 commented 2 years ago

Hi @snitrama @nkaramolegos By any chance, have you figured out how to solve the following error?

Error: Transaction processing for endorser [172.27.0.2:32208]: Chaincode status Code: (500) UNKNOWN. Description: failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker build is disabled

Both internal and external chaincode installation poses the above problem. I use peer v2.4.4 from hyperledger fabric and hlf-operator v1.6.1 in KIND. Thank you.

nkaramolegos commented 2 years ago

Hi @srinathLN7 take a look from this message. I had never tried it but it may work. I had not time to search for the solution so I used CCAAS

srinathln7 commented 2 years ago

@nkaramolegos Thank you for your response. Even am trying it as CAAS but it doesn't work. Could you please tell me how you went about it?

nkaramolegos commented 2 years ago

@snitrama I followed the instructions of README. Note that you have to use a public (or private but it is a bit tricky) repository (like docker hub) to push your image or you kind local repository (that's what I use). Then in the kubectl hlf externalchaincode sync command you add your repository to--image argument.

For the kind local repository. I do the following:

  1. Create a kind cluster using this script in order to create a kind local registry
  2. Build your chaincode image as described here docker build ...
  3. As soon as you have the image built (see docker images) then follow the using the registry steps.
  4. Install chaincode as described in README (i.e tar cfz ..., kubectl hlf chaincode install) and then in the kubectl hlf externalchaincode sync command use your kind registry to image argument (i.e localhost:5001/your-chaincode-image-name:latest)

@dviejokfs it may be good idea to add these instructions in the README

srinathln7 commented 2 years ago

@nkaramolegos I have the chaincode image in my local. Is it possible to sync it or it is must to upload the image to the kind registry?

nkaramolegos commented 2 years ago

@nkaramolegos I have the chaincode image in my local. Is it possible to sync it or it is must to upload the image to the kind registry?

Yes you have to push it to local kind registry.

srinathln7 commented 2 years ago

@nkaramolegos Ha, my project requirement doesn't allow it. Is there no other way around it? Both my local installations as in the README.md with the local directory k hlf chaincode install --path=./chaincode --config=network-config.yaml --language=$CC_LANG --label=$CC_NAME --user=admin --peer=org1-peer0.fabric or using the external.tgz like k hlf chaincode install --path=./chaincode/${CC_NAME}-external.tgz --config=network-config.yaml --language=$CC_LANG --label=$CC_NAME --user=admin --peer=org1-peer0.fabric both fails with error docker build disabled.

srinathln7 commented 2 years ago

@nkaramolegos And finally managed to solve it. Please find my explanation here just in case you are interested - https://stackoverflow.com/questions/73100516/docker-build-is-disabled-error-when-installing-my-chaincode-on-hyperledger-fabri/73153204#73153204

Thank you for your help.

srinathln7 commented 2 years ago

@snitrama I followed the instructions of README. Note that you have to use a public (or private but it is a bit tricky) repository (like docker hub) to push your image or you kind local repository (that's what I use). Then in the kubectl hlf externalchaincode sync command you add your repository to--image argument.

For the kind local repository. I do the following:

  1. Create a kind cluster using this script in order to create a kind local registry
  2. Build your chaincode image as described here docker build ...
  3. As soon as you have the image built (see docker images) then follow the using the registry steps.
  4. Install chaincode as described in README (i.e tar cfz ..., kubectl hlf chaincode install) and then in the kubectl hlf externalchaincode sync command use your kind registry to image argument (i.e localhost:5001/your-chaincode-image-name:latest)

@dviejokfs it may be good idea to add these instructions in the README

Thanks, this was very helpful.

dviejokfs commented 2 years ago

4. Install chaincode as described in README (i.e tar cfz ..., kubectl hlf chaincode install) and then in the kubectl hlf externalchaincode sync command use your kind registry to image argument (i.e localhost:5001/your-chaincode-image-name:latest)

Yeah, this will be added to the documentation, this is very useful 👍