Skip to content

Commit cbf301f

Browse files
committed
minor fixes after the review
Signed-off-by: Sanket Teli <telisanket2002@gmail.com>
1 parent da49380 commit cbf301f

File tree

4 files changed

+17
-36
lines changed

4 files changed

+17
-36
lines changed

src/setup-docker/templates/fabric-docker/.env

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@ FABRIC_CA_POSTGRES_VERSION=<%= fabricCaPostgresVersion %>
1818
FABRIC_CCENV_VERSION=<%= global.fabricCcenvVersion %>
1919
FABRIC_BASEOS_VERSION=<%= global.fabricBaseosVersion %>
2020

21-
22-
FABRIC_JAVAENV_VERSION=3.0-beta
23-
FABRIC_NODEENV_VERSION=2.5
24-
RECOMMENDED_NODE_VERSION=18
25-
21+
FABRIC_JAVAENV_VERSION=<%= global.fabricJavaenvVersion %>
22+
FABRIC_NODEENV_VERSION=<%= global.fabricNodeenvVersion %>
23+
RECOMMENDED_NODE_VERSION=<%= global.fabricRecommendedNodeVersion %>
2624

2725
ROOT_CA_ADMIN_NAME=admin
2826
ROOT_CA_ADMIN_PASSWORD=adminpw

