fabric二进制工具tips

fabric二进制工具

我们在跑demo的时候,会用到fabric的二进制工具,比如:

  • configtxgen
  • configtxlator
  • cryptogen
    ... 等等

这些二进制工具在官方教程或者网上一些前辈留下的资料存在被强的可能

如:

  • 官方描述:
curl -sSL http://bit.ly/2ysbOFE | bash -s 1.2.0
  • 百度出来的前辈资料:
curl -sSL https://goo.gl/eYdRbX | bash

后来有前辈修传到了公有云上:

curl -sSL http://oui195df4.bkt.clouddn.com/download-bin.sh | bash

其实,我们大可不必这么麻烦,在官方源码中已经告诉我们如何生成这些文件

首先从github上面获取fabric源码

git clone https://github.com/hyperledger/fabric.git

然后直接在该目录下执行:

make release

等运行完就可以在release目录下就直接生成出来了,是不是异常简单,比墙外或者云上下载要简单得多。
编译完成之后,记得将该目录加入到系统环境变量PATH中去,避免在脚本运行的时候找不到这些二进制工具。

那为什么我们执行make release就可以生成了呢,那是因为在Makefile文件中,已经给我们标注出来了,当参数是release时候,会生成自身平台对应的二进制工具。

release - builds release packages for the host platform

这里除了release还有很多参数可以传入,如:

#- all (default) - builds all targets and runs all non-integration tests/checks
#- checks - runs all non-integration tests/checks
#- desk-check - runs linters and verify to test changed packages
#- configtxgen - builds a native configtxgen binary
#- configtxlator - builds a native configtxlator binary
#- cryptogen  -  builds a native cryptogen binary
#- idemixgen  -  builds a native idemixgen binary
#- peer - builds a native fabric peer binary
#- orderer - builds a native fabric orderer binary
#- release - builds release packages for the host platform
#- release-all - builds release packages for all target platforms
#- unit-test - runs the go-test based unit tests
#- verify - runs unit tests for only the changed package tree
#- profile - runs unit tests for all packages in coverprofile mode (slow)
#- test-cmd - generates a "go test" string suitable for manual customization
#- gotools - installs go tools like golint
#- linter - runs all code checks
#- check-deps - check for vendored dependencies that are no longer used
#- license - checks go source files for Apache license header
#- native - ensures all native binaries are available
#- docker[-clean] - ensures all docker images are available[/cleaned]
#- docker-list - generates a list of docker images that 'make docker' produces
#- peer-docker[-clean] - ensures the peer container is available[/cleaned]
#- orderer-docker[-clean] - ensures the orderer container is available[/cleaned]
#- tools-docker[-clean] - ensures the tools container is available[/cleaned]
#- protos - generate all protobuf artifacts based on .proto files
#- clean - cleans the build area
#- clean-all - superset of 'clean' that also removes persistent state
#- dist-clean - clean release packages for all target platforms
#- unit-test-clean - cleans unit test state (particularly from docker)
#- basic-checks - performs basic checks like license, spelling and linter
#- enable_ci_only_tests - triggers unit-tests in downstream jobs. Applicable only for CI not to use in the local machine.
#- docker-thirdparty - pulls thirdparty images (kafka,zookeeper,couchdb)
#- docker-tag-latest - re-tags the images made by 'make docker' with the :latest tag
#- help-docs - generate the command reference docs

熟悉make的小伙伴肯定对这些不会陌生了,对于不熟悉的只需要记住make release就可以解决二进制不用墙的问题就好了。

谢谢

你可能感兴趣的:(fabric二进制工具tips)