Fix: Cannot launch chaincode in nano bash in Linux (#468)

CHAINCODEADDRESS is set to host.docker.internal which is
only available in MAC and Windows environments.
For that reason, it cannot launch chaincode on Linux.
This PR sets CHAINCODEADDRESS to 127.0.0.1 instead of
host.docker.internal.

Signed-off-by: Nao Nishijima <nao.nishijima.xt@hitachi.com>
This commit is contained in:
nao 2021-10-06 21:34:04 +09:00 committed by GitHub
parent 56a1bf3e19
commit 216d422f11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 4 deletions

View file

@ -1,6 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
if [ "$(uname)" == "Linux" ] ; then
CCADDR="127.0.0.1"
else
CCADDR="host.docker.internal"
fi
# look for binaries in local dev environment /build/bin directory and then in local samples /bin directory # look for binaries in local dev environment /build/bin directory and then in local samples /bin directory
export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH" export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH"
export FABRIC_CFG_PATH="${PWD}"/../config export FABRIC_CFG_PATH="${PWD}"/../config
@ -13,7 +19,7 @@ export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org1
export CORE_PEER_ID=peer0.org1.example.com export CORE_PEER_ID=peer0.org1.example.com
export CORE_PEER_ADDRESS=127.0.0.1:7051 export CORE_PEER_ADDRESS=127.0.0.1:7051
export CORE_PEER_LISTENADDRESS=127.0.0.1:7051 export CORE_PEER_LISTENADDRESS=127.0.0.1:7051
export CORE_PEER_CHAINCODEADDRESS=host.docker.internal:7052 export CORE_PEER_CHAINCODEADDRESS="${CCADDR}":7052
export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7052 export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7052
# bootstrap peer is the other peer in the same org # bootstrap peer is the other peer in the same org
export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7053 export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7053

View file

@ -1,6 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
if [ "$(uname)" == "Linux" ] ; then
CCADDR="127.0.0.1"
else
CCADDR="host.docker.internal"
fi
# look for binaries in local dev environment /build/bin directory and then in local samples /bin directory # look for binaries in local dev environment /build/bin directory and then in local samples /bin directory
export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH" export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH"
export FABRIC_CFG_PATH="${PWD}"/../config export FABRIC_CFG_PATH="${PWD}"/../config
@ -13,7 +19,7 @@ export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org1
export CORE_PEER_ID=peer1.org1.example.com export CORE_PEER_ID=peer1.org1.example.com
export CORE_PEER_ADDRESS=127.0.0.1:7053 export CORE_PEER_ADDRESS=127.0.0.1:7053
export CORE_PEER_LISTENADDRESS=127.0.0.1:7053 export CORE_PEER_LISTENADDRESS=127.0.0.1:7053
export CORE_PEER_CHAINCODEADDRESS=host.docker.internal:7054 export CORE_PEER_CHAINCODEADDRESS="${CCADDR}":7054
export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7054 export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7054
# bootstrap peer is the other peer in the same org # bootstrap peer is the other peer in the same org
export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7051 export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7051

View file

@ -1,6 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
if [ "$(uname)" == "Linux" ] ; then
CCADDR="127.0.0.1"
else
CCADDR="host.docker.internal"
fi
# look for binaries in local dev environment /build/bin directory and then in local samples /bin directory # look for binaries in local dev environment /build/bin directory and then in local samples /bin directory
export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH" export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH"
export FABRIC_CFG_PATH="${PWD}"/../config export FABRIC_CFG_PATH="${PWD}"/../config
@ -13,7 +19,7 @@ export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org2
export CORE_PEER_ID=peer0.org2.example.com export CORE_PEER_ID=peer0.org2.example.com
export CORE_PEER_ADDRESS=127.0.0.1:7055 export CORE_PEER_ADDRESS=127.0.0.1:7055
export CORE_PEER_LISTENADDRESS=127.0.0.1:7055 export CORE_PEER_LISTENADDRESS=127.0.0.1:7055
export CORE_PEER_CHAINCODEADDRESS=host.docker.internal:7056 export CORE_PEER_CHAINCODEADDRESS="${CCADDR}":7056
export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7056 export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7056
# bootstrap peer is the other peer in the same org # bootstrap peer is the other peer in the same org
export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7057 export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7057

View file

@ -1,6 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
if [ "$(uname)" == "Linux" ] ; then
CCADDR="127.0.0.1"
else
CCADDR="host.docker.internal"
fi
# look for binaries in local dev environment /build/bin directory and then in local samples /bin directory # look for binaries in local dev environment /build/bin directory and then in local samples /bin directory
export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH" export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH"
export FABRIC_CFG_PATH="${PWD}"/../config export FABRIC_CFG_PATH="${PWD}"/../config
@ -13,7 +19,7 @@ export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org2
export CORE_PEER_ID=peer0.org2.example.com export CORE_PEER_ID=peer0.org2.example.com
export CORE_PEER_ADDRESS=127.0.0.1:7057 export CORE_PEER_ADDRESS=127.0.0.1:7057
export CORE_PEER_LISTENADDRESS=127.0.0.1:7057 export CORE_PEER_LISTENADDRESS=127.0.0.1:7057
export CORE_PEER_CHAINCODEADDRESS=host.docker.internal:7058 export CORE_PEER_CHAINCODEADDRESS="${CCADDR}":7058
export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7058 export CORE_PEER_CHAINCODELISTENADDRESS=127.0.0.1:7058
# bootstrap peer is the other peer in the same org # bootstrap peer is the other peer in the same org
export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7055 export CORE_PEER_GOSSIP_BOOTSTRAP=127.0.0.1:7055