-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FAB-2439] Add sample genesis profile for Kafka
https://jira.hyperledger.org/browse/FAB-2439 This changeset: 1. Introduces a bare-minimum genesis profile for Kafka 2. Updates the Kafka-related Docker environments under `bddtests` Change-Id: I02c106f181afb38ab2262410baaf05427aa4bb20 Signed-off-by: Kostas Christidis <kostas@christidis.io>
- Loading branch information
1 parent
6daec3f
commit f4448b9
Showing
6 changed files
with
48 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,44 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script will either start the kafka server, or run the user | ||
# This script will either start the Kafka server, or run the user | ||
# specified command. | ||
|
||
# Exit immediately if a pipeline returns a non-zero status. | ||
# exit immediately if a pipeline returns a non-zero status | ||
set -e | ||
|
||
ORDERER_EXE=orderer | ||
KAFKA_GENESIS_PROFILES=(SampleInsecureKafka) | ||
|
||
# handle starting the orderer with an option | ||
if [ "${1:0:1}" = '-' ]; then | ||
set -- ${ORDERER_EXE} "$@" | ||
fi | ||
|
||
# handle default (i.e. no custom options or commands) | ||
# check if the Kafka-based orderer is invoked | ||
if [ "$1" = "${ORDERER_EXE}" ]; then | ||
|
||
case "$ORDERER_GENESIS_ORDERERTYPE" in | ||
solo) | ||
;; | ||
kafka) | ||
# make sure at least one broker has started. | ||
# get the broker list from zookeeper | ||
if [ -z "$ORDERER_KAFKA_BROKERS" ] ; then | ||
if [ -z "$ZOOKEEPER_CONNECT" ] ; then | ||
export ZOOKEEPER_CONNECT="zookeeper:2181" | ||
for PROFILE in "${KAFKA_GENESIS_PROFILES[@]}"; do | ||
if [ "$ORDERER_GENERAL_GENESISPROFILE" == "$PROFILE" ] ; then | ||
# make sure at least one broker has started | ||
# get the broker list from ZooKeeper | ||
if [ -z "$CONFIGTX_ORDERER_KAFKA_BROKERS" ] ; then | ||
if [ -z "$ZOOKEEPER_CONNECT" ] ; then | ||
export ZOOKEEPER_CONNECT="zookeeper:2181" | ||
fi | ||
ZK_CLI_EXE="/usr/share/zookeeper/bin/zkCli.sh -server ${ZOOKEEPER_CONNECT}" | ||
until [ -n "$($ZK_CLI_EXE ls /brokers/ids | grep '^\[')" ] ; do | ||
echo "No Kafka brokers registered in ZooKeeper. Will try again in 1 second." | ||
sleep 1 | ||
done | ||
CONFIGTX_ORDERER_KAFKA_BROKERS="[" | ||
CONFIGTX_ORDERER_KAFKA_BROKERS_SEP="" | ||
for BROKER_ID in $($ZK_CLI_EXE ls /brokers/ids | grep '^\[' | sed 's/[][,]/ /g'); do | ||
CONFIGTX_ORDERER_KAFKA_BROKERS=${CONFIGTX_ORDERER_KAFKA_BROKERS}${ORDERER_KAFKA_BROKERS_SEP}$($ZK_CLI_EXE get /brokers/ids/$BROKER_ID 2>&1 | grep '^{' | jq -j '. | .host,":",.port') | ||
CONFIGTX_ORDERER_KAFKA_BROKERS_SEP="," | ||
done | ||
export CONFIGTX_ORDERER_KAFKA_BROKERS="${CONFIGTX_ORDERER_KAFKA_BROKERS}]" | ||
fi | ||
ZK_CLI_EXE="/usr/share/zookeeper/bin/zkCli.sh -server ${ZOOKEEPER_CONNECT}" | ||
until [ -n "$($ZK_CLI_EXE ls /brokers/ids | grep '^\[')" ] ; do | ||
echo "No Kafka brokers registered in ZooKeeper. Will try again in 1 second." | ||
sleep 1 | ||
done | ||
ORDERER_KAFKA_BROKERS="[" | ||
ORDERER_KAFKA_BROKERS_SEP="" | ||
for BROKER_ID in $($ZK_CLI_EXE ls /brokers/ids | grep '^\[' | sed 's/[][,]/ /g'); do | ||
ORDERER_KAFKA_BROKERS=${ORDERER_KAFKA_BROKERS}${ORDERER_KAFKA_BROKERS_SEP}$($ZK_CLI_EXE get /brokers/ids/$BROKER_ID 2>&1 | grep '^{' | jq -j '. | .host,":",.port') | ||
ORDERER_KAFKA_BROKERS_SEP="," | ||
done | ||
export ORDERER_KAFKA_BROKERS="${ORDERER_KAFKA_BROKERS}]" | ||
fi | ||
;; | ||
sbft) | ||
;; | ||
esac | ||
|
||
done | ||
fi | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters