用fabric-sample做fabric客户端cicd的fabric网络环境

    技术2022-07-10  100

    文章目录

    为什么怎么做下载安装构建使用 结果

    用fabric-sample做fabric客户端ci/cd的fabric网络环境

    为什么

    在开发fabric客户端程序的时候,我们可能需要一个fabric网络来进行测试。 当然我们可以搭建复杂的网络来满足业务需求。 但是本文将提供一种简介的环境构建方式,来快速在ci/cd环境上进行构建。

    怎么做

    参考fabric官方文档,我们可以将脚本分为一下几个部分

    下载安装

    curl -vsS https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash

    构建

    cd ./fabric-samples/test-network echo y | ./network.sh up createChannel echo y | ./network.sh deployCC # use it

    这里默认安装的是fabric car那个chaincode

    使用

    建议大家配置/etc/hosts, 如下来处理tls的问题

    127.0.0.1 peer0.org2.example.com 127.0.0.1 orderer.example.com 127.0.0.1 peer0.org1.example.com

    结果

    大家可以参考: https://github.com/guoger/stupid/pull/33 https://github.com/guoger/stupid/blob/master/integration-test.sh

    Processed: 0.010, SQL: 9