From 91ea5331cdac8ab27846ed01c58d88897e0091af Mon Sep 17 00:00:00 2001 From: Baohua Yang Date: Mon, 1 Apr 2019 11:10:38 +0800 Subject: [PATCH] Refine with v2.0.0 code --- hyperledger_fabric/latest/.env | 3 +- .../latest/scripts/download_images.sh | 55 ++++++++++--------- .../latest/scripts/variables.sh | 8 +-- hyperledger_fabric/latest/solo/configtx.yaml | 36 ++++++------ 4 files changed, 55 insertions(+), 47 deletions(-) diff --git a/hyperledger_fabric/latest/.env b/hyperledger_fabric/latest/.env index eb5fcedb..85aaa8ee 100644 --- a/hyperledger_fabric/latest/.env +++ b/hyperledger_fabric/latest/.env @@ -1,3 +1,4 @@ +# for docker-compose usage FABRIC_IMG_TAG=latest -EXT_IMG_TAG=amd64-0.4.14 +EXT_IMG_TAG=0.4.15 NETWORK=hlf_net \ No newline at end of file diff --git a/hyperledger_fabric/latest/scripts/download_images.sh b/hyperledger_fabric/latest/scripts/download_images.sh index 91022ede..5a7b17c3 100644 --- a/hyperledger_fabric/latest/scripts/download_images.sh +++ b/hyperledger_fabric/latest/scripts/download_images.sh @@ -1,5 +1,17 @@ #!/usr/bin/env bash +# peer/orderer/ca/ccenv/tools/javaenv/baseos: 1.4, 1.4.0, 1.4.1, 2.0.0, latest +# baseimage (runtime for golang chaincode)/couchdb: 0.4.15, latest +# Noted: +# * the fabric-baseos 1.4/2.0 tags are not available at dockerhub yet, only latest/0.4.15 now +# * the fabric-nodeenv is not available at dockerhub yet + +# In core.yaml, it requires: +# * fabric-ccenv:$(PROJECT_VERSION) +# * fabric-baseos:$(PROJECT_VERSION) +# * fabric-javaenv:latest +# * fabric-nodeenv:latest + # Define those global variables if [ -f ./variables.sh ]; then source ./variables.sh @@ -23,38 +35,29 @@ pull_image() { echo "Downloading images from DockerHub... need a while" # TODO: we may need some checking on pulling result? -echo "=== Pulling fabric images ${FABRIC_IMG_TAG} from yeasy repo... ===" +echo "=== Pulling yeasy/hyperledger-fabric-* images with tag ${FABRIC_IMG_TAG}... ===" for IMG in base peer orderer ca; do - HLF_IMG=yeasy/hyperledger-fabric-${IMG}:$FABRIC_IMG_TAG - pull_image $HLF_IMG + pull_image yeasy/hyperledger-fabric-${IMG}:$FABRIC_IMG_TAG done - pull_image yeasy/hyperledger-fabric:$FABRIC_IMG_TAG -pull_image yeasy/blockchain-explorer:0.1.0-preview # TODO: wait for official images +# pull_image yeasy/blockchain-explorer:0.1.0-preview # TODO: wait for official images +echo "=== Pulling fabric core images ${FABRIC_IMG_TAG} from fabric repo... ===" +for IMG in peer orderer ca ccenv tools baseos javaenv nodeenv; do + pull_image hyperledger/fabric-${IMG}:$FABRIC_IMG_TAG +done +# core.yaml requires a latest tag +pull_image hyperledger/fabric-javaenv:latest +# core.yaml requires a latest tag, but nodeenv is not available in docker hub yet +# pull_image hyperledger/fabric-nodeenv:latest +pull_image hyperledger/fabric-baseos:latest # fabric-baseos does not have 1.4/2.0 tag yet, but core.yaml requires a PROJECT_VERSION tag +docker tag hyperledger/fabric-baseos:latest hyperledger/fabric-baseos:${PROJECT_VERSION} -echo "=== Pulling base images ${BASE_IMG_TAG} from fabric repo... ===" -for IMG in baseimage baseos couchdb kafka zookeeper; do - HLF_IMG=hyperledger/fabric-${IMG}:$ARCH-$BASE_IMG_TAG - pull_image $HLF_IMG +echo "=== Pulling base/3rd-party images with tag ${BASE_IMG_TAG} from fabric repo... ===" +for IMG in baseimage couchdb kafka zookeeper; do + pull_image hyperledger/fabric-${IMG}:$BASE_IMG_TAG done -# TODO: official core.yaml still use PROJECT_VERSION for fabric-baseos, however, dockerhub does not have the version -docker tag hyperledger/fabric-baseos:$ARCH-$BASE_IMG_TAG hyperledger/fabric-baseos:$FABRIC_IMG_TAG - -# Only useful for debugging -# docker pull yeasy/hyperledger-fabric - -echo "=== Pulling fabric images ${FABRIC_IMG_TAG} from fabric repo... ===" -for IMG in peer tools orderer ca ccenv tools; do - if [ "$FABRIC_IMG_TAG" == "latest" ]; then - HLF_IMG=hyperledger/fabric-${IMG}:$FABRIC_IMG_TAG - else - HLF_IMG=hyperledger/fabric-${IMG}:$ARCH-$FABRIC_IMG_TAG - fi - pull_image $HLF_IMG -done - -echo "Image pulling done, now can startup the network using docker-compose..." +echo "Image pulling done, now can startup the network using make start..." exit 0 \ No newline at end of file diff --git a/hyperledger_fabric/latest/scripts/variables.sh b/hyperledger_fabric/latest/scripts/variables.sh index ccb0d6ad..9a884b97 100644 --- a/hyperledger_fabric/latest/scripts/variables.sh +++ b/hyperledger_fabric/latest/scripts/variables.sh @@ -4,14 +4,14 @@ ARCH=amd64 -# for the base images, including baseimage, baseos, couchdb, kafka, zookeeper -BASE_IMG_TAG=0.4.14 +# for the base images, including baseimage, couchdb, kafka, zookeeper +BASE_IMG_TAG=0.4.15 # For fabric images, including peer, orderer, ca FABRIC_IMG_TAG=latest -# Can deprecate now? -PROJECT_VERSION=1.4.0 +# Used in core.yaml +PROJECT_VERSION=2.0.0 # Name of app channel, need to align with the gen_artifacts.sh SYS_CHANNEL="testchainid" diff --git a/hyperledger_fabric/latest/solo/configtx.yaml b/hyperledger_fabric/latest/solo/configtx.yaml index 5bcfdf84..fb5cdbf0 100644 --- a/hyperledger_fabric/latest/solo/configtx.yaml +++ b/hyperledger_fabric/latest/solo/configtx.yaml @@ -13,6 +13,7 @@ # ################################################################################ Organizations: + # SampleOrg defines an MSP using the sampleconfig. It should never be used # in production but may be used as a template for other definitions. - &SampleOrg @@ -289,6 +290,17 @@ Application: &ApplicationDefaults # User's can override these defaults with their own policy mapping by defining the # mapping under ACLs in their channel definition + #---New Lifecycle System Chaincode (_lifecycle) function to policy mapping for access control--# + + # ACL policy for _lifecycle's "CommitChaincodeDefinition" function + _lifecycle/CommitChaincodeDefinition: /Channel/Application/Writers + + # ACL policy for _lifecycle's "QueryChaincodeDefinition" function + _lifecycle/QueryChaincodeDefinition: /Channel/Application/Readers + + # ACL policy for _lifecycle's "QueryNamespaceDefinitions" function + _lifecycle/QueryNamespaceDefinitions: /Channel/Application/Readers + #---Lifecycle System Chaincode (lscc) function to policy mapping for access control---# # ACL policy for lscc's "getid" function @@ -412,7 +424,7 @@ Orderer: &OrdererDefaults # Max Message Count: The maximum number of messages to permit in a # batch. No block will contain more than this number of messages. - MaxMessageCount: 10 + MaxMessageCount: 500 # Absolute Max Bytes: The absolute maximum number of bytes allowed for # the serialized messages in a batch. The maximum block size is this value @@ -434,7 +446,7 @@ Orderer: &OrdererDefaults # will contain only that message. Because messages may be larger than # preferred max bytes (up to AbsoluteMaxBytes), some batches may exceed # the preferred max bytes, but will always contain exactly one transaction. - PreferredMaxBytes: 512 KB + PreferredMaxBytes: 2 MB # Max Channels is the maximum number of channels to allow on the ordering # network. When set to 0, this implies no maximum number of channels. @@ -474,10 +486,8 @@ Orderer: &OrdererDefaults # are the defaults for all new channels and can be modified on a # per-channel basis via configuration updates. Options: - # TickInterval is the time interval between two Node.Tick - # invocations. - # Unit: millisecond - TickInterval: 500 + # TickInterval is the time interval between two Node.Tick invocations. + TickInterval: 500ms # ElectionTick is the number of Node.Tick invocations that must pass # between elections. That is, if a follower does not receive any @@ -491,18 +501,12 @@ Orderer: &OrdererDefaults # messages to maintain its leadership every HeartbeatTick ticks. HeartbeatTick: 1 - # MaxInflightMsgs limits the max number of in-flight append messages + # MaxInflightBlocks limits the max number of in-flight append messages # during optimistic replication phase. - MaxInflightMsgs: 256 + MaxInflightBlocks: 5 - # MaxSizePerMsg limits the max size of each append message. Smaller - # value lowers the raft recovery cost(initial probing and message - # lost during normal operation). On the other side, it might affect - # the throughput during normal replication. - MaxSizePerMsg: 1048576 - - # SnapshotInterval defines number of bytes per which a snapshot is taken - SnapshotInterval: 100 MB + # SnapshotIntervalSize defines number of bytes per which a snapshot is taken + SnapshotIntervalSize: 20 MB # Organizations lists the orgs participating on the orderer side of the # network.