-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tools): fabric AIO fabric-samples v2.2.0 breaking change #632
Primary change ============ Not sure how exactly, but the rug got pulled from under our image build despite it specifying all tags/versions for fabric explicitly. Suspicion right now is that the release tags were force pushed to something new which no longer supported the fabcar example chaincode that we were depending on. Evidence to the above is also that our old image works just fine that was built back in December 2020 (who knew 2020 was going to be the year we depend on for stability...) The fix itself: Migrated over the image to be compatible with the 2.x fabric-samples code which meant no more fabcar instead of which we now have the basic asset transfer chaincode that gets deployed by default and then also serves as the backbone for the healthchecks. Secondary/misc. changes ==================== Updated the README.md file of the fabric AIO image to state that it's using fabric-samples interanlly instead of a hand-rolled deployment (which is what we had in the very early phases of the Fabric AIO, but that's long gone by now so the README update was badly needed) Updated the example build commands to use DOCKER_BUILDKIT=1 where applicable because it is much faster than the old builder so people should probably use it. Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
- Loading branch information
Showing
4 changed files
with
129 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
if echo ${FABRIC_VERSION} | grep 2. | ||
then | ||
cd fabric-samples/test-network | ||
export PATH=${PWD}/../bin:${PWD}:$PATH | ||
export FABRIC_CFG_PATH=$PWD/../config/ | ||
# for peer command issued to peer0.org1.example.com | ||
export CORE_PEER_TLS_ENABLED=true | ||
export CORE_PEER_LOCALMSPID="Org1MSP" | ||
export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt | ||
export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp | ||
export CORE_PEER_ADDRESS=localhost:7051 | ||
peer chaincode query --channelID mychannel --name fabcar --ctor '{"Args": [], "Function": "queryAllCars"}' | ||
elif echo ${FABRIC_VERSION} | grep 1. | ||
then | ||
#!/bin/sh | ||
|
||
# Needed so that we have the "peer" binary on our path | ||
export PATH=/fabric-samples/bin/:$PATH | ||
|
||
# Source the utility that we use to parse semantic version strings in bash | ||
. /semver.sh | ||
|
||
function main() | ||
{ | ||
local MAJOR=0 | ||
local MINOR=0 | ||
local PATCH=0 | ||
local SPECIAL="" | ||
semverParseInto "${FABRIC_VERSION}" MAJOR MINOR PATCH SPECIAL | ||
|
||
if [ "$MAJOR" -gt 1 ]; then | ||
# Major version is 2 or newer (we'll deal with 3.x when it is released) | ||
cd /fabric-samples/test-network/ | ||
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"InitLedger","Args":[]}' | ||
else | ||
# Major version is 1.x or earlier (assumption is 1.4.x only) | ||
docker exec cli peer chaincode query --channelID mychannel --name fabcar --ctor '{"Args": [], "Function": "queryAllCars"}' | ||
else | ||
echo "Unsupported fabric version." | ||
fi | ||
fi | ||
} | ||
|
||
main |
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,6 +1,44 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
/bootstrap.sh ${FABRIC_VERSION} ${CA_VERSION} -b -s | ||
cd /fabric-samples/fabcar/ | ||
./startFabric.sh | ||
# Needed so that we have the "peer" binary on our path | ||
export PATH=/fabric-samples/bin/:$PATH | ||
|
||
# Source the utility that we use to parse semantic version strings in bash | ||
. /semver.sh | ||
|
||
function main() | ||
{ | ||
|
||
local MAJOR=0 | ||
local MINOR=0 | ||
local PATCH=0 | ||
local SPECIAL="" | ||
semverParseInto "${FABRIC_VERSION}" MAJOR MINOR PATCH SPECIAL | ||
|
||
tar -cC '/etc/hyperledger/fabric/' . | docker load | ||
|
||
/bootstrap.sh ${FABRIC_VERSION} ${CA_VERSION} -b -s | ||
|
||
echo "[FabricAIO] >>> Parsed MAJOR version of Fabric as ${MAJOR}" | ||
|
||
if [ "$MAJOR" -gt 1 ]; then | ||
# Major version is 2 or newer (we'll deal with 3.x when it is released) | ||
cd /fabric-samples/test-network/ | ||
echo "[FabricAIO] >>> pulling up test network..." | ||
./network.sh up -ca | ||
echo "[FabricAIO] >>> test network pulled up OK." | ||
./network.sh createChannel -c mychannel | ||
echo "[FabricAIO] >>> channel created OK." | ||
./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go | ||
echo "[FabricAIO] >>> contract deployed OK." | ||
echo "[FabricAIO] >>> container healthcheck should begin passing in about 5-15 seconds..." | ||
else | ||
# Major version is 1.x or earlier (assumption is 1.4.x only) | ||
cd /fabric-samples/fabcar/ | ||
./startFabric.sh | ||
fi | ||
|
||
} | ||
|
||
main |