hyperledger / caliper

A blockchain benchmark framework to measure performance of multiple blockchain solutions https://wiki.hyperledger.org/display/caliper
https://hyperledger.github.io/caliper/
Apache License 2.0
649 stars 402 forks source link

Issue when use docker #1149

Closed SamYuan1990 closed 3 years ago

SamYuan1990 commented 3 years ago

I am confuse for docker container for caliper does it missing any thing?

Context

  1. I am able to use below commands to run caliper to test my fabric test network.
    npx caliper launch manager --caliper-workspace caliper-workspace --caliper-networkconfig networkConfig.yaml --caliper-benchconfig myAssetBenchmark.yaml --caliper-flow-only-test --caliper-fabric-gateway-enabled

    but when move to docker it shows Unexpected error during benchmark execution: Error: Unable to detect required Fabric binding packages

    
    docker run -v $PWD:/hyperledger/caliper/workspace --network host \
    --name caliper hyperledger/caliper:0.4.2 launch manager --caliper-workspace caliper-workspace --caliper-networkconfig networkConfig.yaml --caliper-benchconfig myAssetBenchmark.yaml --caliper-flow-only-test --caliper-fabric-gateway-enabled

2021.07.17-12:11:06.864 info [caliper] [cli-launch-manager] Set workspace path: /hyperledger/caliper/workspace/caliper-workspace 2021.07.17-12:11:06.866 info [caliper] [cli-launch-manager] Set benchmark configuration path: /hyperledger/caliper/workspace/caliper-workspace/myAssetBenchmark.yaml 2021.07.17-12:11:06.867 info [caliper] [cli-launch-manager] Set network configuration path: /hyperledger/caliper/workspace/caliper-workspace/networkConfig.yaml 2021.07.17-12:11:06.867 info [caliper] [cli-launch-manager] Set SUT type: fabric 2021.07.17-12:11:06.911 info [caliper] [benchmark-validator] No observer specified, will default to none 2021.07.17-12:11:06.911 info [caliper] [caliper-engine] Starting benchmark flow 2021.07.17-12:11:06.941 error [caliper] [cli-launch-manager] Unexpected error during benchmark execution: Error: Unable to detect required Fabric binding packages Usage: caliper launch manager --caliper-bind-sut fabric:1.4 [other options]


## Expected Behavior
I hope it can be run caliper to test fabric network as well.

## Actual Behavior
error appears and shows up **Unexpected error during benchmark execution: Error: Unable to detect required Fabric binding packages**

## Possible Fix
<!--- Not obligatory, but suggest a fix or reason for the bug -->

https://github.com/hyperledger/caliper/blob/master/packages/caliper-publish/caliper.Dockerfile#L33
maybe we forgot install fabric caliper related package in docker file?

## Steps to Reproduce
1. set up a fabric network
2. using caliper to test it
3. using same command as docker container start cmd and mount pwd to caliper.

## Existing issues
<!-- Have you searched for any existing issues or are their any similar issues that you've found? -->
- [ ] [Stack Overflow issues](http://stackoverflow.com/tags/hyperledger-caliper)
- [ ] [GitHub Issues](https://github.com/hyperledger/caliper/issues)
- [ ] [Rocket Chat history](https://chat.hyperledger.org/channel/caliper)

<!-- please include any links to issues here -->

## Context
<!--- How has this bug affected you? What were you trying to accomplish? -->

## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
* Version used:
* Environment name and version (e.g. Chrome 39, node.js 5.4):
* Operating System and version (desktop or mobile):
* Link to your project:
SamYuan1990 commented 3 years ago

btw, I am use fabric 2.2

SamYuan1990 commented 3 years ago
npx caliper bind --caliper-bind-sut fabric:2.2

I am not sure if we should add this into docker file to make caliper docker container able to supports https://hyperledger.github.io/caliper/v0.4.2/fabric-tutorial/tutorials-fabric-existing/ ??

aklenik commented 3 years ago

@SamYuan1990 We can't just add that to the Dockerfile, not everyone is binding to the same connector/version. You need to include the --caliper-bind-sut fabric:2.2 parameter when you execute the launch manager command, and the manager will bind to that connector automatically.

If you intend to use only the Fabric 2.2 binding during your measurements, you could build your own custom image, that runs the binding command during building the image, so you don't have to run it every time you spin up a container.

SamYuan1990 commented 3 years ago

will try and feed back later. --caliper-bind-sut fabric:2.2 able to support test with a pre builded fabric network right?

aklenik commented 3 years ago

Yes, for Fabric v2, you either have to initialize your network (channels, chaincodes) yourself, or use a v1 binding to perform an init-only run, then v2 binding to perform a test-only run.

SamYuan1990 commented 3 years ago

Sorry for reply late, verified. thx.

SamYuan1990 commented 2 years ago
docker run -e CALIPER_BIND_SUT=fabric:2.2 -e CALIPER_BENCHCONFIG=/caliper/benchmarks/assetBenchmark.yaml -e CALIPER_NETWORKCONFIG=/caliper/networks/brix-config.yaml -v $PWD:/caliper hyperledger/caliper:0.4.2 launch manager

share a script above as information sharing for the docker version usage.