-
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-4821] Improve configtxlator reconfig examples
This improves the configtxlator README.md to use '.pb' as the suffix for files contain protobuf messages rather than '.proto' which confuses the 'make protos' target. It also improves the scripts for the existing examples, to use common functions and adds an interactive mode which pauses between each step, so that the user may inspect the file artifacts as they are generated. It additionally improves error checking on the output of the assorted commands, as the script would not reliably fail at the error points, but might continue several statements. Finally, it adds a new example for adding an organization to a channel. Change-Id: I5c60cefe364f41dfc0d15c1dc5dd8f9ddc85ea2b Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
- Loading branch information
Jason Yellick
committed
Jun 16, 2017
1 parent
040a9b1
commit 012f721
Showing
7 changed files
with
552 additions
and
130 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
CDIR=$(dirname $(basename "$0")) | ||
|
||
: ${OUTDIR:="example_output"} | ||
mkdir -p ${OUTDIR} || die "could not create output dir ${OUTDIR}" | ||
|
||
GENESIS_BLOCK_PB="${OUTDIR}/genesis_block.pb" | ||
GENESIS_BLOCK_JSON="${OUTDIR}/genesis_block.json" | ||
UPDATED_GENESIS_BLOCK_JSON="${OUTDIR}/updated_genesis_block.json" | ||
UPDATED_GENESIS_BLOCK_PB="${OUTDIR}/updated_genesis_block.pb" | ||
|
||
. ${CDIR}/../common_scripts/common.sh | ||
|
||
findConfigtxgen || die "no configtxgen present" | ||
|
||
bigMsg "Creating bootstrap block" | ||
|
||
echo -e "Executing:\n\tconfigtxgen -outputBlock '${GENESIS_BLOCK_PB}' -profile SampleSingleMSPSolo" | ||
$CONFIGTXGEN -outputBlock "${GENESIS_BLOCK_PB}" -profile SampleSingleMSPSolo 2>/dev/null || die "Error generating genesis block" | ||
|
||
pauseIfInteractive | ||
|
||
bigMsg "Decoding genesis block" | ||
decode common.Block "${GENESIS_BLOCK_PB}" "${GENESIS_BLOCK_JSON}" | ||
|
||
bigMsg "Updating the genesis config" | ||
ORIGINAL_BATCHSIZE=$(jq ".data.data[0].payload.data.config.channel_group.groups.Orderer.values.BatchSize.value.max_message_count" genesis_block.json) | ||
NEW_BATCHSIZE=$(( ${ORIGINAL_BATCHSIZE} + 1 )) | ||
echo "Updating batch size from ${ORIGINAL_BATCHSIZE} to ${NEW_BATCHSIZE}." | ||
echo -e "Executing\n\tjq '.data.data[0].payload.data.config.channel_group.groups.Orderer.values.BatchSize.value.max_message_count = ${NEW_BATCHSIZE}' '${GENESIS_BLOCK_JSON}' > '${UPDATED_GENESIS_BLOCK_JSON}'" | ||
jq ".data.data[0].payload.data.config.channel_group.groups.Orderer.values.BatchSize.value.max_message_count = ${NEW_BATCHSIZE}" "${GENESIS_BLOCK_JSON}" > "${UPDATED_GENESIS_BLOCK_JSON}" | ||
|
||
pauseIfInteractive | ||
|
||
bigMsg "Re-encoding the updated genesis block" | ||
|
||
encode common.Block "${UPDATED_GENESIS_BLOCK_JSON}" "${UPDATED_GENESIS_BLOCK_PB}" | ||
|
||
bigMsg "Bootstrapping edit complete" |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.