From b62d5bd77b9086fcbd5c14ff7c1431be56545332 Mon Sep 17 00:00:00 2001 From: Simon Stone Date: Fri, 2 Aug 2019 14:15:56 +0100 Subject: [PATCH] [FAB-16132] Remove Kafka consensus from BYFN Remove Kafka as a consensus mechanism option in BYFN, including all related configuration. Users wishing to configure Kafka (not best practice) in Fabric v2.0 can consult the Fabric v1.4 and earlier samples. Signed-off-by: Simon Stone Change-Id: I3bbffc876a6b64831cb6b2bdfac28a88cc013bdf --- ci.properties | 2 +- first-network/base/peer-base.yaml | 2 -- first-network/byfn.sh | 23 +++---------- first-network/configtx.yaml | 33 +------------------ first-network/docker-compose-kafka.yaml | 43 ------------------------- first-network/eyfn.sh | 4 +-- 6 files changed, 7 insertions(+), 100 deletions(-) delete mode 100644 first-network/docker-compose-kafka.yaml diff --git a/ci.properties b/ci.properties index 4f6a530514..a3b65aae1c 100644 --- a/ci.properties +++ b/ci.properties @@ -7,7 +7,7 @@ FAB_IMAGES_LIST=ca peer orderer ccenv tools baseos nodeenv javaenv # Set fabric if you would like pull only fabric binaries FAB_BINARY_REPO=fabric fabric-ca # Pull below list of images from Hyperledger DockerHub -FAB_THIRDPARTY_IMAGES_LIST=kafka zookeeper couchdb +FAB_THIRDPARTY_IMAGES_LIST=couchdb # Pull latest binaries of latest commit of release-1.4 from nexus snapshots # Applicable only when set IMAGE_SOURCE to "nexus" FAB_BINARY_VER=latest diff --git a/first-network/base/peer-base.yaml b/first-network/base/peer-base.yaml index 6f6dd3e12c..a91c407f7b 100644 --- a/first-network/base/peer-base.yaml +++ b/first-network/base/peer-base.yaml @@ -40,8 +40,6 @@ services: - 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] diff --git a/first-network/byfn.sh b/first-network/byfn.sh index 5005609db5..e07b2d729e 100755 --- a/first-network/byfn.sh +++ b/first-network/byfn.sh @@ -48,7 +48,7 @@ function printHelp() { echo " -f - specify which docker-compose file use (defaults to docker-compose-cli.yaml)" echo " -s - the database backend to use: goleveldb (default) or couchdb" echo " -l - the programming language of the chaincode to deploy: go (default), javascript, or java" - echo " -o - the consensus-type of the ordering service: solo (default), kafka, or etcdraft" + echo " -o - the consensus-type of the ordering service: solo (default) or etcdraft" echo " -i - the tag to be used to launch the network (defaults to \"latest\")" echo " -a - launch certificate authorities (no certificate authorities are launched by default)" echo " -n - do not deploy chaincode (abstore chaincode is deployed by default)" @@ -164,9 +164,7 @@ function networkUp() { export BYFN_CA1_PRIVATE_KEY=$(cd crypto-config/peerOrganizations/org1.example.com/ca && ls *_sk) export BYFN_CA2_PRIVATE_KEY=$(cd crypto-config/peerOrganizations/org2.example.com/ca && ls *_sk) fi - if [ "${CONSENSUS_TYPE}" == "kafka" ]; then - COMPOSE_FILES="${COMPOSE_FILES} -f ${COMPOSE_FILE_KAFKA}" - elif [ "${CONSENSUS_TYPE}" == "etcdraft" ]; then + if [ "${CONSENSUS_TYPE}" == "etcdraft" ]; then COMPOSE_FILES="${COMPOSE_FILES} -f ${COMPOSE_FILE_RAFT2}" fi if [ "${IF_COUCHDB}" == "couchdb" ]; then @@ -179,12 +177,6 @@ function networkUp() { exit 1 fi - if [ "$CONSENSUS_TYPE" == "kafka" ]; then - sleep 1 - echo "Sleeping 10s to allow $CONSENSUS_TYPE cluster to complete booting" - sleep 9 - fi - if [ "$CONSENSUS_TYPE" == "etcdraft" ]; then sleep 1 echo "Sleeping 15s to allow $CONSENSUS_TYPE cluster to complete booting" @@ -222,9 +214,7 @@ function upgradeNetwork() { export BYFN_CA1_PRIVATE_KEY=$(cd crypto-config/peerOrganizations/org1.example.com/ca && ls *_sk) export BYFN_CA2_PRIVATE_KEY=$(cd crypto-config/peerOrganizations/org2.example.com/ca && ls *_sk) fi - if [ "${CONSENSUS_TYPE}" == "kafka" ]; then - COMPOSE_FILES="${COMPOSE_FILES} -f ${COMPOSE_FILE_KAFKA}" - elif [ "${CONSENSUS_TYPE}" == "etcdraft" ]; then + if [ "${CONSENSUS_TYPE}" == "etcdraft" ]; then COMPOSE_FILES="${COMPOSE_FILES} -f ${COMPOSE_FILE_RAFT2}" fi if [ "${IF_COUCHDB}" == "couchdb" ]; then @@ -274,8 +264,7 @@ function upgradeNetwork() { # Tear down running network function networkDown() { # stop org3 containers also in addition to org1 and org2, in case we were running sample to add org3 - # stop kafka and zookeeper containers in case we're running with kafka consensus-type - docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH -f $COMPOSE_FILE_KAFKA -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_CA -f $COMPOSE_FILE_ORG3 down --volumes --remove-orphans + docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_CA -f $COMPOSE_FILE_ORG3 down --volumes --remove-orphans # Don't remove the generated artifacts -- note, the ledgers are always removed if [ "$MODE" != "restart" ]; then @@ -425,8 +414,6 @@ function generateChannelArtifacts() { set -x if [ "$CONSENSUS_TYPE" == "solo" ]; then configtxgen -profile TwoOrgsOrdererGenesis -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block - elif [ "$CONSENSUS_TYPE" == "kafka" ]; then - configtxgen -profile SampleDevModeKafka -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block elif [ "$CONSENSUS_TYPE" == "etcdraft" ]; then configtxgen -profile SampleMultiNodeEtcdRaft -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block else @@ -495,8 +482,6 @@ COMPOSE_FILE=docker-compose-cli.yaml COMPOSE_FILE_COUCH=docker-compose-couch.yaml # org3 docker compose file COMPOSE_FILE_ORG3=docker-compose-org3.yaml -# kafka and zookeeper compose file -COMPOSE_FILE_KAFKA=docker-compose-kafka.yaml # two additional etcd/raft orderers COMPOSE_FILE_RAFT2=docker-compose-etcdraft2.yaml # certificate authorities compose file diff --git a/first-network/configtx.yaml b/first-network/configtx.yaml index 4a0c4e884e..0363a661fd 100644 --- a/first-network/configtx.yaml +++ b/first-network/configtx.yaml @@ -220,7 +220,7 @@ Application: &ApplicationDefaults Orderer: &OrdererDefaults # Orderer Type: The orderer implementation to start - # Available types are "solo" and "kafka" + # Available types are "solo" and "etcdraft" OrdererType: solo Addresses: @@ -244,12 +244,6 @@ Orderer: &OrdererDefaults # max bytes will result in a batch larger than preferred max bytes. PreferredMaxBytes: 512 KB - Kafka: - # Brokers: A list of Kafka brokers to which the orderer connects - # NOTE: Use IP:port notation - Brokers: - - 127.0.0.1:9092 - # Organizations is the list of orgs which are defined as participants on # the orderer side of the network Organizations: @@ -339,31 +333,6 @@ Profiles: Capabilities: <<: *ApplicationCapabilities - SampleDevModeKafka: - <<: *ChannelDefaults - Capabilities: - <<: *ChannelCapabilities - Orderer: - <<: *OrdererDefaults - OrdererType: kafka - Kafka: - Brokers: - - kafka.example.com:9092 - - Organizations: - - *OrdererOrg - Capabilities: - <<: *OrdererCapabilities - Application: - <<: *ApplicationDefaults - Organizations: - - <<: *OrdererOrg - Consortiums: - SampleConsortium: - Organizations: - - *Org1 - - *Org2 - SampleMultiNodeEtcdRaft: <<: *ChannelDefaults Capabilities: diff --git a/first-network/docker-compose-kafka.yaml b/first-network/docker-compose-kafka.yaml deleted file mode 100644 index 06deac8515..0000000000 --- a/first-network/docker-compose-kafka.yaml +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - - -# NOTE: This is not the way a Kafka cluster would normally be deployed in production, as it is not secure -# and is not fault tolerant. This example is a toy deployment that is only meant to exercise the Kafka code path -# of the ordering service. - -version: '2' - -networks: - byfn: - -services: - zookeeper.example.com: - container_name: zookeeper.example.com - image: hyperledger/fabric-zookeeper:$IMAGE_TAG - environment: - ZOOKEEPER_CLIENT_PORT: 32181 - ZOOKEEPER_TICK_TIME: 2000 - networks: - - byfn - - kafka.example.com: - container_name: kafka.example.com - image: hyperledger/fabric-kafka:$IMAGE_TAG - depends_on: - - zookeeper.example.com - environment: - - KAFKA_BROKER_ID=1 - - KAFKA_ZOOKEEPER_CONNECT=zookeeper.example.com:2181 - - KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka.example.com:9092 - - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 - - KAFKA_MESSAGE_MAX_BYTES=1048576 # 1 * 1024 * 1024 B - - KAFKA_REPLICA_FETCH_MAX_BYTES=1048576 # 1 * 1024 * 1024 B - - KAFKA_UNCLEAN_LEADER_ELECTION_ENABLE=false - - KAFKA_LOG_RETENTION_MS=-1 - - KAFKA_MIN_INSYNC_REPLICAS=1 - - KAFKA_DEFAULT_REPLICATION_FACTOR=1 - networks: - - byfn diff --git a/first-network/eyfn.sh b/first-network/eyfn.sh index d6bfab08f2..3758390073 100755 --- a/first-network/eyfn.sh +++ b/first-network/eyfn.sh @@ -127,7 +127,7 @@ function networkUp () { # Tear down running network function networkDown () { - docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_KAFKA -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_ORG3 -f $COMPOSE_FILE_COUCH down --volumes --remove-orphans + docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_ORG3 -f $COMPOSE_FILE_COUCH down --volumes --remove-orphans # Don't remove containers, images, etc if restarting if [ "$MODE" != "restart" ]; then #Cleanup the chaincode containers @@ -233,8 +233,6 @@ COMPOSE_FILE_COUCH=docker-compose-couch.yaml COMPOSE_FILE_ORG3=docker-compose-org3.yaml # COMPOSE_FILE_COUCH_ORG3=docker-compose-couch-org3.yaml -# kafka and zookeeper compose file -COMPOSE_FILE_KAFKA=docker-compose-kafka.yaml # two additional etcd/raft orderers COMPOSE_FILE_RAFT2=docker-compose-etcdraft2.yaml # use go as the default language for chaincode