src/setup-docker/templates/fabric-docker/commands-generated.sh

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,14 @@ generateChannelsArtifacts() {
4242
}
4343
4444
installChannels() {
45-
set -x
4645
<% if (!channels || !channels.length) { -%>
47-
4846
echo "No channels"
4947
<% } else if (global.capabilities.isV3) { -%>
5048
<% channels.forEach((channel) => { -%>
5149
<% channel.ordererGroup.orderers.forEach((orderer) => { -%>
5250
<% const org = orgs.find((org) => org.name === orderer.orgName); -%>
53-
docker exec -i <%= org.cli.address %> bash -c <% -%>
54-
"source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= orderer.orgMspName %>' '<%= orderer.address %>:<%= orderer.adminPort %>' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.crt' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.key' 'crypto-orderer/tlsca.<%= orderer.domain %>-cert.pem';"
51+
docker exec -i <%= org.cli.address %> bash -c <% -%>
52+
"source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= orderer.orgMspName %>' '<%= orderer.address %>:<%= orderer.adminPort %>' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.crt' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.key' 'crypto-orderer/tlsca.<%= orderer.domain %>-cert.pem';"
5553
<% }) -%>
5654
<% if (channel.ordererGroup.consensus !== "BFT") { -%>
5755
sleep 4 # Wait for Raft cluster to establish consensus
@@ -115,12 +113,12 @@ installChaincodes() {
115113
<% } else { -%>
116114
<% chaincodes.forEach((chaincode) => { -%>
117115
if [ -n "$(ls "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>")" ]; then
118-
<% if (global.peerDevMode) { -%>
119-
<%- include('commands-generated/chaincode-dev-v2.sh', { chaincode }); -%>
120-
<% } else { -%>
121-
local version="<%= chaincode.version %>"
122-
<%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); -%>
123-
<% } -%>
116+
<% if (global.peerDevMode) { -%>
117+
<%- include('commands-generated/chaincode-dev-v2.sh', { chaincode }); -%>
118+
<% } else { -%>
119+
local version="<%= chaincode.version %>"
120+
<%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); -%>
121+
<% } -%>
124122
else
125123
echo "Warning! Skipping chaincode '<%= chaincode.name %>' installation. Chaincode directory is empty."
126124
echo "Looked in dir: '$CHAINCODES_BASE_DIR/<%= chaincode.directory %>'"
@@ -201,22 +199,22 @@ notifyOrgsAboutChannels() {
201199
printHeadline "Notyfing orgs about channels" "U1F4E2"
202200
<% channels.forEach((channel) => { -%>
203201
<% channel.orgs.forEach((org) => { -%>
204-
<% if(!global.tls) { -%>
205-
notifyOrgAboutNewChannel <% -%>
202+
<% if(!global.tls) { -%>
203+
notifyOrgAboutNewChannel <% -%>
206204
"<%= channel.name %>" <% -%>
207205
"<%= org.mspName %>" <% -%>
208206
"<%= org.cli.address %>" <% -%>
209207
"peer0.<%= org.domain %>" <% -%>
210208
"<%= channel.ordererHead.fullAddress %>"
211-
<% } else { -%>
212-
notifyOrgAboutNewChannelTls <% -%>
209+
<% } else { -%>
210+
notifyOrgAboutNewChannelTls <% -%>
213211
"<%= channel.name %>" <% -%>
214212
"<%= org.mspName %>" <% -%>
215213
"<%= org.cli.address %>" <% -%>
216214
"peer0.<%= org.domain %>" <% -%>
217215
"<%= channel.ordererHead.fullAddress %>" <% -%>
218216
"crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem"
219-
<% } -%>
217+
<% } -%>
220218
<% }) -%>
221219
<% }) %>
222220
@@ -228,7 +226,7 @@ notifyOrgsAboutChannels() {
228226
<% }) -%>
229227
230228
<% } else { %>
231-
echo ""
229+
echo ""
232230
<% } %>
233231
234232
}

src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,30 +96,24 @@ createChannelTx() {
9696

9797
docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME
9898

99-
10099
docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME
101100
docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME
102101

103-
104102
removeContainer $CONTAINER_NAME
105103
}
106104

107105
createNewChannelUpdateTx() {
108106
local CONTAINER_NAME=createAnchorPeerUpdateTx
109-
110107
local CHANNEL_NAME=$1
111108
local MSP_NAME=$2
112109
local CONFIG_PROFILE=$3
113110
local CONFIG_PATH=$4
114111
local OUTPUT_PATH=$5
115112

116-
117113
ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.tx"
118114
OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/${MSP_NAME}anchors.tx"
119115
CONTAINER_COPY_PATH="${CONTAINER_NAME}:/config/${MSP_NAME}anchors.tx"
120116

121-
122-
123117
echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..."
124118
inputLog "CHANNEL_NAME: $CHANNEL_NAME"
125119
inputLog "MSP_NAME: $MSP_NAME"

src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v2.sh

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ set -eu
44

55
createChannelAndJoin() {
66
local CHANNEL_NAME=$1
7-
87
local CORE_PEER_LOCALMSPID=$2
98
local CORE_PEER_ADDRESS=$3
109
local CORE_PEER_MSPCONFIGPATH=$(realpath "$4")
11-
1210
local ORDERER_URL=$5
1311

1412
local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS
@@ -21,7 +19,6 @@ createChannelAndJoin() {
2119

2220
mkdir "$DIR_NAME" && cd "$DIR_NAME"
2321

24-
2522
cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx .
2623
peer channel create -o "${ORDERER_URL}" -c "${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx
2724
peer channel join -b "${CHANNEL_NAME}".block
@@ -31,7 +28,6 @@ createChannelAndJoin() {
3128

3229
createChannelAndJoinTls() {
3330
local CHANNEL_NAME=$1
34-
3531
local CORE_PEER_LOCALMSPID=$2
3632
local CORE_PEER_ADDRESS=$3
3733
local CORE_PEER_MSPCONFIGPATH=$(realpath "$4")
@@ -57,8 +53,6 @@ createChannelAndJoinTls() {
5753

5854
mkdir "$DIR_NAME" && cd "$DIR_NAME"
5955

60-
61-
6256
cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx .
6357

6458
peer channel create -o "${ORDERER_URL}" -c "${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx --tls --cafile "$TLS_CA_CERT_PATH"
@@ -70,11 +64,9 @@ createChannelAndJoinTls() {
7064

7165
fetchChannelAndJoin() {
7266
local CHANNEL_NAME=$1
73-
7467
local CORE_PEER_LOCALMSPID=$2
7568
local CORE_PEER_ADDRESS=$3
7669
local CORE_PEER_MSPCONFIGPATH=$(realpath "$4")
77-
7870
local ORDERER_URL=$5
7971

8072
local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS
@@ -95,7 +87,6 @@ fetchChannelAndJoin() {
9587

9688
fetchChannelAndJoinTls() {
9789
local CHANNEL_NAME=$1
98-
9990
local CORE_PEER_LOCALMSPID=$2
10091
local CORE_PEER_ADDRESS=$3
10192
local CORE_PEER_MSPCONFIGPATH=$(realpath "$4")

0 commit comments

Comments
 (0)