From f942010fa64386dfa4fbf60fe39cd46815a8235d Mon Sep 17 00:00:00 2001 From: Simon Stone Date: Thu, 21 Feb 2019 14:57:39 +0000 Subject: [PATCH] [FAB-14268] Make BYFN/EYFN ports match external ports Update both BYFN and EYFN so that the peer request and chaincode ports match the externally mapped ports. This enables applications both inside and outside the Docker network to use service discovery to interact with these networks (see the JIRA for more details). Change-Id: I73c36dfdb269ec4225376fb04b1e7a087363e4cc Signed-off-by: Simon Stone --- first-network/.gitignore | 2 ++ first-network/base/docker-compose-base.yaml | 40 ++++++++++++--------- first-network/configtx.yaml | 2 +- first-network/docker-compose-org3.yaml | 25 +++++++------ first-network/org3-artifacts/configtx.yaml | 2 +- first-network/scripts/utils.sh | 13 +++---- 6 files changed, 50 insertions(+), 34 deletions(-) diff --git a/first-network/.gitignore b/first-network/.gitignore index 715dcea0..4888c4c2 100644 --- a/first-network/.gitignore +++ b/first-network/.gitignore @@ -4,3 +4,5 @@ /docker-compose-e2e.yaml /ledgers /ledgers-backup +/channel-artifacts/*.json +/org3-artifacts/crypto-config/* \ No newline at end of file diff --git a/first-network/base/docker-compose-base.yaml b/first-network/base/docker-compose-base.yaml index 756ac97a..1de6d1a7 100644 --- a/first-network/base/docker-compose-base.yaml +++ b/first-network/base/docker-compose-base.yaml @@ -42,7 +42,10 @@ services: environment: - CORE_PEER_ID=peer0.org1.example.com - CORE_PEER_ADDRESS=peer0.org1.example.com:7051 - - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org1.example.com:7051 + - CORE_PEER_LISTENADDRESS=0.0.0.0:7051 + - CORE_PEER_CHAINCODEADDRESS=peer0.org1.example.com:7052 + - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052 + - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org1.example.com:8051 - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051 - CORE_PEER_LOCALMSPID=Org1MSP volumes: @@ -52,7 +55,6 @@ services: - peer0.org1.example.com:/var/hyperledger/production ports: - 7051:7051 - - 7053:7053 peer1.org1.example.com: container_name: peer1.org1.example.com @@ -61,8 +63,11 @@ services: service: peer-base environment: - CORE_PEER_ID=peer1.org1.example.com - - CORE_PEER_ADDRESS=peer1.org1.example.com:7051 - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7051 + - CORE_PEER_ADDRESS=peer1.org1.example.com:8051 + - CORE_PEER_LISTENADDRESS=0.0.0.0:8051 + - CORE_PEER_CHAINCODEADDRESS=peer1.org1.example.com:8052 + - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:8052 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:8051 - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051 - CORE_PEER_LOCALMSPID=Org1MSP volumes: @@ -72,8 +77,7 @@ services: - peer1.org1.example.com:/var/hyperledger/production ports: - - 8051:7051 - - 8053:7053 + - 8051:8051 peer0.org2.example.com: container_name: peer0.org2.example.com @@ -82,9 +86,12 @@ services: service: peer-base environment: - CORE_PEER_ID=peer0.org2.example.com - - CORE_PEER_ADDRESS=peer0.org2.example.com:7051 - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051 - - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org2.example.com:7051 + - CORE_PEER_ADDRESS=peer0.org2.example.com:9051 + - CORE_PEER_LISTENADDRESS=0.0.0.0:9051 + - CORE_PEER_CHAINCODEADDRESS=peer0.org2.example.com:9052 + - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:9052 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:9051 + - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org2.example.com:10051 - CORE_PEER_LOCALMSPID=Org2MSP volumes: - /var/run/:/host/var/run/ @@ -92,8 +99,7 @@ services: - ../crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls - peer0.org2.example.com:/var/hyperledger/production ports: - - 9051:7051 - - 9053:7053 + - 9051:9051 peer1.org2.example.com: container_name: peer1.org2.example.com @@ -102,9 +108,12 @@ services: service: peer-base environment: - CORE_PEER_ID=peer1.org2.example.com - - CORE_PEER_ADDRESS=peer1.org2.example.com:7051 - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:7051 - - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:7051 + - CORE_PEER_ADDRESS=peer1.org2.example.com:10051 + - CORE_PEER_LISTENADDRESS=0.0.0.0:10051 + - CORE_PEER_CHAINCODEADDRESS=peer1.org2.example.com:10052 + - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:10052 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:10051 + - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:9051 - CORE_PEER_LOCALMSPID=Org2MSP volumes: - /var/run/:/host/var/run/ @@ -112,5 +121,4 @@ services: - ../crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls:/etc/hyperledger/fabric/tls - peer1.org2.example.com:/var/hyperledger/production ports: - - 10051:7051 - - 10053:7053 + - 10051:10051 diff --git a/first-network/configtx.yaml b/first-network/configtx.yaml index 3d29ebfc..41783349 100644 --- a/first-network/configtx.yaml +++ b/first-network/configtx.yaml @@ -102,7 +102,7 @@ Organizations: # for cross org gossip communication. Note, this value is only # encoded in the genesis block in the Application section context - Host: peer0.org2.example.com - Port: 7051 + Port: 9051 ################################################################################ # diff --git a/first-network/docker-compose-org3.yaml b/first-network/docker-compose-org3.yaml index 71475ce6..20aa79cf 100644 --- a/first-network/docker-compose-org3.yaml +++ b/first-network/docker-compose-org3.yaml @@ -21,8 +21,12 @@ services: service: peer-base environment: - CORE_PEER_ID=peer0.org3.example.com - - CORE_PEER_ADDRESS=peer0.org3.example.com:7051 - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org3.example.com:7051 + - CORE_PEER_ADDRESS=peer0.org3.example.com:11051 + - CORE_PEER_LISTENADDRESS=0.0.0.0:11051 + - CORE_PEER_CHAINCODEADDRESS=peer0.org3.example.com:11052 + - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:11052 + - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org3.example.com:12051 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org3.example.com:11051 - CORE_PEER_LOCALMSPID=Org3MSP volumes: - /var/run/:/host/var/run/ @@ -30,8 +34,7 @@ services: - ./org3-artifacts/crypto-config/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls:/etc/hyperledger/fabric/tls - peer0.org3.example.com:/var/hyperledger/production ports: - - 11051:7051 - - 11053:7053 + - 11051:11051 networks: - byfn @@ -42,9 +45,12 @@ services: service: peer-base environment: - CORE_PEER_ID=peer1.org3.example.com - - CORE_PEER_ADDRESS=peer1.org3.example.com:7051 - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org3.example.com:7051 - - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org3.example.com:7051 + - CORE_PEER_ADDRESS=peer1.org3.example.com:12051 + - CORE_PEER_LISTENADDRESS=0.0.0.0:12051 + - CORE_PEER_CHAINCODEADDRESS=peer1.org3.example.com:12052 + - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:12052 + - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org3.example.com:11051 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org3.example.com:12051 - CORE_PEER_LOCALMSPID=Org3MSP volumes: - /var/run/:/host/var/run/ @@ -52,8 +58,7 @@ services: - ./org3-artifacts/crypto-config/peerOrganizations/org3.example.com/peers/peer1.org3.example.com/tls:/etc/hyperledger/fabric/tls - peer1.org3.example.com:/var/hyperledger/production ports: - - 12051:7051 - - 12053:7053 + - 12051:12051 networks: - byfn @@ -69,7 +74,7 @@ services: - FABRIC_LOGGING_SPEC=INFO #- FABRIC_LOGGING_SPEC=DEBUG - CORE_PEER_ID=Org3cli - - CORE_PEER_ADDRESS=peer0.org3.example.com:7051 + - CORE_PEER_ADDRESS=peer0.org3.example.com:11051 - CORE_PEER_LOCALMSPID=Org3MSP - CORE_PEER_TLS_ENABLED=true - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/server.crt diff --git a/first-network/org3-artifacts/configtx.yaml b/first-network/org3-artifacts/configtx.yaml index e1205455..ab3c81a7 100644 --- a/first-network/org3-artifacts/configtx.yaml +++ b/first-network/org3-artifacts/configtx.yaml @@ -28,4 +28,4 @@ Organizations: # for cross org gossip communication. Note, this value is only # encoded in the genesis block in the Application section context - Host: peer0.org3.example.com - Port: 7051 + Port: 11051 diff --git a/first-network/scripts/utils.sh b/first-network/scripts/utils.sh index 3b3820f1..a6c53323 100755 --- a/first-network/scripts/utils.sh +++ b/first-network/scripts/utils.sh @@ -38,16 +38,16 @@ setGlobals() { if [ $PEER -eq 0 ]; then CORE_PEER_ADDRESS=peer0.org1.example.com:7051 else - CORE_PEER_ADDRESS=peer1.org1.example.com:7051 + CORE_PEER_ADDRESS=peer1.org1.example.com:8051 fi elif [ $ORG -eq 2 ]; then CORE_PEER_LOCALMSPID="Org2MSP" CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG2_CA CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp if [ $PEER -eq 0 ]; then - CORE_PEER_ADDRESS=peer0.org2.example.com:7051 + CORE_PEER_ADDRESS=peer0.org2.example.com:9051 else - CORE_PEER_ADDRESS=peer1.org2.example.com:7051 + CORE_PEER_ADDRESS=peer1.org2.example.com:10051 fi elif [ $ORG -eq 3 ]; then @@ -55,9 +55,9 @@ setGlobals() { CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG3_CA CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/users/Admin@org3.example.com/msp if [ $PEER -eq 0 ]; then - CORE_PEER_ADDRESS=peer0.org3.example.com:7051 + CORE_PEER_ADDRESS=peer0.org3.example.com:11051 else - CORE_PEER_ADDRESS=peer1.org3.example.com:7051 + CORE_PEER_ADDRESS=peer1.org3.example.com:12051 fi else echo "================== ERROR !!! ORG Unknown ==================" @@ -277,9 +277,10 @@ parsePeerConnectionParameters() { PEER_CONN_PARMS="" PEERS="" while [ "$#" -gt 0 ]; do + setGlobals $1 $2 PEER="peer$1.org$2" PEERS="$PEERS $PEER" - PEER_CONN_PARMS="$PEER_CONN_PARMS --peerAddresses $PEER.example.com:7051" + PEER_CONN_PARMS="$PEER_CONN_PARMS --peerAddresses $CORE_PEER_ADDRESS" if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "true" ]; then TLSINFO=$(eval echo "--tlsRootCertFiles \$PEER$1_ORG$2_CA") PEER_CONN_PARMS="$PEER_CONN_PARMS $TLSINFO"