Search code examples
dockerhyperledger-fabricdocker-swarmpeerchaincode

Hyperledger Fabric - Multi Host Network - Docker Swarm


I installed Hyperledger Fabric and I'm trying to distribute my chaincode on two peers on two different hosts (exactly two Ubuntu 16.04 machines) via docker swarm. I found a link explaining how to do this but I can't get it to work (https://medium.com/@wahabjawed/hyperledger-fabric-on-multiple-hosts-a33b08ef24f). I specifically put the Build-Multi-Host-Network folder in the fabric-samples folder, and in a terminal run the command ./bmhn.sh but it gives me the following error:

FATA 001 Missing channelID, please specify it with '-channelID'
Failed to generate orderer genesis block ...

Can anyone tell me how to solve please? I also specified the -channelID in the ./bmhn.sh code on the error line but nothing. Thanks.


Solution

  • This tutorial runs on the old version of Hyperledger Fabric. You can use Fabric v1.4.1. Use this command to download binary & docker images.

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

    After that, when starting component of network (peer, orderer,..) you must specify version of docker image. Example to run CA, you use image hyperledger/fabric-ca:1.4.1:

    docker run --rm -it --network="my-net" --name ca.example.com -p 7054:7054 -e FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server -e FABRIC_CA_SERVER_CA_NAME=ca.example.com -e FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem -e FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/{put the name of secret key} -v $(pwd)/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config -e CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=hyp-net hyperledger/fabric-ca:1.4.1 sh -c 'fabric-ca-server start -b admin:adminpw -d'
    

    Your network return error because: In the newer version, you must specify the name of the system channel when generating the genesis block config. Example:

    configtxgen -profile TwoOrgsOrdererGenesis -channelID system-channel -outputBlock ./system-genesis-block/genesis.block