I've tried to build hyperledger fabric2.0 on multiple hosts, following this passage:https://medium.com/#kctheservant/multi-host-setup-with-raft-based-ordering-service-29730788b171.
But when I execute this step to create channel genesis block:
docker exec cli peer channel create -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/channel.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
It said that "Error: got unexpected status: SERVICE_UNAVAILABLE -- no Raft leader".
(I can't paste image due to my reputation, sorry for that).
Would there be any cause or solution? Thank you for your attention.
————————————————————————————————————————————
That's the result I run
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
42a6033c4faf hyperledger/fabric-tools:2.0.0 "/bin/bash" 13 days ago Up 13 days cli
99574106c337 hyperledger/fabric-orderer:2.0.0 "orderer" 13 days ago Up 13 days 0.0.0.0:8050->7050/tcp orderer5.example.com
01117e5fc775 hyperledger/fabric-peer:2.0.0 "peer node start" 13 days ago Up 13 days 0.0.0.0:7051->7051/tcp peer0.org1.example.com
c936d551210c hyperledger/fabric-orderer:2.0.0 "orderer" 13 days ago Up 13 days 0.0.0.0:7050->7050/tcp orderer.example.com
Here are the yamls:
1.base/peer-base.yaml
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: '2'
services:
peer-base:
image: hyperledger/fabric-peer:$IMAGE_TAG
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
# the following setting starts chaincode containers on the same
# bridge network as the peers
# https://docs.docker.com/compose/networking/
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=first-network
- FABRIC_LOGGING_SPEC=INFO
#- FABRIC_LOGGING_SPEC=DEBUG
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_GOSSIP_USELEADERELECTION=true
- CORE_PEER_GOSSIP_ORGLEADER=false
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
orderer-base:
image: hyperledger/fabric-orderer:$IMAGE_TAG
environment:
- FABRIC_LOGGING_SPEC=INFO
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
# enabled TLS
- ORDERER_GENERAL_TLS_ENABLED=true
- ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
- ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
- ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
- ORDERER_KAFKA_TOPIC_REPLICATIONFACTOR=1
- ORDERER_KAFKA_VERBOSE=true
- ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt
- ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key
- ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: orderer
2.base/docker-compose-base.yaml
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: '2'
services:
orderer.example.com:
container_name: orderer.example.com
extends:
file: peer-base.yaml
service: orderer-base
volumes:
- ../channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ../crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
- ../crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
- orderer.example.com:/var/hyperledger/production/orderer
ports:
- 7050:7050
peer0.org1.example.com:
container_name: peer0.org1.example.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer0.org1.example.com
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
- CORE_PEER_LISTENADDRESS=0.0.0.0:7051
- CORE_PEER_CHAINCODEADDRESS=peer0.org1.example.com:7052
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org1.example.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls
- peer0.org1.example.com:/var/hyperledger/production
ports:
- 7051:7051
peer1.org1.example.com:
container_name: peer1.org1.example.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer1.org1.example.com
- CORE_PEER_ADDRESS=peer1.org1.example.com:7051
- CORE_PEER_LISTENADDRESS=0.0.0.0:7051
- CORE_PEER_CHAINCODEADDRESS=peer1.org1.example.com:7052
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/tls
- peer1.org1.example.com:/var/hyperledger/production
ports:
- 7051:7051
peer0.org2.example.com:
container_name: peer0.org2.example.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer0.org2.example.com
- CORE_PEER_ADDRESS=peer0.org2.example.com:7051
- CORE_PEER_LISTENADDRESS=0.0.0.0:7051
- CORE_PEER_CHAINCODEADDRESS=peer0.org2.example.com:7052
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org2.example.com:7051
- CORE_PEER_LOCALMSPID=Org2MSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls
- peer0.org2.example.com:/var/hyperledger/production
ports:
- 7051:7051
peer1.org2.example.com:
container_name: peer1.org2.example.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer1.org2.example.com
- CORE_PEER_ADDRESS=peer1.org2.example.com:7051
- CORE_PEER_LISTENADDRESS=0.0.0.0:7051
- CORE_PEER_CHAINCODEADDRESS=peer1.org2.example.com:7052
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:7051
- CORE_PEER_LOCALMSPID=Org2MSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls:/etc/hyperledger/fabric/tls
- peer1.org2.example.com:/var/hyperledger/production
ports:
- 7051:7051
3.host1.yaml
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: '2'
volumes:
orderer.example.com:
orderer5.example.com:
peer0.org1.example.com:
networks:
byfn:
external:
name: first-network
services:
orderer.example.com:
extends:
file: base/docker-compose-base.yaml
service: orderer.example.com
container_name: orderer.example.com
networks:
- byfn
orderer5.example.com:
extends:
file: base/peer-base.yaml
service: orderer-base
container_name: orderer5.example.com
networks:
- byfn
volumes:
- ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/msp:/var/hyperledger/orderer/msp
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/:/var/hyperledger/orderer/tls
- orderer5.example.com:/var/hyperledger/production/orderer
ports:
- 8050:7050
peer0.org1.example.com:
container_name: peer0.org1.example.com
extends:
file: base/docker-compose-base.yaml
service: peer0.org1.example.com
networks:
- byfn
cli:
container_name: cli
image: hyperledger/fabric-tools:$IMAGE_TAG
tty: true
stdin_open: true
environment:
- SYS_CHANNEL=$SYS_CHANNEL
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
#- FABRIC_LOGGING_SPEC=DEBUG
- FABRIC_LOGGING_SPEC=INFO
- CORE_PEER_ID=cli
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: /bin/bash
volumes:
- /var/run/:/host/var/run/
- ./../chaincode/:/opt/gopath/src/github.com/chaincode
- ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
depends_on:
- orderer.example.com
- peer0.org1.example.com
networks:
- byfn
4.host2.yaml
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: '2'
volumes:
orderer2.example.com:
peer1.org1.example.com:
networks:
byfn:
external:
name: first-network
services:
orderer2.example.com:
extends:
file: base/peer-base.yaml
service: orderer-base
container_name: orderer2.example.com
networks:
- byfn
volumes:
- ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/msp:/var/hyperledger/orderer/msp
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/:/var/hyperledger/orderer/tls
- orderer2.example.com:/var/hyperledger/production/orderer
ports:
- 7050:7050
peer1.org1.example.com:
container_name: peer1.org1.example.com
extends:
file: base/docker-compose-base.yaml
service: peer1.org1.example.com
networks:
- byfn
5.host3.yaml
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: '2'
volumes:
orderer3.example.com:
peer0.org2.example.com:
networks:
byfn:
external:
name: first-network
services:
orderer3.example.com:
extends:
file: base/peer-base.yaml
service: orderer-base
container_name: orderer3.example.com
networks:
- byfn
volumes:
- ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/msp:/var/hyperledger/orderer/msp
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/:/var/hyperledger/orderer/tls
- orderer3.example.com:/var/hyperledger/production/orderer
ports:
- 7050:7050
peer0.org2.example.com:
container_name: peer0.org2.example.com
extends:
file: base/docker-compose-base.yaml
service: peer0.org2.example.com
networks:
- byfn
6.host4.yaml
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: '2'
volumes:
orderer4.example.com:
peer1.org2.example.com:
networks:
byfn:
external:
name: first-network
services:
orderer4.example.com:
extends:
file: base/peer-base.yaml
service: orderer-base
container_name: orderer4.example.com
networks:
- byfn
volumes:
- ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/msp:/var/hyperledger/orderer/msp
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/:/var/hyperledger/orderer/tls
- orderer4.example.com:/var/hyperledger/production/orderer
ports:
- 7050:7050
peer1.org2.example.com:
container_name: peer1.org2.example.com
extends:
file: base/docker-compose-base.yaml
service: peer1.org2.example.com
networks:
- byfn
My setup consists of three hosts each with one orderer and one peer with its accompanying CouchDB and client, for a total of at least four Docker containers on each host (one of them has an additional CA), deployed onto a Docker swarm.
When I encountered this problem in my setup, it was apparently due to ports not being open in my Docker swarm. This guide helped me in solving my problems. I hope it helps you too!
This error can occur on ubuntu 18. I fixed it by using ubuntu 16 on my VM
Sometimes it happens when you do things too fast: the Raft leader needs time to be elected. In my case, I employed a retry mechanism, and it would work after a few retries and sleeps.
Related
i need help i am using HLF 2.0 and developing fabric network which contain 2-ORG(1 peer each) ,raft(1 orderer) ,ca for both ORG (but till now there is only 1 ca-ORG1),2 couchdb container ,and last cli container container.
The network is up successfully ,but when i run the cmd to create channel(having name "onechannel") it show error. you can see here.Even All the crypto materials and certificates exists .And the code/script which i am running for creating channel is mentioned below
some Environmental variables & cmd for creating channel
enter code echo "########### Creating Channel One as Org1 Peer ##################"
export FABRIC_CFG_PATH=${PWD}
export CHANNEL_NAME=onecannel
export CORE_PEER_TLS_ENABLED=true
export ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/cryptoconfig/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
export PEER0_OGR1_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto-/config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
export PEER0_OGR2_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/cryptoconfig/peerOrganizations /org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_ADDRESS=peer0.org1.example.com:7051" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto-config/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp" -e "CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_OGR1_CA" cli peer channel create -o localhost:7050 -c $CHANNEL_NAME --ordererTLSHostnameOverride orderer.example.com -f ./channel-artifacts/$CHANNEL_NAME.tx --outputBlock ./channel-artifacts/$CHANNEL_ONE_NAME.block --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA
NoW The docker compose is here which i am using : the docker compose file is runing up successfully . i thing the error may be in PATH OR RELATIVE_PATH
version: "2"
networks:
test:
services:
ca_org1:
image: hyperledger/fabric-ca
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=org1.example.com
- FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/ca-server-config/ca.org1.example.com-cert.pem
- FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/ca-server-config/priv_sk
- FABRIC_CA_SERVER_TLS_ENABLED=true
- FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-tls/tlsca.org1.example.com-cert.pem
- FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-tls/priv_sk
- FABRIC_CA_SERVER_PORT=7054
ports:
- "7054:7054"
command: sh -c 'fabric-ca-server start -b admin:adminpw -d'
volumes:
- ./crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
- ./crypto-config/peerOrganizations/org1.example.com/tlsca/:/etc/hyperledger/fabric-ca-server-tls
container_name: ca_org1
networks:
- test
orderer.example.com:
container_name: orderer.example.com
image: hyperledger/fabric-orderer
environment:
- ORDERER_GENERAL_LOGLEVEL=debug
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
# TLS ENABLAE
- ORDERER_GENERAL_TLS_ENABLED=true
- ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
- ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
- ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
- ORDERER_KAFKA_TOPIC_REPLICATIONFACTOR=1
- ORDERER_KAFKA_VERBOSE=true
- ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt
- ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key
- ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: orderer
volumes:
- ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
ports:
- 7050:7050
networks:
- test
couchdb0:
container_name: couchdb0
image: hyperledger/fabric-couchdb
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
- COUCHDB_USER=
- COUCHDB_PASSWORD=
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
# for example map it to utilize Fauxton User Interface in dev environments.
ports:
- "5984:5984"
networks:
- test
peer0.org1.example.com:
container_name: peer0.org1.example.com
image: hyperledger/fabric-peer
environment:
- CORE_PEER_ID=peer0.org1.example.com
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
- CORE_PEER_LISTENADDRESS=0.0.0.0:7051
- CORE_PEER_CHAINCODEADDRESS=peer0.org1.example.com:7052
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:8051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_byfn
- FABRIC_LOGGING_SPEC=INFO
- FABRIC_LOGGING_SPEC=DEBUG
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_GOSSIP_USELEADERELECTION=true
- CORE_PEER_GOSSIP_ORGLEADER=false
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
- CORE_CHAINCODE_EXECUTETIMEOUT=300s
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp
- ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls
ports:
- 7051:7051
depends_on:
- couchdb0
networks:
- test
couchdb1:
container_name: couchdb1
image: hyperledger/fabric-couchdb
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
- COUCHDB_USER=
- COUCHDB_PASSWORD=
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
# for example map it to utilize Fauxton User Interface in dev environments.
ports:
- "6984:5984"
networks:
- test
peer0.org2.example.com:
container_name: peer0.org2.example.com
image: hyperledger/fabric-peer
environment:
- CORE_PEER_ID=peer0.org2.example.com
- CORE_PEER_ADDRESS=peer0.org2.example.com:9051
- CORE_PEER_LISTENADDRESS=0.0.0.0:9051
- CORE_PEER_CHAINCODEADDRESS=peer0.org2.example.com:9052
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:9052
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:9051
#- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:10051
- CORE_PEER_LOCALMSPID=Org2MSP
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
# the following setting starts chaincode containers on the same
# bridge network as the peers
# https://docs.docker.com/compose/networking/
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_byfn
- FABRIC_LOGGING_SPEC=INFO
#- FABRIC_LOGGING_SPEC=DEBUG
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_GOSSIP_USELEADERELECTION=true
- CORE_PEER_GOSSIP_ORGLEADER=false
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
# Allow more time for chaincode container to build on install.
- CORE_CHAINCODE_EXECUTETIMEOUT=300s
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp:/etc/hyperledger/fabric/msp
- ./crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls
ports:
- 8051:8051
depends_on:
- couchdb1
networks:
- test
cli:
container_name: cli
image: hyperledger/fabric-tools
tty: true
stdin_open: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
#- FABRIC_LOGGING_SPEC=DEBUG
- FABRIC_LOGGING_SPEC=INFO
- CORE_PEER_ID=cli
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: /bin/bash
volumes:
- /var/run/:/host/var/run/
- ./chaincode/:/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode
- ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
depends_on:
- orderer.example.com
- peer0.org1.example.com
- peer0.org2.example.com
networks:
- test
code here
i hope you expert can help me to get out of this problem and provide the good suggestions and solution . Thank you in advance .
The problem resides between the crypto-material folder and CLI service definition
In your docker-compose file under cli there is a volume between a folder named crypto-config and the repository /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
This crypto-config folder is supposed to have your network identities nested as follow :
/crypto-config
/peerOrganizations
other cryptomaterials
/users
/Admin#org1.example.com
/msp
/tls
The content of this folder is supposed to be generated by cryptogen tool and crypto-config.yaml file and folder will be named according to how you write it
And this content should be available to CLI environment variable like
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp
You should verify that your crypto-material are generated inside the crypto-config file and their paths are consistent with what is defined under CLI volumes and the environment variables
I am learning to create an application using Hyperledger fabrics.
Created the network. I got an error when starting the network.
When I run command: docker-compose -f ./docker-compose.yml up
Getting error:
Cannot run peer because error when setting up MSP of type bccsp from directory /etc/hyperledger/fabric/msp: could not load a valid signer certificate from directory /etc/hyperledger/fabric/msp/signcerts: stat /etc/hyperledger/fabric/msp/signcerts: no such file or directory
I have already added the CORE_PEER_MSPCONFIGPATH property in CLI service #docker-compose.yml file
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/manufacturer.pharma-network.com/users/Admin#manufacturer.pharma-network.com/msp
This is my docker-compose.yml file.
version: '2'
volumes:
orderer.pharma-network.com:
peer0.manufacturer.pharma-network.com:
peer1.manufacturer.pharma-network.com:
peer0.distributor.pharma-network.com:
peer1.distributor.pharma-network.com:
peer0.retailer.pharma-network.com:
peer1.retailer.pharma-network.com:
peer0.consumer.pharma-network.com:
peer1.consumer.pharma-network.com:
peer0.transporter.pharma-network.com:
peer1.transporter.pharma-network.com:
networks:
pharma:
services:
ca.manufacturer.pharma-network.com:
image: hyperledger/fabric-ca:latest
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca.manufacturer.pharma-network.com
- FABRIC_CA_SERVER_TLS_ENABLED=false
#- FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.manufacturer.pharma-network.com-cert.pem
#- FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/754fccf4ad3f6a483161cf597b79fbdbdadaf1ee2f024e79da8c8e9b8bfb6dcb_sk
ports:
- "7054:7054"
command: sh -c 'fabric-ca-server start -b admin:adminpw -d' # --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.registrar.property-registration-network.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/754fccf4ad3f6a483161cf597b79fbdbdadaf1ee2f024e79da8c8e9b8bfb6dcb_sk
volumes:
- ./crypto-config/peerOrganizations/manufacturer.pharma-network.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca.manufacturer.pharma-network.com
networks:
- pharma
ca.distributor.pharma-network.com:
image: hyperledger/fabric-ca:latest
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca.distributor.pharma-network.com
- FABRIC_CA_SERVER_TLS_ENABLED=false
# - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.users.property-registration-network.com-cert.pem
# - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/69f46c1ef51a71ee0aaadc9cef23aef7b44df2b1e84dad62484980170c01aa22_sk
ports:
- "8054:7054"
command: sh -c 'fabric-ca-server start -b admin:adminpw -d' # --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.users.property-registration-network.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/69f46c1ef51a71ee0aaadc9cef23aef7b44df2b1e84dad62484980170c01aa22_sk
volumes:
- ./crypto-config/peerOrganizations/distributor.pharma-network.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca.distributor.pharma-network.com
networks:
- pharma
ca.retailer.pharma-network.com:
image: hyperledger/fabric-ca:latest
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca.retailer.pharma-network.com
- FABRIC_CA_SERVER_TLS_ENABLED=false
# - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.users.property-registration-network.com-cert.pem
# - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/69f46c1ef51a71ee0aaadc9cef23aef7b44df2b1e84dad62484980170c01aa22_sk
ports:
- "9054:7054"
command: sh -c 'fabric-ca-server start -b admin:adminpw -d' # --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.users.property-registration-network.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/69f46c1ef51a71ee0aaadc9cef23aef7b44df2b1e84dad62484980170c01aa22_sk
volumes:
- ./crypto-config/peerOrganizations/retailer.pharma-network.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca.retailer.pharma-network.com
networks:
- pharma
ca.consumer.pharma-network.com:
image: hyperledger/fabric-ca:latest
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca.consumer.pharma-network.com
- FABRIC_CA_SERVER_TLS_ENABLED=false
ports:
- "1054:7054"
command: sh -c 'fabric-ca-server start -b admin:adminpw -d' # --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.users.property-registration-network.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/69f46c1ef51a71ee0aaadc9cef23aef7b44df2b1e84dad62484980170c01aa22_sk
volumes:
- ./crypto-config/peerOrganizations/consumer.pharma-network.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca.consumer.pharma-network.com
networks:
- pharma
ca.transporter.pharma-network.com:
image: hyperledger/fabric-ca:latest
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca.transporter.pharma-network.com
- FABRIC_CA_SERVER_TLS_ENABLED=false
# - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.users.property-registration-network.com-cert.pem
# - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/69f46c1ef51a71ee0aaadc9cef23aef7b44df2b1e84dad62484980170c01aa22_sk
ports:
- "2054:7054"
command: sh -c 'fabric-ca-server start -b admin:adminpw -d' # --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.users.property-registration-network.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/69f46c1ef51a71ee0aaadc9cef23aef7b44df2b1e84dad62484980170c01aa22_sk
volumes:
- ./crypto-config/peerOrganizations/transporter.pharma-network.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca.transporter.pharma-network.com
networks:
- pharma
orderer.pharma-network.com:
extends:
file: docker-base/docker-compose-base.yaml
service: orderer.pharma-network.com
container_name: orderer.pharma-network.com
networks:
- pharma
peer0.manufacturer.pharma-network.com:
container_name: peer0.manufacturer.pharma-network.com
extends:
file: docker-base/docker-compose-base.yaml
service: peer0.manufacturer.pharma-network.com
networks:
- pharma
peer1.manufacturer.pharma-network.com:
container_name: peer1.manufacturer.pharma-network.com
extends:
file: docker-base/docker-compose-base.yaml
service: peer1.manufacturer.pharma-network.com
networks:
- pharma
peer0.distributor.pharma-network.com:
container_name: peer0.distributor.pharma-network.com
extends:
file: docker-base/docker-compose-base.yaml
service: peer0.distributor.pharma-network.com
networks:
- pharma
peer1.distributor.pharma-network.com:
container_name: peer1.distributor.pharma-network.com
extends:
file: docker-base/docker-compose-base.yaml
service: peer1.distributor.pharma-network.com
networks:
- pharma
peer0.retailer.pharma-network.com:
container_name: peer0.retailer.pharma-network.com
extends:
file: docker-base/docker-compose-base.yaml
service: peer0.retailer.pharma-network.com
networks:
- pharma
peer1.retailer.pharma-network.com:
container_name: peer1.retailer.pharma-network.com
extends:
file: docker-base/docker-compose-base.yaml
service: peer1.retailer.pharma-network.com
networks:
- pharma
peer0.consumer.pharma-network.com:
container_name: peer0.consumer.pharma-network.com
extends:
file: docker-base/docker-compose-base.yaml
service: peer0.consumer.pharma-network.com
networks:
- pharma
peer1.consumer.pharma-network.com:
container_name: peer1.consumer.pharma-network.com
extends:
file: docker-base/docker-compose-base.yaml
service: peer1.consumer.pharma-network.com
networks:
- pharma
peer0.transporter.pharma-network.com:
container_name: peer0.transporter.pharma-network.com
extends:
file: docker-base/docker-compose-base.yaml
service: peer0.transporter.pharma-network.com
networks:
- pharma
peer1.transporter.pharma-network.com:
container_name: peer1.transporter.pharma-network.com
extends:
file: docker-base/docker-compose-base.yaml
service: peer1.transporter.pharma-network.com
networks:
- pharma
cli:
container_name: cli
image: hyperledger/fabric-tools:latest
tty: true
stdin_open: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- FABRIC_LOGGING_SPEC=INFO
- CORE_PEER_ID=cli
- CORE_PEER_ADDRESS=peer0.manufacturer.pharma-network.com:7051
- CORE_PEER_LOCALMSPID=manufacturerMSP
- CORE_PEER_TLS_ENABLED=false
- CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/manufacturer.pharma-network.com/peers/peer0.manufacturer.pharma-network.com/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/manufacturer.pharma-network.com/peers/peer0.manufacturer.pharma-network.com/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/manufacturer.pharma-network.com/peers/peer0.manufacturer.pharma-network.com/tls/ca.crt
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/manufacturer.pharma-network.com/users/Admin#manufacturer.pharma-network.com/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: /bin/bash
volumes:
- /var/run/:/host/var/run/
- ./../chaincode/:/opt/gopath/src/github.com/hyperledger/fabric/peer/chaincode/
- ./../chaincode-advanced/:/opt/gopath/src/github.com/hyperledger/fabric/peer/chaincode-advanced/
- ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
depends_on:
- ca.manufacturer.pharma-network.com
- ca.distributor.pharma-network.com
- ca.retailer.pharma-network.com
- ca.consumer.pharma-network.com
- ca.transporter.pharma-network.com
- orderer.pharma-network.com
- peer0.manufacturer.pharma-network.com
- peer1.manufacturer.pharma-network.com
- peer0.distributor.pharma-network.com
- peer1.distributor.pharma-network.com
- peer0.retailer.pharma-network.com
- peer1.retailer.pharma-network.com
- peer0.consumer.pharma-network.com
- peer1.consumer.pharma-network.com
- peer0.transporter.pharma-network.com
- peer1.transporter.pharma-network.com
networks:
- pharma
chaincode:
container_name: chaincode
image: hyperledger/fabric-ccenv:latest
tty: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- FABRIC_LOGGING_SPEC=INFO
- CORE_PEER_ID=chaincode
- CORE_PEER_ADDRESS=peer0.manufacturer.pharma-network.com:7051
- CORE_PEER_LOCALMSPID=manufacturerMSP
- CORE_PEER_TLS_ENABLED=false
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/crypto/peerOrganizations/manufacturer.pharma-network.com/users/Admin#manufacturer.pharma-network.com/msp
- CORE_TLS_CLIENT_KEY_PATH=/opt/gopath/src/crypto/peerOrganizations/manufacturer.pharma-network.com/users/Admin#manufacturer.pharma-network.com/tls/client.key
- CORE_TLS_CLIENT_CERT_PATH=/opt/gopath/src/crypto/peerOrganizations/manufacturer.pharma-network.com/users/Admin#manufacturer.pharma-network.com/tls/client.crt
- CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/crypto/peerOrganizations/manufacturer.pharma-network.com/users/Admin#manufacturer.pharma-network.com/tls/ca.crt
working_dir: /opt/gopath/src/chaincode
command: /bin/bash -c 'sleep 6000000'
volumes:
- /var/run/:/host/var/run/
- ./../chaincode:/opt/gopath/src/chaincode
- ./../chaincode-advanced:/opt/gopath/src/chaincode-advanced
- ./crypto-config:/opt/gopath/src/crypto
networks:
- pharma
This is docker-compose-base.yaml.
services:
orderer.pharma-network.com:
container_name: orderer.pharma-network.com
image: hyperledger/fabric-orderer:latest
environment:
- FABRIC_LOGGING_SPEC=INFO
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
# enable TLS
- ORDERER_GENERAL_TLS_ENABLED=false
- ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
- ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
- ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
#- GODEBUG=netdns=go
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: orderer
volumes:
- ../channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ../crypto-config/ordererOrganizations/pharma-network.com/orderers/orderer.pharma-network.com/msp:/var/hyperledger/orderer/msp
- ../crypto-config/ordererOrganizations/pharma-network.com/orderers/orderer.pharma-network.com/tls/:/var/hyperledger/orderer/tls
- orderer.pharma-network.com:/var/hyperledger/production/orderer
ports:
- 7050:7050
peer0.manufacturer.pharma-network.com:
container_name: peer0.manufacturer.pharma-network.com
extends:
file: docker-compose-peer.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer0.manufacturer.pharma-network.com
- CORE_PEER_ADDRESS=peer0.manufacturer.pharma-network.com:7051
- CORE_PEER_LISTENADDRESS=0.0.0.0:7051
- CORE_PEER_CHAINCODEADDRESS=peer0.manufacturer.pharma-network.com:7053
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7053
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.manufacturer.pharma-network.com:8051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.manufacturer.pharma-network.com:7051
- CORE_PEER_LOCALMSPID=manufacturerMSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/manufacturer.pharma-network.com/peers/peer0.manufacturer.pharma-network.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/manufacturer.pharma-network.com/peers/peer0.manufacturer.pharma-network.com/tls:/etc/hyperledger/fabric/tls
- peer0.manufacturer.pharma-network.com:/var/hyperledger/production
ports:
- 7051:7051
- 7053:7053
peer1.manufacturer.pharma-network.com:
container_name: peer1.manufacturer.pharma-network.com
extends:
file: docker-compose-peer.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer1.manufacturer.pharma-network.com
- CORE_PEER_ADDRESS=peer1.manufacturer.pharma-network.com:8051
- CORE_PEER_LISTENADDRESS=0.0.0.0:8051
- CORE_PEER_CHAINCODEADDRESS=peer0.manufacturer.pharma-network.com:8053
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:8053
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.manufacturer.pharma-network.com:8051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.manufacturer.pharma-network.com:7051
- CORE_PEER_LOCALMSPID=manufacturerMSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/manufacturer.pharma-network.com/peers/peer1.manufacturer.pharma-network.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/manufacturer.pharma-network.com/peers/peer1.manufacturer.pharma-network.com/tls:/etc/hyperledger/fabric/tls
- peer1.manufacturer.pharma-network.com:/var/hyperledger/production
ports:
- 8051:8051
- 8053:8053
peer0.distributor.pharma-network.com:
container_name: peer0.distributor.pharma-network.com
extends:
file: docker-compose-peer.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer0.distributor.pharma-network.com
- CORE_PEER_ADDRESS=peer0.distributor.pharma-network.com:9051
- CORE_PEER_LISTENADDRESS=0.0.0.0:9051
- CORE_PEER_CHAINCODEADDRESS=peer0.distributor.pharma-network.com:9053
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:9053
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.distributor.pharma-network.com:9051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.distributor.pharma-network.com:10051
- CORE_PEER_LOCALMSPID=distributorMSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/distributor.pharma-network.com/peers/peer0.distributor.pharma-network.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/distributor.pharma-network.com/peers/peer0.distributor.pharma-network.com/tls:/etc/hyperledger/fabric/tls
- peer0.distributor.pharma-network.com:/var/hyperledger/production
ports:
- 9051:9051
- 9053:9053
peer1.distributor.pharma-network.com:
container_name: peer1.distributor.pharma-network.com
extends:
file: docker-compose-peer.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer1.distributor.pharma-network.com
- CORE_PEER_ADDRESS=peer1.distributor.pharma-network.com:10051
- CORE_PEER_LISTENADDRESS=0.0.0.0:10051
- CORE_PEER_CHAINCODEADDRESS=peer0.distributor.pharma-network.com:10053
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:10053
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.distributor.pharma-network.com:10051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.distributor.pharma-network.com:9051
- CORE_PEER_LOCALMSPID=distributorMSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/distributor.pharma-network.com/peers/peer1.distributor.pharma-network.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/distributor.pharma-network.com/peers/peer1.distributor.pharma-network.com/tls:/etc/hyperledger/fabric/tls
- peer1.distributor.pharma-network.com:/var/hyperledger/production
ports:
- 10051:10051
- 10053:10053
peer0.retailer.pharma-network.com:
container_name: peer0.retailer.pharma-network.com
extends:
file: docker-compose-peer.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer0.retailer.pharma-network.com
- CORE_PEER_ADDRESS=peer0.retailer.pharma-network.com:11051
- CORE_PEER_LISTENADDRESS=0.0.0.0:11051
- CORE_PEER_CHAINCODEADDRESS=peer0.retailer.pharma-network.com:11053
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:11053
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.retailer.pharma-network.com:11051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.retailer.pharma-network.com:9051
- CORE_PEER_LOCALMSPID=retailerMSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/retailer.pharma-network.com/peers/peer0.retailer.pharma-network.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/retailer.pharma-network.com/peers/peer0.retailer.pharma-network.com/tls:/etc/hyperledger/fabric/tls
- peer0.retailer.pharma-network.com:/var/hyperledger/production
ports:
- 11051:11051
- 11053:11053
peer1.retailer.pharma-network.com:
container_name: peer1.retailer.pharma-network.com
extends:
file: docker-compose-peer.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer1.retailer.pharma-network-network.com
- CORE_PEER_ADDRESS=peer1.retailer.pharma-network-network.com:11051
- CORE_PEER_LISTENADDRESS=0.0.0.0:11051
- CORE_PEER_CHAINCODEADDRESS=peer0.retailer.pharma-network-network.com:11053
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:11053
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.retailer.pharma-network-network.com:11051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.retailer.pharma-network.com:12051
- CORE_PEER_LOCALMSPID=upgradMSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/retailer.pharma-network.com/peers/peer0.retailer.pharma-network.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/retailer.pharma-network.com/peers/peer0.retailer.pharma-network.com/tls:/etc/hyperledger/fabric/tls
- peer0.retailer.pharma-network.com:/var/hyperledger/production
ports:
- 12051:12051
- 12053:12053
peer0.consumer.pharma-network.com:
container_name: peer0.consumer.pharma-network.com
extends:
file: docker-compose-peer.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer0.consumer.pharma-network.com
- CORE_PEER_ADDRESS=peer0.consumer.pharma-network.com:12051
- CORE_PEER_LISTENADDRESS=0.0.0.0:12051
- CORE_PEER_CHAINCODEADDRESS=peer0.consumer.pharma-network.com:12053
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:12053
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.consumer.pharma-network.com:12051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.consumer.pharma-network.com:11051
- CORE_PEER_LOCALMSPID=consumerMSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/consumer.pharma-network.com/peers/peer0.consumer.pharma-network.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/consumer.pharma-network.com/peers/peer0.consumer.pharma-network.com/tls:/etc/hyperledger/fabric/tls
- peer0.consumer.pharma-network.com:/var/hyperledger/production
ports:
- 13051:13051
- 13053:13053
peer1.consumer.pharma-network.com:
container_name: peer1.consumer.pharma-network.com
extends:
file: docker-compose-peer.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer1.consumer.pharma-network.com
- CORE_PEER_ADDRESS=peer1.consumer.pharma-network.com:12052
- CORE_PEER_LISTENADDRESS=0.0.0.0:12052
- CORE_PEER_CHAINCODEADDRESS=peer1.consumer.pharma-network.com:12054
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:12054
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.consumer.pharma-network.com:12052
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.consumer.pharma-network.com:11052
- CORE_PEER_LOCALMSPID=consumerMSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/consumer.pharma-network.com/peers/peer1.consumer.pharma-network.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/consumer.pharma-network.com/peers/peer1.consumer.pharma-network.com/tls:/etc/hyperledger/fabric/tls
- peer1.consumer.pharma-network.com:/var/hyperledger/production
ports:
- 14052:14052
- 14054:14054
peer0.transporter.pharma-network.com:
container_name: peer0.transporter.pharma-network.com
extends:
file: docker-compose-peer.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer0.transporter.pharma-network.com
- CORE_PEER_ADDRESS=peer0.transporter.pharma-network.com:15051
- CORE_PEER_LISTENADDRESS=0.0.0.0:15051
- CORE_PEER_CHAINCODEADDRESS=peer0.transporter.pharma-network.com:15053
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:15053
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.transporter.pharma-network.com:15051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.transporter.pharma-network.com:16051
- CORE_PEER_LOCALMSPID=transporterMSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/transporter.pharma-network.com/peers/peer0.transporter.pharma-network.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/transporter.pharma-network.com/peers/peer0.transporter.pharma-network.com/tls:/etc/hyperledger/fabric/tls
- peer0.transporter.pharma-network.com:/var/hyperledger/production
ports:
- 15051:15051
- 15053:15053
peer1.transporter.pharma-network.com:
container_name: peer1.transporter.pharma-network.com
extends:
file: docker-compose-peer.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer1.transporter.pharma-network.com
- CORE_PEER_ADDRESS=peer1.transporter.pharma-network.com:16051
- CORE_PEER_LISTENADDRESS=0.0.0.0:16051
- CORE_PEER_CHAINCODEADDRESS=peer1.transporter.pharma-network.com:16053
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:16053
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.transporter.pharma-network.com:16051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.transporter.pharma-network.com:15051
- CORE_PEER_LOCALMSPID=transporterMSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/transporter.pharma-network.com/peers/peer1.transporter.pharma-network.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/transporter.pharma-network.com/peers/peer1.transporter.pharma-network.com/tls:/etc/hyperledger/fabric/tls
- peer1.transporter.pharma-network.com:/var/hyperledger/production
ports:
- 16051:16051
- 16053:16053
This is docker-compose-peer.yaml.
services:
peer-base:
image: hyperledger/fabric-peer:latest
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=network_pharma #changed this from network_certification
- FABRIC_LOGGING_SPEC=INFO
- CORE_PEER_TLS_ENABLED=false
- CORE_PEER_GOSSIP_USELEADERELECTION=true
- CORE_PEER_GOSSIP_ORGLEADER=false
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
volumes:
- ../crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start --peer-chaincodedev=true
Please help me.
I think you need you change ../crypto-config/peerOrganizations/manufacturer.pharma-network.com/peers/peer0.manufacturer.pharma-network.com/msp:/etc/hyperledger/fabric/msp to ./crypto-config/peerOrganizations/manufacturer.pharma-network.com/peers/peer0.manufacturer.pharma-network.com/msp:/etc/hyperledger/fabric/msp. This thing totally depends on your directory structure
Problem:
I am trying to build up a blockchain network from scratch using Hyperledger fabric. After creating crypto-config and channel artifacts and also changing the respective attribute in .ymal files I up the containers then when I try to create a channel through CLI it leaves me this error on console.
Cannot run peer because error when setting up MSP of type bccsp from
directory
//opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/doctor.pms.com/users/Admin#doctor.pms.com/msp:
Setup error: nil conf reference
This is my docker-compose-base.yaml file.
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: '2'
services:
orderer.pms.com:
container_name: orderer.pms.com
extends:
file: peer-base.yaml
service: orderer-base
volumes:
- ../channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ../crypto-config/ordererOrganizations/pms.com/orderers/orderer.pms.com/msp:/var/hyperledger/orderer/msp
- ../crypto-config/ordererOrganizations/pms.com/orderers/orderer.pms.com/tls/:/var/hyperledger/orderer/tls
- orderer.pms.com:/var/hyperledger/production/orderer
ports:
- 7050:7050
peer0.generalpublic.pms.com:
container_name: peer0.generalpublic.pms.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer0.generalpublic.pms.com
- CORE_PEER_ADDRESS=peer0.generalpublic.pms.com:7051
- CORE_PEER_LISTENADDRESS=0.0.0.0:7051
- CORE_PEER_CHAINCODEADDRESS=peer0.generalpublic.pms.com:7052
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.generalpublic.pms.com:8051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.generalpublic.pms.com:7051
- CORE_PEER_LOCALMSPID=GeneralpublicMSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/generalpublic.pms.com/peers/peer0.generalpublic.pms.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/generalpublic.pms.com/peers/peer0.generalpublic.pms.com/tls:/etc/hyperledger/fabric/tls
- peer0.generalpublic.pms.com:/var/hyperledger/production
ports:
- 7051:7051
peer1.generalpublic.pms.com:
container_name: peer1.generalpublic.pms.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer1.generalpublic.pms.com
- CORE_PEER_ADDRESS=peer1.generalpublic.pms.com:8051
- CORE_PEER_LISTENADDRESS=0.0.0.0:8051
- CORE_PEER_CHAINCODEADDRESS=peer1.generalpublic.pms.com:8052
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:8052
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.generalpublic.pms.com:8051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.generalpublic.pms.com:7051
- CORE_PEER_LOCALMSPID=GeneralpublicMSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/generalpublic.pms.com/peers/peer1.generalpublic.pms.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/generalpublic.pms.com/peers/peer1.generalpublic.pms.com/tls:/etc/hyperledger/fabric/tls
- peer1.generalpublic.pms.com:/var/hyperledger/production
ports:
- 8051:8051
peer0.doctor.pms.com:
container_name: peer0.doctor.pms.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer0.doctor.pms.com
- CORE_PEER_ADDRESS=peer0.doctor.pms.com:9051
- CORE_PEER_LISTENADDRESS=0.0.0.0:9051
- CORE_PEER_CHAINCODEADDRESS=peer0.doctor.pms.com:9052
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:9052
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.doctor.pms.com:9051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.doctor.pms.com:10051
- CORE_PEER_LOCALMSPID=DoctorMSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/doctor.pms.com/peers/peer0.doctor.pms.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/doctor.pms.com/peers/peer0.doctor.pms.com/tls:/etc/hyperledger/fabric/tls
- peer0.doctor.pms.com:/var/hyperledger/production
ports:
- 9051:9051
peer1.doctor.pms.com:
container_name: peer1.doctor.pms.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer1.doctor.doctor.com
- CORE_PEER_ADDRESS=peer1.doctor.pms.com:10051
- CORE_PEER_LISTENADDRESS=0.0.0.0:10051
- CORE_PEER_CHAINCODEADDRESS=peer1.doctor.pms.com:10052
- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:10052
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.doctor.pms.com:10051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.doctor.pms.com:9051
- CORE_PEER_LOCALMSPID=DoctorMSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/doctor.pms.com/peers/peer1.doctor.pms.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/doctor.pms.com/peers/peer1.doctor.pms.com/tls:/etc/hyperledger/fabric/tls
- peer1.doctor.pms.com:/var/hyperledger/production
ports:
- 10051:10051
This is my docker-compose-cli.yaml file.
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: '2'
volumes:
orderer.pms.com:
peer0.generalpublic.pms.com:
peer1.generalpublic.pms.com:
peer0.doctor.pms.com:
peer1.doctor.pms.com:
ca.Generalpublic.pms.com:
ca.doctor.pms.com:
networks:
byfn:
services:
ca.generalpublic.pms.com:
image: hyperledger/fabric-ca:latest
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca.generalpublic.pms.com
- FABRIC_CA_SERVER_TLS_ENABLED=true
- FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.generalpublic.pms.com-cert.pem
- FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/929794a7d5a90f2fc4f2dbc53db66d27cba02f8efbed28ff1d14001e862a3574_sk
ports:
- "7054:7054"
command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.generalpublic.pms.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/929794a7d5a90f2fc4f2dbc53db66d27cba02f8efbed28ff1d14001e862a3574_sk -b admin:adminpw -d'
volumes:
- ./crypto-config/peerOrganizations/generalpublic.pms.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca.generalpublic.pms.com
networks:
- byfn
ca.doctor.pms.com:
image: hyperledger/fabric-ca:latest
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca.doctor.pms.com
- FABRIC_CA_SERVER_TLS_ENABLED=true
- FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.doctor.pms.com-cert.pem
- FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/5c238614a373e903f982d5735db36fad9f2a2c5ce42fc6a9a3df6628a91657e4_sk
ports:
- "8054:7054"
command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.doctor.pms.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/5c238614a373e903f982d5735db36fad9f2a2c5ce42fc6a9a3df6628a91657e4_sk -b admin:adminpw -d'
volumes:
- ./crypto-config/peerOrganizations/doctor.pms.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca.doctor.pms.com
networks:
- byfn
orderer.pms.com:
extends:
file: base/docker-compose-base.yaml
service: orderer.pms.com
container_name: orderer.pms.com
networks:
- byfn
peer0.generalpublic.pms.com:
container_name: peer0.generalpublic.pms.com
extends:
file: base/docker-compose-base.yaml
service: peer0.generalpublic.pms.com
networks:
- byfn
peer1.generalpublic.pms.com:
container_name: peer1.generalpublic.pms.com
extends:
file: base/docker-compose-base.yaml
service: peer1.generalpublic.pms.com
networks:
- byfn
peer0.doctor.pms.com:
container_name: peer0.doctor.pms.com
extends:
file: base/docker-compose-base.yaml
service: peer0.doctor.pms.com
networks:
- byfn
peer1.doctor.pms.com:
container_name: peer1.doctor.pms.com
extends:
file: base/docker-compose-base.yaml
service: peer1.doctor.pms.com
networks:
- byfn
cli:
container_name: cli
image: hyperledger/fabric-tools:latest
tty: true
stdin_open: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- FABRIC_LOGGING_SPEC=DEBUG
# - FABRIC_LOGGING_SPEC=INFO
- CORE_PEER_ID=cli
- CORE_PEER_ADDRESS=peer0.doctor.pms.com:9051
- CORE_PEER_LOCALMSPID=DoctorMSP
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/doctor.pms.com/peers/peer0.doctor.pms.com/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/doctor.pms.com/peers/peer0.doctor.pms.com/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/doctor.pms.com/peers/peer0.doctor.pms.com/tls/ca.crt
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/doctor.pms.com/users/Admin#doctor.pms.com/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: /bin/bash
volumes:
- /var/run/:/host/var/run/
- ./../chaincode/:/opt/gopath/src/github.com/chaincode
- ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
depends_on:
- orderer.pms.com
- peer0.generalpublic.pms.com
- peer1.generalpublic.pms.com
- peer0.doctor.pms.com
- peer1.doctor.pms.com
- ca.generalpublic.pms.com
- ca.doctor.pms.com
networks:
- byfn
I try to find out a solution to this problem on the internet but I was unable to find an exact solution to this problem. Can someone help me to find out a solution to this problem? Thank you.
I'm trying to create my own-network in hyperledger fabric but got stuck because of below reason. I'm following chainHero tutorial for this with some changes like using my own organization name and peer's name.
I have already tried a couple of solutions available but none of them worked for me hence asking this question. Any help would be appreciated.
Error
docker-compose up -d
Creating network "firstproject-network_default" with the default driver
Creating ca.org1.firstproject.com ... done
Creating orderer.firstproject.com ... done
Creating peer1.org1.firstproject.com ... error
Creating peer0.org1.firstproject.com ...
Cannot start service peer0.org1.firstproject.com: b'OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \\"peer\\": executable file not found in $PATH": unknown'
Docker-compose.yaml file
version: '2'
networks:
default:
services:
orderer.firstproject.com:
container_name: orderer.firstproject.com
extends:
file: peer-base.yaml
service: orderer-base
environment:
- ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
- GRPC_TRACE=all=true,
- GRPC_VERBOSITY=debug
volumes:
- ./crypto-config/ordererOrganizations/firstproject.com/msp:/var/hyperledger/orderer/msp
- ./artifacts/genesis.block:/var/hyperledger/orderer/genesis.block
- ./crypto-config/ordererOrganizations/firstproject.com/orderers/orderer.firstproject.com/tls:/var/hyperledger/orderer/tls
ports:
- 7050:7050
ca.org1.firstapplication.com:
image: hyperledger/fabric-ca:latest
container_name: ca.org1.firstproject.com
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca.org1.firstproject.com
- FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.firstproject.com-cert.pem
- FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/78da3186373e52832b71dd83ec4d36ef84722a3e3ed15e8df214b482fe2723e7_sk
- FABRIC_CA_SERVER_TLS_ENABLED=true
- FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.firstproject.com-cert.pem
- FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/78da3186373e52832b71dd83ec4d36ef84722a3e3ed15e8df214b482fe2723e7_sk
ports:
- 7054:7054
command: sh -c 'fabric-ca-server start -b admin:adminpw -d'
volumes:
- ./crypto-config/peerOrganizations/org1.firstproject.com/ca/:/etc/hyperledger/fabric-ca-server-config
peer0.org1.firstproject.com:
container_name: peer0.org1.firstproject.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_NETWORKID=firstproject
- CORE_PEER_ID=peer0.org1.firstproject.com
- CORE_PEER_ADDRESSAUTODETECT=true
- CORE_PEER_ADDRESS=peer0.org1.firstproject.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.firstproject.com:7051
- CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
- CORE_PEER_LOCALMSPID=org1.firstproject.com
- CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer0.org1.firstproject.com
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/org1.firstproject.com/peers/peer0.org1.firstproject.com/msp:/var/hyperledger/msp
- ./crypto-config/peerOrganizations/org1.firstproject.com/peers/peer0.org1.firstproject.com/tls:/var/hyperledger/tls
ports:
- 7051:7051
- 7053:7053
depends_on:
- orderer.firstproject.com
links:
- orderer.firstproject.com
networks:
default:
aliases:
- peer0.org1.firstproject.com
peer1.org1.firstproject.com:
container_name: peer1.org1.firstproject.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_NETWORKID=firstproject
- CORE_PEER_ID=peer1.org1.firstproject.com
- CORE_PEER_ADDRESSAUTODETECT=true
- CORE_PEER_ADDRESS=peer1.org1.firstproject.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.firstproject.com:7051
- CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
- CORE_PEER_LOCALMSPID=org1.firstproject.com
- CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer1.org1.firstproject.com
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/org1.firstproject.com/peers/peer1.org1.firstproject.com/msp:/var/hyperledger/msp
- ./crypto-config/peerOrganizations/org1.firstproject.com/peers/peer1.org1.firstproject.com/tls:/var/hyperledger/tls
ports:
- 8051:7051
- 8053:7053
depends_on:
- orderer.firstproject.com
links:
- orderer.firstproject.com
networks:
default:
aliases:
- peer1.org1.firstproject.com
Peer-base.yaml ##
version: '2'
services:
peer-base:
image: hyperledger/fabric-orderer:latest
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_VM_DOCKER_ATTACHSTDOUT=true
- CORE_LOGGING_LEVEL=DEBUG
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_GOSSIP_USELEADERELECTION=true
- CORE_PEER_GOSSIP_ORGLEADER=false
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/var/hyperledger/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/var/hyperledger/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/tls/ca.crt
- CORE_PEER_MSPCONFIGPATH=/var/hyperledger/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
orderer-base:
image: hyperledger/fabric-orderer:latest
environment:
- FABRIC_LOGGING_SPEC=DEBUG
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
# enabled TLS
- ORDERER_GENERAL_TLS_ENABLED=true
- ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
- ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
- ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
- ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt
- ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key
- ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: orderer
Your definition of peer-base is incorrect
services:
peer-base:
image: hyperledger/fabric-orderer:latest
your image should be fabric-peer
services:
peer-base:
image: hyperledger/fabric-peer:latest
Would also highly recommend you don't use the latest tag as this tag will be removed in the future. You should specify the version you want to use.
I've been experimenting with Hyperledger Composer and with the official multi org tutorial. I was successful in modifying the given demo, adding a third organisation and finally installing my own bna.
The next step was to fully understand how to deploy the Fabric network and Composer on multiple physical machines. And I went through all the available info about deploying such a process but without much luck.
Let suppose:
PC1: 1 Orderer, 1 Organisation, One cli container;
PC2: 1 Organisation;
PC3: 1 Organization;
I'm able to put the 3 machines in a swarm.
I know that I need to generate the certificates for all the machines and that they should be identical.
But from there I don't fully understand how to continue, or how to add references to the swarm network inside the compose files...
#docker-compose-cas-template-0 - This is for PC 1
version: '2'
networks:
example:
services:
ca0:
image: hyperledger/fabric-ca
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca-manager
- FABRIC_CA_SERVER_TLS_ENABLED=true
- FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.manager.example.com-cert.pem
- FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/CA1_PRIVATE_KEY
ports:
- "7054:7054"
command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.manager.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/CA1_PRIVATE_KEY -b admin:adminpw -d'
volumes:
- ./crypto-config/peerOrganizations/manager.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca_peerManager
networks:
- example
# docker-compose-base-1.yaml - This is for PC1
version: '2'
services:
orderer.proa.com:
container_name: orderer.proa.com
image: hyperledger/fabric-orderer:$IMAGE_TAG
environment:
- ORDERER_GENERAL_LOGLEVEL=INFO
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
# enabled TLS
- ORDERER_GENERAL_TLS_ENABLED=true
- ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
- ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
- ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: orderer
volumes:
- ../channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ../crypto-config/ordererOrganizations/proa.com/orderers/orderer.proa.com/msp:/var/hyperledger/orderer/msp
- ../crypto-config/ordererOrganizations/proa.com/orderers/orderer.proa.com/tls/:/var/hyperledger/orderer/tls
- orderer.proa.com:/var/hyperledger/production/orderer
ports:
- 7050:7050
peer0.manager.proa.com:
container_name: peer0.manager.proa.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer0.manager.proa.com
- CORE_PEER_ADDRESS=peer0.manager.proa.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.manager.proa.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.manager.proa.com:7051
- CORE_PEER_LOCALMSPID=ManagerMSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/manager.proa.com/peers/peer0.manager.proa.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/manager.proa.com/peers/peer0.manager.proa.com/tls:/etc/hyperledger/fabric/tls
- peer0.manager.proa.com:/var/hyperledger/production
ports:
- 7051:7051
- 7053:7053
peer1.manager.proa.com:
container_name: peer1.manager.proa.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer1.manager.proa.com
- CORE_PEER_ADDRESS=peer1.manager.proa.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.manager.proa.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.manager.proa.com:7051
- CORE_PEER_LOCALMSPID=ManagerMSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/manager.proa.com/peers/peer1.manager.proa.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/manager.proa.com/peers/peer1.manager.proa.com/tls:/etc/hyperledger/fabric/tls
- peer1.manager.proa.com:/var/hyperledger/production
ports:
- 8051:7051
- 8053:7053
UPDATED with docker-compose-cli.yaml - for ORG2 and PC2
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: '2'
volumes:
peer0.sponsor.example.com:
peer1.sponsor.example.com:
networks:
example:
external:
name: example
services:
peer0.sponsor.example.com:
container_name: peer0.sponsor.example.com
extends:
file: base/docker-compose-base-2.yaml
service: peer0.sponsor.example.com
networks:
- example
peer1.sponsor.example.com:
container_name: peer1.sponsor.example.com
extends:
file: base/docker-compose-base-2.yaml
service: peer1.sponsor.example.com
networks:
- example
cli2:
container_name: cli2
image: hyperledger/fabric-tools:$IMAGE_TAG
tty: true
stdin_open: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
#- CORE_LOGGING_LEVEL=DEBUG
- CORE_LOGGING_LEVEL=INFO
- CORE_PEER_ID=cli
- CORE_PEER_ADDRESS=peer0.sponsor.example.com:7051
- CORE_PEER_LOCALMSPID=SponsorMSP
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/sponsor.example.com/peers/peer0.sponsor.example.com/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/sponsor.example.com/peers/peer0.sponsor.example.com/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/sponsor.example.com/peers/peer0.sponsor.example.com/tls/ca.crt
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/sponsor.example.com/users/Admin#sponsor.example.com/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: /bin/bash
volumes:
- /var/run/:/host/var/run/
- ./../chaincode/:/opt/gopath/src/github.com/chaincode
- ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
depends_on:
- peer0.sponsor.example.com
- peer1.sponsor.example.com
networks:
- example
You're on right track. I'll list down the steps below:
We create a docker swarm and connect these hosts. Since you've already created a swarm, I assume your hosts are connected.
We create an overlay network from one of the hosts. In our case, it is "example" network.
docker network create --attachable --driver overlay example
Now, this overlay network will be available in all the hosts. You can run the following command in each of the hosts:
docker network ls
Here, you'll be able to see the network with the name "example" that is an overlay network.
Also, you can inspect the network to see which all hosts (peers) are connected to this network using:
docker network inspect example
Spin up the containers. However, in this step, we need to make these containers join the existing overlay network i.e "example". So your compose files will be like:
version: '2'
networks:
example:
external:
name: example
services:
ca0:
image: hyperledger/fabric-ca
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca-manager
- FABRIC_CA_SERVER_TLS_ENABLED=true
- FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.manager.example.com-cert.pem
- FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/CA1_PRIVATE_KEY
ports:
- "7054:7054"
command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.manager.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/CA1_PRIVATE_KEY -b admin:adminpw -d'
volumes:
- ./crypto-config/peerOrganizations/manager.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca_peerManager
networks:
- example
This configuration will remain similar for all your docker containers, be it, peer, orderer, ca or cli. Also, this configuration will make sure that your container will join the existing network instead of creating a new one.
Note: Running the docker in swarm mode requires few ports to be opened up. You can find those references in this article.