Fix bugs, now passed all modes
parent
c20d68b183
commit
906b5edbd9
|
@ -1,43 +1,40 @@
|
||||||
KAFKA_ENABLED ?= false
|
# mode of the network: solo, kafka, couchdb, dev
|
||||||
COUCHDB_ENABLED ?= false
|
HLF_MODE ?= solo
|
||||||
DEV_ENABLED ?= false
|
|
||||||
|
CODE_BUILD_WAIT=2
|
||||||
|
NETWORK_INIT_WAIT=2
|
||||||
|
|
||||||
COMPOSE_FILE ?= "docker-compose-2orgs-4peers-solo.yaml"
|
COMPOSE_FILE ?= "docker-compose-2orgs-4peers-solo.yaml"
|
||||||
|
|
||||||
ifeq ($(KAFKA_ENABLED),true)
|
ifeq ($(HLF_MODE),kafka)
|
||||||
COMPOSE_FILE="docker-compose-2orgs-4peers-kafka.yaml"
|
COMPOSE_FILE="docker-compose-2orgs-4peers-kafka.yaml"
|
||||||
endif
|
else ifeq ($(HLF_MODE),couchdb)
|
||||||
|
COMPOSE_FILE="docker-compose-2orgs-4peers-couchdb.yaml"
|
||||||
ifeq ($(COUCHDB_ENABLED),true)
|
else ifeq ($(HLF_MODE),dev)
|
||||||
COMPOSE_FILE="docker-compose-2orgs-4peers-couchdb.yaml"
|
COMPOSE_FILE="docker-compose-1orgs-1peers-dev.yaml"
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(DEV_ENABLED),true)
|
|
||||||
COMPOSE_FILE="docker-compose-1orgs-1peers-dev.yaml"
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all:
|
all:
|
||||||
@echo "Run test with ${COMPOSE_FILE}"
|
@echo "Run test with $(COMPOSE_FILE)"
|
||||||
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
|
@echo "Please make sure u have setup Docker and pulled images by 'make setup'."
|
||||||
sleep 1
|
sleep 2
|
||||||
|
|
||||||
make ready
|
make ready
|
||||||
make lscc qscc
|
make lscc qscc fetch_block
|
||||||
|
|
||||||
make stop clean
|
make stop clean
|
||||||
|
|
||||||
ready: restart
|
ready: restart
|
||||||
@echo "Restart, init network and then do cc testing..."
|
@echo "Restart, init network and then do cc testing..."
|
||||||
if [ "$(DEV_ENABLED)" = "true" ]; then \
|
if [ "$(HLF_MODE)" = "dev" ]; then \
|
||||||
echo "In DEV mode, wait for rebuilding ..." && sleep 35; \
|
echo "In DEV mode, wait for rebuilding ..." && sleep $(CODE_BUILD_WAIT); \
|
||||||
make init_peer0; \
|
make init_peer0; \
|
||||||
sleep 2; \
|
sleep $(NETWORK_INIT_WAIT); \
|
||||||
make test_peer0; \
|
make test_cc_peer0; \
|
||||||
else \
|
else \
|
||||||
echo "In Normal mode ..." && sleep 3; \
|
echo "In Normal mode ..." && sleep 3; \
|
||||||
make init; \
|
make init; \
|
||||||
sleep 2; \
|
sleep $(NETWORK_INIT_WAIT); \
|
||||||
make test_cc; \
|
make test_cc_all; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@echo "Now the fabric network is ready to play"
|
@echo "Now the fabric network is ready to play"
|
||||||
|
@ -63,13 +60,14 @@ stop: # stop the fabric network
|
||||||
|
|
||||||
restart: stop start
|
restart: stop start
|
||||||
|
|
||||||
|
chaincode_dev: restart chaincode_init test_cc_peer0 stop
|
||||||
|
|
||||||
################## Chaincode testing operations ################
|
################## Chaincode testing operations ################
|
||||||
test_cc: # test user chaincode on all peers
|
test_cc_all: # test user chaincode on all peers
|
||||||
@echo "Invoke and query cc example02 on all peers"
|
@echo "Invoke and query cc example02 on all peers"
|
||||||
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_all.sh"
|
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_all.sh"
|
||||||
|
|
||||||
test_peer0: # test single peer
|
test_cc_peer0: # test single peer
|
||||||
@echo "Invoke and query cc example02 on single peer0"
|
@echo "Invoke and query cc example02 on single peer0"
|
||||||
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_peer0.sh"
|
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_cc_peer0.sh"
|
||||||
|
|
||||||
|
@ -79,6 +77,14 @@ qscc: # test qscc queries
|
||||||
lscc: # test lscc quries
|
lscc: # test lscc quries
|
||||||
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_lscc.sh"
|
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_lscc.sh"
|
||||||
|
|
||||||
|
fetch_block: # test channel fetch
|
||||||
|
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/test_fetch.sh"
|
||||||
|
docker cp fabric-cli:/tmp/block_0.block kafka/channel-artifacts/
|
||||||
|
docker cp fabric-cli:/tmp/block_1.block kafka/channel-artifacts/
|
||||||
|
docker cp fabric-cli:/tmp/block_2.block kafka/channel-artifacts/
|
||||||
|
docker cp fabric-cli:/tmp/block_3.block kafka/channel-artifacts/
|
||||||
|
|
||||||
|
|
||||||
################## Env setup related, no need to see usually ################
|
################## Env setup related, no need to see usually ################
|
||||||
|
|
||||||
setup: # setup the environment
|
setup: # setup the environment
|
||||||
|
@ -114,6 +120,7 @@ logs_check: logs_save logs_view
|
||||||
logs_save: # save logs
|
logs_save: # save logs
|
||||||
docker logs peer0.org1.example.com >& /tmp/dev_peer.log
|
docker logs peer0.org1.example.com >& /tmp/dev_peer.log
|
||||||
docker logs orderer.example.com >& /tmp/dev_orderer.log
|
docker logs orderer.example.com >& /tmp/dev_orderer.log
|
||||||
|
docker-compose -f ${COMPOSE_FILE} logs >& /tmp/dev_all.log
|
||||||
|
|
||||||
logs_view: # view logs
|
logs_view: # view logs
|
||||||
less /tmp/dev_peer.log
|
less /tmp/dev_peer.log
|
||||||
|
@ -130,7 +137,14 @@ configtxlator: # run configtxlator
|
||||||
download: # download required images
|
download: # download required images
|
||||||
@echo "Download Docker images"
|
@echo "Download Docker images"
|
||||||
docker pull yeasy/hyperledger-fabric:latest
|
docker pull yeasy/hyperledger-fabric:latest
|
||||||
docker pull yeasy/hyperledger-fabric:1.0.3
|
docker pull yeasy/hyperledger-fabric-kafka:0.10.2.0 # official repo does not provide the latest image currently
|
||||||
docker pull hyperledger/fabric-baseos:x86_64-0.4.2
|
docker pull hyperledger/fabric-baseos:x86_64-0.4.2
|
||||||
docker tag yeasy/hyperledger-fabric:latest hyperledger/fabric-ccenv:x86_64-1.1.0
|
docker tag yeasy/hyperledger-fabric:latest hyperledger/fabric-ccenv:x86_64-1.1.0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
################## chaincode dev mode ################
|
||||||
|
chaincode_init: # start chaincode in dev mode and do install/instantiate
|
||||||
|
@echo "Install and instantiate cc example02 on the fabric dev network"
|
||||||
|
docker exec -it fabric-cli bash -c "cd /tmp; bash scripts/init_chaincode_dev.sh"
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ services:
|
||||||
extends:
|
extends:
|
||||||
file: base.yaml
|
file: base.yaml
|
||||||
service: peer-base
|
service: peer-base
|
||||||
image: yeasy/hyperledger-fabric:latest
|
image: yeasy/hyperledger-fabric:1.0.3
|
||||||
container_name: peer0.org1.example.com
|
container_name: peer0.org1.example.com
|
||||||
hostname: peer0.org1.example.com
|
hostname: peer0.org1.example.com
|
||||||
environment:
|
environment:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# https://github.com/yeasy/docker-compose-files/tree/master/hyperledger
|
# https://github.com/yeasy/files/tree/master/hyperledger
|
||||||
# This compose file will start a Hyperledger Fabric 1.0 MVE, including
|
# This compose file will start a Hyperledger Fabric 1.0 MVE, including
|
||||||
# * 1 ca
|
# * 1 ca
|
||||||
# * 1 orderer
|
# * 1 orderer
|
||||||
|
@ -36,23 +36,23 @@ services:
|
||||||
# ZooKeeper services, at least 3 nodes
|
# ZooKeeper services, at least 3 nodes
|
||||||
zookeeper0:
|
zookeeper0:
|
||||||
extends:
|
extends:
|
||||||
file: docker-compose-base-kafka.yaml
|
file: base-kafka.yaml
|
||||||
service: zookeeper0
|
service: zookeeper0
|
||||||
|
|
||||||
zookeeper1:
|
zookeeper1:
|
||||||
extends:
|
extends:
|
||||||
file: docker-compose-base-kafka.yaml
|
file: base-kafka.yaml
|
||||||
service: zookeeper1
|
service: zookeeper1
|
||||||
|
|
||||||
zookeeper2:
|
zookeeper2:
|
||||||
extends:
|
extends:
|
||||||
file: docker-compose-base-kafka.yaml
|
file: base-kafka.yaml
|
||||||
service: zookeeper2
|
service: zookeeper2
|
||||||
|
|
||||||
# Kafka services, at least 4 node to tolerant work with 1 node failure
|
# Kafka services, at least 4 node to tolerant work with 1 node failure
|
||||||
kafka0:
|
kafka0:
|
||||||
extends:
|
extends:
|
||||||
file: docker-compose-base-kafka.yaml
|
file: base-kafka.yaml
|
||||||
service: kafka0
|
service: kafka0
|
||||||
depends_on:
|
depends_on:
|
||||||
- zookeeper0
|
- zookeeper0
|
||||||
|
@ -61,7 +61,7 @@ services:
|
||||||
|
|
||||||
kafka1:
|
kafka1:
|
||||||
extends:
|
extends:
|
||||||
file: docker-compose-base-kafka.yaml
|
file: base-kafka.yaml
|
||||||
service: kafka1
|
service: kafka1
|
||||||
depends_on:
|
depends_on:
|
||||||
- zookeeper0
|
- zookeeper0
|
||||||
|
@ -70,7 +70,7 @@ services:
|
||||||
|
|
||||||
kafka2:
|
kafka2:
|
||||||
extends:
|
extends:
|
||||||
file: docker-compose-base-kafka.yaml
|
file: base-kafka.yaml
|
||||||
service: kafka2
|
service: kafka2
|
||||||
depends_on:
|
depends_on:
|
||||||
- zookeeper0
|
- zookeeper0
|
||||||
|
@ -79,7 +79,7 @@ services:
|
||||||
|
|
||||||
kafka3:
|
kafka3:
|
||||||
extends:
|
extends:
|
||||||
file: docker-compose-base-kafka.yaml
|
file: base-kafka.yaml
|
||||||
service: kafka3
|
service: kafka3
|
||||||
depends_on:
|
depends_on:
|
||||||
- zookeeper0
|
- zookeeper0
|
||||||
|
|
|
@ -27,11 +27,18 @@ services:
|
||||||
extends:
|
extends:
|
||||||
file: base-kafka.yaml
|
file: base-kafka.yaml
|
||||||
service: orderer.example.com
|
service: orderer.example.com
|
||||||
|
depends_on:
|
||||||
|
- kafka0
|
||||||
|
- kafka1
|
||||||
|
- kafka2
|
||||||
|
- kafka3
|
||||||
|
|
||||||
peer0.org1.example.com:
|
peer0.org1.example.com:
|
||||||
extends:
|
extends:
|
||||||
file: base-kafka.yaml
|
file: base-kafka.yaml
|
||||||
service: peer0.org1.example.com
|
service: peer0.org1.example.com
|
||||||
|
depends_on:
|
||||||
|
- orderer.example.com
|
||||||
|
|
||||||
peer1.org1.example.com:
|
peer1.org1.example.com:
|
||||||
extends:
|
extends:
|
||||||
|
@ -51,13 +58,11 @@ services:
|
||||||
# ZooKeeper services, at least 3 nodes
|
# ZooKeeper services, at least 3 nodes
|
||||||
zookeeper0:
|
zookeeper0:
|
||||||
extends:
|
extends:
|
||||||
file: base-kafka.yaml
|
|
||||||
file: base-kafka.yaml
|
file: base-kafka.yaml
|
||||||
service: zookeeper0
|
service: zookeeper0
|
||||||
|
|
||||||
zookeeper1:
|
zookeeper1:
|
||||||
extends:
|
extends:
|
||||||
file: base-kafka.yaml
|
|
||||||
file: base-kafka.yaml
|
file: base-kafka.yaml
|
||||||
service: zookeeper1
|
service: zookeeper1
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -168,7 +168,7 @@ channelJoin () {
|
||||||
for i in $peers_to_join; do
|
for i in $peers_to_join; do
|
||||||
setGlobals $i
|
setGlobals $i
|
||||||
joinWithRetry $i
|
joinWithRetry $i
|
||||||
echo_g "===================== PEER$i joined on the channel \"$CHANNEL_NAME\" ===================== "
|
echo_g "===================== PEER$i joined into the channel \"$CHANNEL_NAME\" ===================== "
|
||||||
sleep 2
|
sleep 2
|
||||||
echo
|
echo
|
||||||
done
|
done
|
||||||
|
|
|
@ -13,23 +13,21 @@ echo " ==========initialize businesschannel========== "
|
||||||
echo " ============================================== "
|
echo " ============================================== "
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echo_b "Channel name : "$CHANNEL_NAME
|
|
||||||
|
|
||||||
## Create channel
|
## Create channel
|
||||||
echo_b "Creating channel..."
|
echo_b "Creating channel $CHANNEL_NAME..."
|
||||||
channelCreate
|
channelCreate $CHANNEL_NAME
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
## Join all the peers to the channel
|
## Join all the peers to the channel
|
||||||
echo_b "Having peer0 join the channel..."
|
echo_b "Having peer0 join the channel..."
|
||||||
channelJoin 0
|
channelJoin $CHANNEL_NAME 0
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
## Set the anchor peers for each org in the channel
|
## Set the anchor peers for each org in the channel
|
||||||
echo_b "Updating anchor peers for peer0/org1... no use for only single channel"
|
echo_b "Updating anchor peers for peer0/org1... no use for only single channel"
|
||||||
updateAnchorPeers 0
|
updateAnchorPeers $CHANNEL_NAME 0
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
|
@ -42,7 +40,7 @@ sleep 1
|
||||||
# Instantiate chaincode on all peers
|
# Instantiate chaincode on all peers
|
||||||
# Instantiate can only be executed once on any node
|
# Instantiate can only be executed once on any node
|
||||||
echo_b "Instantiating chaincode on the channel..."
|
echo_b "Instantiating chaincode on the channel..."
|
||||||
chaincodeInstantiate 0
|
chaincodeInstantiate $CHANNEL_NAME 0
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# This is the default base file to config env and command
|
# This is the default base file to config env and command
|
||||||
# Notice that chaincode is executed inside docker in default net mode
|
# All element in this file is abstract without knowing the org and consensus type
|
||||||
# https://github.com/yeasy/docker-compose-files
|
# https://github.com/yeasy/docker-compose-files
|
||||||
|
|
||||||
# Depends on the hyperledger/fabric-peer image.
|
# Depends on the hyperledger/fabric-peer image.
|
||||||
|
|
|
@ -1,97 +0,0 @@
|
||||||
# This is the development compose file to config env and command
|
|
||||||
# Notice that chaincode is executed inside docker in default net mode
|
|
||||||
# https://github.com/yeasy/docker-compose-files
|
|
||||||
|
|
||||||
# Depends on the yeasy/hyperledger-fabric image.
|
|
||||||
|
|
||||||
version: '2'
|
|
||||||
|
|
||||||
services:
|
|
||||||
orderer.example.com: # There can be multiple orderers
|
|
||||||
extends:
|
|
||||||
file: base.yaml
|
|
||||||
service: orderer-base
|
|
||||||
image: yeasy/hyperledger-fabric:latest
|
|
||||||
container_name: orderer.example.com
|
|
||||||
hostname: orderer.example.com
|
|
||||||
ports:
|
|
||||||
- "7050:7050"
|
|
||||||
environment:
|
|
||||||
# Kafka related configurations
|
|
||||||
- ORDERER_KAFKA_RETRY_SHORTINTERVAL=1s
|
|
||||||
- ORDERER_KAFKA_RETRY_SHORTTOTAL=30s
|
|
||||||
- ORDERER_KAFKA_VERBOSE=true
|
|
||||||
volumes:
|
|
||||||
- $GOPATH/src/github.com/hyperledger/fabric:/go/src/github.com/hyperledger/fabric
|
|
||||||
# for e2e_cli case
|
|
||||||
#- ./e2e_cli/channel-artifacts/orderer.genesis.block:/var/hyperledger/orderer/orderer.genesis.block
|
|
||||||
#- ./e2e_cli/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
|
|
||||||
#- ./e2e_cli/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
|
|
||||||
# for kafka case
|
|
||||||
- ./kafka/channel-artifacts/orderer.genesis.block:/var/hyperledger/orderer/orderer.genesis.block
|
|
||||||
- ./kafka/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
|
|
||||||
- ./kafka/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
|
|
||||||
#command: bash -c 'bash /tmp/orderer_build.sh; orderer start' # use this if to debug orderer
|
|
||||||
command: bash -c 'orderer start' # use this if to debug orderer
|
|
||||||
|
|
||||||
peer0.org1.example.com:
|
|
||||||
extends:
|
|
||||||
file: base.yaml
|
|
||||||
service: peer-base
|
|
||||||
image: yeasy/hyperledger-fabric:latest
|
|
||||||
container_name: peer0.org1.example.com
|
|
||||||
hostname: peer0.org1.example.com
|
|
||||||
environment:
|
|
||||||
- CORE_PEER_ID=peer0.org1.example.com
|
|
||||||
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
|
|
||||||
- CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7052
|
|
||||||
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
|
|
||||||
- CORE_PEER_LOCALMSPID=Org1MSP
|
|
||||||
volumes:
|
|
||||||
- $GOPATH/src/github.com/hyperledger/fabric:/go/src/github.com/hyperledger/fabric
|
|
||||||
# e2e mode configuration
|
|
||||||
#- ./e2e_cli/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp
|
|
||||||
#- ./e2e_cli/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls
|
|
||||||
# kafka mode configuration
|
|
||||||
- ./kafka/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp
|
|
||||||
- ./kafka/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls
|
|
||||||
ports:
|
|
||||||
- 7051:7051
|
|
||||||
- 7052:7052
|
|
||||||
- 7053:7053
|
|
||||||
#command: bash -c 'bash /tmp/peer_build.sh; peer node start'
|
|
||||||
command: bash -c 'peer node start'
|
|
||||||
#command: bash -c 'peer node start --peer-chaincodedev=true' # DEV mode
|
|
||||||
|
|
||||||
cli:
|
|
||||||
extends:
|
|
||||||
file: base.yaml
|
|
||||||
service: cli-base
|
|
||||||
image: yeasy/hyperledger-fabric:latest
|
|
||||||
container_name: fabric-cli
|
|
||||||
hostname: fabric-cli
|
|
||||||
tty: true
|
|
||||||
environment:
|
|
||||||
- CORE_PEER_ID=fabric-cli
|
|
||||||
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051 # default to operate on peer0.org1
|
|
||||||
- CORE_PEER_LOCALMSPID=Org1MSP
|
|
||||||
- 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
|
|
||||||
volumes:
|
|
||||||
- $GOPATH/src/github.com/hyperledger/fabric:/opt/gopath/src/github.com/hyperledger/fabric
|
|
||||||
#- /tmp/:/tmp/
|
|
||||||
- ./scripts:/tmp/scripts
|
|
||||||
# e2e mode configuration
|
|
||||||
#- ./e2e_cli/channel-artifacts:/tmp/channel-artifacts
|
|
||||||
#- ./e2e_cli/configtx.yaml:/etc/hyperledger/fabric/configtx.yaml
|
|
||||||
#- ./e2e_cli/crypto-config.yaml:/etc/hyperledger/fabric/crypto-config.yaml
|
|
||||||
#- ./e2e_cli/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto
|
|
||||||
#- ./e2e_cli/examples:/opt/gopath/src/github.com/hyperledger/fabric/examples
|
|
||||||
# kafka mode configuration
|
|
||||||
- ./kafka/channel-artifacts:/tmp/channel-artifacts
|
|
||||||
- ./kafka/configtx.yaml:/etc/hyperledger/fabric/configtx.yaml
|
|
||||||
- ./kafka/crypto-config.yaml:/etc/hyperledger/fabric/crypto-config.yaml
|
|
||||||
- ./kafka/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto
|
|
||||||
- ./kafka/examples:/opt/gopath/src/github.com/hyperledger/fabric/examples
|
|
|
@ -1,259 +0,0 @@
|
||||||
# Kafka enabled fabric network with:
|
|
||||||
|
|
||||||
# ca.org1.example.com
|
|
||||||
# ca.org2.example.com
|
|
||||||
# orderer.example.com
|
|
||||||
# peer0.org1.example.com
|
|
||||||
# peer1.org1.example.com
|
|
||||||
# peer0.org2.example.com
|
|
||||||
# peer1.org2.example.com
|
|
||||||
# 3 zookeeper nodes
|
|
||||||
# 4 kafka nodes
|
|
||||||
# cli
|
|
||||||
|
|
||||||
version: '2' # v3 does not support 'extends' yet
|
|
||||||
|
|
||||||
services:
|
|
||||||
ca.org1.example.com:
|
|
||||||
#image: yeasy/hyperledger-fabric-ca:1.0.3
|
|
||||||
#image: hyperledger/fabric-ca:x86_64-1.0.3
|
|
||||||
extends:
|
|
||||||
file: base.yaml
|
|
||||||
service: ca-base
|
|
||||||
container_name: ca.org1.example.com
|
|
||||||
hostname: ca.org1.example.com
|
|
||||||
environment:
|
|
||||||
- FABRIC_CA_SERVER_CA_NAME=ca-org1
|
|
||||||
- FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem
|
|
||||||
- FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/c843d3f021118963ce5d340e95286e8869bb7bd051454cd4166aa2887a2ad451_sk
|
|
||||||
ports:
|
|
||||||
- "7054:7054"
|
|
||||||
volumes:
|
|
||||||
- ./kafka/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
|
|
||||||
command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/c843d3f021118963ce5d340e95286e8869bb7bd051454cd4166aa2887a2ad451_sk -b admin:adminpw -d'
|
|
||||||
|
|
||||||
ca.org2.example.com:
|
|
||||||
#image: yeasy/hyperledger-fabric-ca:1.0.3
|
|
||||||
#image: hyperledger/fabric-ca:x86_64-1.0.3
|
|
||||||
extends:
|
|
||||||
file: base.yaml
|
|
||||||
service: ca-base
|
|
||||||
container_name: ca.org2.example.com
|
|
||||||
hostname: ca.org2.example.com
|
|
||||||
environment:
|
|
||||||
- FABRIC_CA_SERVER_CA_NAME=ca-org2
|
|
||||||
- FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem
|
|
||||||
- FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/1ee551a8753171c0377366e96a1d7ec01afddb868c9483cc501b6f8ac7ae752f_sk
|
|
||||||
ports:
|
|
||||||
- "8054:7054"
|
|
||||||
volumes:
|
|
||||||
- ./kafka/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
|
|
||||||
command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/1ee551a8753171c0377366e96a1d7ec01afddb868c9483cc501b6f8ac7ae752f_sk -b admin:adminpw -d'
|
|
||||||
|
|
||||||
orderer.example.com: # There can be multiple orderers
|
|
||||||
extends:
|
|
||||||
file: base.yaml
|
|
||||||
service: orderer-base
|
|
||||||
container_name: orderer.example.com
|
|
||||||
hostname: orderer.example.com
|
|
||||||
ports:
|
|
||||||
- "7050:7050"
|
|
||||||
environment:
|
|
||||||
# Kafka related configurations
|
|
||||||
- ORDERER_KAFKA_RETRY_SHORTINTERVAL=1s
|
|
||||||
- ORDERER_KAFKA_RETRY_SHORTTOTAL=30s
|
|
||||||
- ORDERER_KAFKA_VERBOSE=true
|
|
||||||
volumes:
|
|
||||||
- ./kafka/channel-artifacts/orderer.genesis.block:/var/hyperledger/orderer/orderer.genesis.block
|
|
||||||
- ./kafka/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
|
|
||||||
- ./kafka/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
|
|
||||||
command: orderer start
|
|
||||||
|
|
||||||
cli:
|
|
||||||
extends:
|
|
||||||
file: base.yaml
|
|
||||||
service: cli-base
|
|
||||||
container_name: fabric-cli
|
|
||||||
hostname: fabric-cli
|
|
||||||
tty: true
|
|
||||||
environment:
|
|
||||||
- CORE_PEER_ID=fabric-cli
|
|
||||||
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051 # default to operate on peer0.org1
|
|
||||||
- CORE_PEER_LOCALMSPID=Org1MSP
|
|
||||||
- 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
|
|
||||||
volumes:
|
|
||||||
- ./scripts:/tmp/scripts
|
|
||||||
- ./kafka/channel-artifacts:/tmp/channel-artifacts
|
|
||||||
- ./kafka/configtx.yaml:/etc/hyperledger/fabric/configtx.yaml
|
|
||||||
- ./kafka/crypto-config.yaml:/etc/hyperledger/fabric/crypto-config.yaml
|
|
||||||
- ./kafka/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto
|
|
||||||
- ./kafka/examples:/opt/gopath/src/github.com/hyperledger/fabric/examples
|
|
||||||
|
|
||||||
## following are peer nodes ##
|
|
||||||
|
|
||||||
peer0.org1.example.com:
|
|
||||||
extends:
|
|
||||||
file: base.yaml
|
|
||||||
service: peer-base
|
|
||||||
container_name: peer0.org1.example.com
|
|
||||||
hostname: peer0.org1.example.com
|
|
||||||
environment:
|
|
||||||
- CORE_PEER_ID=peer0.org1.example.com
|
|
||||||
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
|
|
||||||
- CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7052
|
|
||||||
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
|
|
||||||
- CORE_PEER_LOCALMSPID=Org1MSP
|
|
||||||
volumes:
|
|
||||||
- ./kafka/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp
|
|
||||||
- ./kafka/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls
|
|
||||||
ports:
|
|
||||||
- 7051:7051
|
|
||||||
- 7052:7052
|
|
||||||
- 7053:7053
|
|
||||||
|
|
||||||
peer1.org1.example.com:
|
|
||||||
extends:
|
|
||||||
file: base.yaml
|
|
||||||
service: peer-base
|
|
||||||
container_name: peer1.org1.example.com
|
|
||||||
hostname: peer1.org1.example.com
|
|
||||||
environment:
|
|
||||||
- CORE_PEER_ID=peer1.org1.example.com
|
|
||||||
- CORE_PEER_ADDRESS=peer1.org1.example.com:7051
|
|
||||||
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7051
|
|
||||||
- CORE_PEER_CHAINCODELISTENADDRESS=peer1.org1.example.com:7052
|
|
||||||
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051
|
|
||||||
- CORE_PEER_LOCALMSPID=Org1MSP
|
|
||||||
volumes:
|
|
||||||
- ./kafka/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/msp
|
|
||||||
- ./kafka/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/tls
|
|
||||||
ports:
|
|
||||||
- 8051:7051
|
|
||||||
- 8052:7052
|
|
||||||
- 8053:7053
|
|
||||||
|
|
||||||
peer0.org2.example.com:
|
|
||||||
extends:
|
|
||||||
file: base.yaml
|
|
||||||
service: peer-base
|
|
||||||
container_name: peer0.org2.example.com
|
|
||||||
hostname: peer0.org2.example.com
|
|
||||||
environment:
|
|
||||||
- CORE_PEER_ID=peer0.org2.example.com
|
|
||||||
- CORE_PEER_ADDRESS=peer0.org2.example.com:7051
|
|
||||||
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051
|
|
||||||
- CORE_PEER_CHAINCODELISTENADDRESS=peer0.org2.example.com:7052
|
|
||||||
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:7051
|
|
||||||
- CORE_PEER_LOCALMSPID=Org2MSP
|
|
||||||
volumes:
|
|
||||||
- ./kafka/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp:/etc/hyperledger/fabric/msp
|
|
||||||
- ./kafka/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls
|
|
||||||
ports:
|
|
||||||
- 9051:7051
|
|
||||||
- 9052:7052
|
|
||||||
- 9053:7053
|
|
||||||
|
|
||||||
peer1.org2.example.com:
|
|
||||||
extends:
|
|
||||||
file: base.yaml
|
|
||||||
service: peer-base
|
|
||||||
container_name: peer1.org2.example.com
|
|
||||||
hostname: peer1.org2.example.com
|
|
||||||
environment:
|
|
||||||
- CORE_PEER_ID=peer1.org2.example.com
|
|
||||||
- CORE_PEER_ADDRESS=peer1.org2.example.com:7051
|
|
||||||
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:7051
|
|
||||||
- CORE_PEER_CHAINCODELISTENADDRESS=peer1.org2.example.com:7052
|
|
||||||
- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org2.example.com:7051
|
|
||||||
- CORE_PEER_LOCALMSPID=Org2MSP
|
|
||||||
volumes:
|
|
||||||
- ./kafka/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp:/etc/hyperledger/fabric/msp
|
|
||||||
- ./kafka/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls:/etc/hyperledger/fabric/tls
|
|
||||||
ports:
|
|
||||||
- 10051:7051
|
|
||||||
- 10052:7052
|
|
||||||
- 10053:7053
|
|
||||||
|
|
||||||
|
|
||||||
# ZooKeeper services, at least 3 nodes
|
|
||||||
zookeeper0:
|
|
||||||
extends:
|
|
||||||
file: base.yaml
|
|
||||||
service: zookeeper-base
|
|
||||||
container_name: zookeeper0
|
|
||||||
hostname: zookeeper0
|
|
||||||
environment:
|
|
||||||
- ZOO_MY_ID=1
|
|
||||||
- ZOO_SERVERS=server.1=zookeeper0:2888:3888 server.2=zookeeper1:2888:3888 server.3=zookeeper2:2888:3888
|
|
||||||
|
|
||||||
zookeeper1:
|
|
||||||
extends:
|
|
||||||
file: base.yaml
|
|
||||||
service: zookeeper-base
|
|
||||||
container_name: zookeeper1
|
|
||||||
hostname: zookeeper1
|
|
||||||
environment:
|
|
||||||
- ZOO_MY_ID=2
|
|
||||||
- ZOO_SERVERS=server.1=zookeeper0:2888:3888 server.2=zookeeper1:2888:3888 server.3=zookeeper2:2888:3888
|
|
||||||
|
|
||||||
zookeeper2:
|
|
||||||
extends:
|
|
||||||
file: base.yaml
|
|
||||||
service: zookeeper-base
|
|
||||||
container_name: zookeeper2
|
|
||||||
hostname: zookeeper2
|
|
||||||
environment:
|
|
||||||
- ZOO_MY_ID=3
|
|
||||||
- ZOO_SERVERS=server.1=zookeeper0:2888:3888 server.2=zookeeper1:2888:3888 server.3=zookeeper2:2888:3888
|
|
||||||
|
|
||||||
# Kafka services, at least 4 node to tolerant work with 1 node failure
|
|
||||||
kafka0:
|
|
||||||
extends:
|
|
||||||
file: base.yaml
|
|
||||||
service: kafka-base
|
|
||||||
container_name: kafka0
|
|
||||||
hostname: kafka0
|
|
||||||
environment:
|
|
||||||
- KAFKA_BROKER_ID=0
|
|
||||||
- KAFKA_MIN_INSYNC_REPLICAS=2
|
|
||||||
- KAFKA_DEFAULT_REPLICATION_FACTOR=3
|
|
||||||
- KAFKA_ZOOKEEPER_CONNECT=zookeeper0:2181,zookeeper1:2181,zookeeper2:2181
|
|
||||||
|
|
||||||
kafka1:
|
|
||||||
extends:
|
|
||||||
file: base.yaml
|
|
||||||
service: kafka-base
|
|
||||||
container_name: kafka1
|
|
||||||
hostname: kafka1
|
|
||||||
environment:
|
|
||||||
- KAFKA_BROKER_ID=1
|
|
||||||
- KAFKA_DEFAULT_REPLICATION_FACTOR=3
|
|
||||||
- KAFKA_MIN_INSYNC_REPLICAS=2
|
|
||||||
- KAFKA_ZOOKEEPER_CONNECT=zookeeper0:2181,zookeeper1:2181,zookeeper2:2181
|
|
||||||
|
|
||||||
kafka2:
|
|
||||||
extends:
|
|
||||||
file: base.yaml
|
|
||||||
service: kafka-base
|
|
||||||
container_name: kafka2
|
|
||||||
hostname: kafka2
|
|
||||||
environment:
|
|
||||||
- KAFKA_BROKER_ID=2
|
|
||||||
- KAFKA_DEFAULT_REPLICATION_FACTOR=3
|
|
||||||
- KAFKA_MIN_INSYNC_REPLICAS=2
|
|
||||||
- KAFKA_ZOOKEEPER_CONNECT=zookeeper0:2181,zookeeper1:2181,zookeeper2:2181
|
|
||||||
|
|
||||||
kafka3:
|
|
||||||
extends:
|
|
||||||
file: base.yaml
|
|
||||||
service: kafka-base
|
|
||||||
container_name: kafka3
|
|
||||||
hostname: kafka3
|
|
||||||
environment:
|
|
||||||
- KAFKA_BROKER_ID=3
|
|
||||||
- KAFKA_DEFAULT_REPLICATION_FACTOR=3
|
|
||||||
- KAFKA_MIN_INSYNC_REPLICAS=2
|
|
||||||
- KAFKA_ZOOKEEPER_CONNECT=zookeeper0:2181,zookeeper1:2181,zookeeper2:2181
|
|
Loading…
Reference in New Issue