diff --git a/varion/compose/compose-bft-test-net.yaml b/varion/compose/compose-bft-test-net.yaml index c23ccfe6..5939e2b9 100644 --- a/varion/compose/compose-bft-test-net.yaml +++ b/varion/compose/compose-bft-test-net.yaml @@ -215,7 +215,7 @@ services: volumes: - ../organizations/peerOrganizations/farmer.varion.com/peers/peer0.farmer.varion.com:/etc/hyperledger/fabric - peer0.farmer.varion.com:/var/hyperledger/production - working_dir: /root + working_dir: /rootrg1 command: peer node start ports: - 7051:7051 diff --git a/varion/compose/compose-ca.yaml b/varion/compose/compose-ca.yaml index f678755b..7839c9a2 100644 --- a/varion/compose/compose-ca.yaml +++ b/varion/compose/compose-ca.yaml @@ -11,13 +11,13 @@ networks: services: - ca_org1: + ca_farmer: image: hyperledger/fabric-ca:latest labels: service: hyperledger-fabric environment: - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca-org1 + - FABRIC_CA_SERVER_CA_NAME=ca-farmer - FABRIC_CA_SERVER_TLS_ENABLED=true - FABRIC_CA_SERVER_PORT=7054 - FABRIC_CA_SERVER_OPERATIONS_LISTENADDRESS=0.0.0.0:17054 @@ -26,18 +26,18 @@ services: - "17054:17054" command: sh -c 'fabric-ca-server start -b admin:adminpw -d' volumes: - - ../organizations/fabric-ca/org1:/etc/hyperledger/fabric-ca-server - container_name: ca_org1 + - ../organizations/fabric-ca/farmer:/etc/hyperledger/fabric-ca-server + container_name: ca_farmer networks: - test - ca_org2: + ca_pulper: image: hyperledger/fabric-ca:latest labels: service: hyperledger-fabric environment: - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca-org2 + - FABRIC_CA_SERVER_CA_NAME=ca-pulper - FABRIC_CA_SERVER_TLS_ENABLED=true - FABRIC_CA_SERVER_PORT=8054 - FABRIC_CA_SERVER_OPERATIONS_LISTENADDRESS=0.0.0.0:18054 @@ -46,8 +46,48 @@ services: - "18054:18054" command: sh -c 'fabric-ca-server start -b admin:adminpw -d' volumes: - - ../organizations/fabric-ca/org2:/etc/hyperledger/fabric-ca-server - container_name: ca_org2 + - ../organizations/fabric-ca/pulper:/etc/hyperledger/fabric-ca-server + container_name: ca_pulper + networks: + - test + + ca_huller: + image: hyperledger/fabric-ca:latest + labels: + service: hyperledger-fabric + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca-huller + - FABRIC_CA_SERVER_TLS_ENABLED=true + - FABRIC_CA_SERVER_PORT=10054 + - FABRIC_CA_SERVER_OPERATIONS_LISTENADDRESS=0.0.0.0:20054 + ports: + - "10054:10054" + - "20054:20054" + command: sh -c 'fabric-ca-server start -b admin:adminpw -d' + volumes: + - ../organizations/fabric-ca/huller:/etc/hyperledger/fabric-ca-server + container_name: ca_huller + networks: + - test + + ca_export: + image: hyperledger/fabric-ca:latest + labels: + service: hyperledger-fabric + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca-export + - FABRIC_CA_SERVER_TLS_ENABLED=true + - FABRIC_CA_SERVER_PORT=11054 + - FABRIC_CA_SERVER_OPERATIONS_LISTENADDRESS=0.0.0.0:21054 + ports: + - "11054:11054" + - "21054:21054" + command: sh -c 'fabric-ca-server start -b admin:adminpw -d' + volumes: + - ../organizations/fabric-ca/export:/etc/hyperledger/fabric-ca-server + container_name: ca_export networks: - test diff --git a/varion/organizations/fabric-ca/registerEnroll.sh b/varion/organizations/fabric-ca/registerEnroll.sh index 48eed51f..50d6a0c0 100755 --- a/varion/organizations/fabric-ca/registerEnroll.sh +++ b/varion/organizations/fabric-ca/registerEnroll.sh @@ -179,22 +179,22 @@ function createHuller() { export FABRIC_CA_CLIENT_HOME=${PWD}/organizations/peerOrganizations/huller.varion.com/ set -x - fabric-ca-client enroll -u https://admin:adminpw@localhost:8054 --caname ca-huller --tls.certfiles "${PWD}/organizations/fabric-ca/huller/ca-cert.pem" + fabric-ca-client enroll -u https://admin:adminpw@localhost:10054 --caname ca-huller --tls.certfiles "${PWD}/organizations/fabric-ca/huller/ca-cert.pem" { set +x; } 2>/dev/null echo 'NodeOUs: Enable: true ClientOUIdentifier: - Certificate: cacerts/localhost-8054-ca-huller.pem + Certificate: cacerts/localhost-10054-ca-huller.pem OrganizationalUnitIdentifier: client PeerOUIdentifier: - Certificate: cacerts/localhost-8054-ca-huller.pem + Certificate: cacerts/localhost-10054-ca-huller.pem OrganizationalUnitIdentifier: peer AdminOUIdentifier: - Certificate: cacerts/localhost-8054-ca-huller.pem + Certificate: cacerts/localhost-10054-ca-huller.pem OrganizationalUnitIdentifier: admin OrdererOUIdentifier: - Certificate: cacerts/localhost-8054-ca-huller.pem + Certificate: cacerts/localhost-10054-ca-huller.pem OrganizationalUnitIdentifier: orderer' > "${PWD}/organizations/peerOrganizations/huller.varion.com/msp/config.yaml" # Since the CA serves as both the organization CA and TLS CA, copy the org's root cert that was generated by CA startup into the org level ca and tlsca directories @@ -228,14 +228,14 @@ function createHuller() { infoln "Generating the peer0 msp" set -x - fabric-ca-client enroll -u https://peer0:peer0pw@localhost:8054 --caname ca-huller -M "${PWD}/organizations/peerOrganizations/huller.varion.com/peers/peer0.huller.varion.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/huller/ca-cert.pem" + fabric-ca-client enroll -u https://peer0:peer0pw@localhost:10054 --caname ca-huller -M "${PWD}/organizations/peerOrganizations/huller.varion.com/peers/peer0.huller.varion.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/huller/ca-cert.pem" { set +x; } 2>/dev/null cp "${PWD}/organizations/peerOrganizations/huller.varion.com/msp/config.yaml" "${PWD}/organizations/peerOrganizations/huller.varion.com/peers/peer0.huller.varion.com/msp/config.yaml" infoln "Generating the peer0-tls certificates, use --csr.hosts to specify Subject Alternative Names" set -x - fabric-ca-client enroll -u https://peer0:peer0pw@localhost:8054 --caname ca-huller -M "${PWD}/organizations/peerOrganizations/huller.varion.com/peers/peer0.huller.varion.com/tls" --enrollment.profile tls --csr.hosts peer0.huller.varion.com --csr.hosts localhost --tls.certfiles "${PWD}/organizations/fabric-ca/huller/ca-cert.pem" + fabric-ca-client enroll -u https://peer0:peer0pw@localhost:10054 --caname ca-huller -M "${PWD}/organizations/peerOrganizations/huller.varion.com/peers/peer0.huller.varion.com/tls" --enrollment.profile tls --csr.hosts peer0.huller.varion.com --csr.hosts localhost --tls.certfiles "${PWD}/organizations/fabric-ca/huller/ca-cert.pem" { set +x; } 2>/dev/null # Copy the tls CA cert, server cert, server keystore to well known file names in the peer's tls directory that are referenced by peer startup config @@ -245,14 +245,14 @@ function createHuller() { infoln "Generating the user msp" set -x - fabric-ca-client enroll -u https://user1:user1pw@localhost:8054 --caname ca-huller -M "${PWD}/organizations/peerOrganizations/huller.varion.com/users/User1@huller.varion.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/huller/ca-cert.pem" + fabric-ca-client enroll -u https://user1:user1pw@localhost:10054 --caname ca-huller -M "${PWD}/organizations/peerOrganizations/huller.varion.com/users/User1@huller.varion.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/huller/ca-cert.pem" { set +x; } 2>/dev/null cp "${PWD}/organizations/peerOrganizations/huller.varion.com/msp/config.yaml" "${PWD}/organizations/peerOrganizations/huller.varion.com/users/User1@huller.varion.com/msp/config.yaml" infoln "Generating the org admin msp" set -x - fabric-ca-client enroll -u https://hulleradmin:hulleradminpw@localhost:8054 --caname ca-huller -M "${PWD}/organizations/peerOrganizations/huller.varion.com/users/Admin@huller.varion.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/huller/ca-cert.pem" + fabric-ca-client enroll -u https://hulleradmin:hulleradminpw@localhost:10054 --caname ca-huller -M "${PWD}/organizations/peerOrganizations/huller.varion.com/users/Admin@huller.varion.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/huller/ca-cert.pem" { set +x; } 2>/dev/null cp "${PWD}/organizations/peerOrganizations/huller.varion.com/msp/config.yaml" "${PWD}/organizations/peerOrganizations/huller.varion.com/users/Admin@huller.varion.com/msp/config.yaml" @@ -265,22 +265,22 @@ function createExport() { export FABRIC_CA_CLIENT_HOME=${PWD}/organizations/peerOrganizations/export.varion.com/ set -x - fabric-ca-client enroll -u https://admin:adminpw@localhost:8054 --caname ca-export --tls.certfiles "${PWD}/organizations/fabric-ca/export/ca-cert.pem" + fabric-ca-client enroll -u https://admin:adminpw@localhost:11054 --caname ca-export --tls.certfiles "${PWD}/organizations/fabric-ca/export/ca-cert.pem" { set +x; } 2>/dev/null echo 'NodeOUs: Enable: true ClientOUIdentifier: - Certificate: cacerts/localhost-8054-ca-export.pem + Certificate: cacerts/localhost-11054-ca-export.pem OrganizationalUnitIdentifier: client PeerOUIdentifier: - Certificate: cacerts/localhost-8054-ca-export.pem + Certificate: cacerts/localhost-11054-ca-export.pem OrganizationalUnitIdentifier: peer AdminOUIdentifier: - Certificate: cacerts/localhost-8054-ca-export.pem + Certificate: cacerts/localhost-11054-ca-export.pem OrganizationalUnitIdentifier: admin OrdererOUIdentifier: - Certificate: cacerts/localhost-8054-ca-export.pem + Certificate: cacerts/localhost-11054-ca-export.pem OrganizationalUnitIdentifier: orderer' > "${PWD}/organizations/peerOrganizations/export.varion.com/msp/config.yaml" # Since the CA serves as both the organization CA and TLS CA, copy the org's root cert that was generated by CA startup into the org level ca and tlsca directories @@ -314,14 +314,14 @@ function createExport() { infoln "Generating the peer0 msp" set -x - fabric-ca-client enroll -u https://peer0:peer0pw@localhost:8054 --caname ca-export -M "${PWD}/organizations/peerOrganizations/export.varion.com/peers/peer0.export.varion.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/export/ca-cert.pem" + fabric-ca-client enroll -u https://peer0:peer0pw@localhost:11054 --caname ca-export -M "${PWD}/organizations/peerOrganizations/export.varion.com/peers/peer0.export.varion.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/export/ca-cert.pem" { set +x; } 2>/dev/null cp "${PWD}/organizations/peerOrganizations/export.varion.com/msp/config.yaml" "${PWD}/organizations/peerOrganizations/export.varion.com/peers/peer0.export.varion.com/msp/config.yaml" infoln "Generating the peer0-tls certificates, use --csr.hosts to specify Subject Alternative Names" set -x - fabric-ca-client enroll -u https://peer0:peer0pw@localhost:8054 --caname ca-export -M "${PWD}/organizations/peerOrganizations/export.varion.com/peers/peer0.export.varion.com/tls" --enrollment.profile tls --csr.hosts peer0.export.varion.com --csr.hosts localhost --tls.certfiles "${PWD}/organizations/fabric-ca/export/ca-cert.pem" + fabric-ca-client enroll -u https://peer0:peer0pw@localhost:11054 --caname ca-export -M "${PWD}/organizations/peerOrganizations/export.varion.com/peers/peer0.export.varion.com/tls" --enrollment.profile tls --csr.hosts peer0.export.varion.com --csr.hosts localhost --tls.certfiles "${PWD}/organizations/fabric-ca/export/ca-cert.pem" { set +x; } 2>/dev/null # Copy the tls CA cert, server cert, server keystore to well known file names in the peer's tls directory that are referenced by peer startup config @@ -331,14 +331,14 @@ function createExport() { infoln "Generating the user msp" set -x - fabric-ca-client enroll -u https://user1:user1pw@localhost:8054 --caname ca-export -M "${PWD}/organizations/peerOrganizations/export.varion.com/users/User1@export.varion.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/export/ca-cert.pem" + fabric-ca-client enroll -u https://user1:user1pw@localhost:11054 --caname ca-export -M "${PWD}/organizations/peerOrganizations/export.varion.com/users/User1@export.varion.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/export/ca-cert.pem" { set +x; } 2>/dev/null cp "${PWD}/organizations/peerOrganizations/export.varion.com/msp/config.yaml" "${PWD}/organizations/peerOrganizations/export.varion.com/users/User1@export.varion.com/msp/config.yaml" infoln "Generating the org admin msp" set -x - fabric-ca-client enroll -u https://exportadmin:exportadminpw@localhost:8054 --caname ca-export -M "${PWD}/organizations/peerOrganizations/export.varion.com/users/Admin@export.varion.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/export/ca-cert.pem" + fabric-ca-client enroll -u https://exportadmin:exportadminpw@localhost:11054 --caname ca-export -M "${PWD}/organizations/peerOrganizations/export.varion.com/users/Admin@export.varion.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/export/ca-cert.pem" { set +x; } 2>/dev/null cp "${PWD}/organizations/peerOrganizations/export.varion.com/msp/config.yaml" "${PWD}/organizations/peerOrganizations/export.varion.com/users/Admin@export.varion.com/msp/config.yaml" diff --git a/varion/scripts/createChannel.sh b/varion/scripts/createChannel.sh index 4c9167b4..20889cf0 100755 --- a/varion/scripts/createChannel.sh +++ b/varion/scripts/createChannel.sh @@ -27,7 +27,7 @@ if [ ! -d "channel-artifacts" ]; then fi createChannelGenesisBlock() { - setGlobals 1 + setGlobals "farmer" which configtxgen if [ "$?" -ne 0 ]; then fatalln "configtxgen tool not found." @@ -87,7 +87,7 @@ joinChannel() { COUNTER=$(expr $COUNTER + 1) done cat log.txt - verifyResult $res "After $MAX_RETRY attempts, peer0.org${ORG} has failed to join channel '$CHANNEL_NAME' " + verifyResult $res "After $MAX_RETRY attempts, peer0.${ORG} has failed to join channel '$CHANNEL_NAME' " } setAnchorPeer() { diff --git a/varion/scripts/envVar.sh b/varion/scripts/envVar.sh index 00b133e1..7e33c775 100755 --- a/varion/scripts/envVar.sh +++ b/varion/scripts/envVar.sh @@ -33,22 +33,23 @@ setGlobals() { USING_ORG="${OVERRIDE_ORG}" fi infoln "Using organization ${USING_ORG}" - if [ $USING_ORG -eq "farmer" ]; then + if [ $USING_ORG == "farmer" ]; then export CORE_PEER_LOCALMSPID=FarmerMSP export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_FARMER_CA export CORE_PEER_MSPCONFIGPATH=${TEST_NETWORK_HOME}/organizations/peerOrganizations/farmer.varion.com/users/Admin@farmer.varion.com/msp + infoln "mspconfigpath = ${CORE_PEER_MSPCONFIGPATH}" export CORE_PEER_ADDRESS=localhost:7051 - elif [ $USING_ORG -eq "pulper" ]; then + elif [ $USING_ORG == "pulper" ]; then export CORE_PEER_LOCALMSPID=PulperMSP export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_PULPER_CA - export CORE_PEER_MSPCONFIGPATH=${TEST_NETWORK_HOME}/organizations/peerOrganizations/pulper.varion.com/users/Admin@farmer.varion.com/msp + export CORE_PEER_MSPCONFIGPATH=${TEST_NETWORK_HOME}/organizations/peerOrganizations/pulper.varion.com/users/Admin@pulper.varion.com/msp export CORE_PEER_ADDRESS=localhost:9051 - elif [ $USING_ORG -eq "huller" ]; then + elif [ $USING_ORG == "huller" ]; then export CORE_PEER_LOCALMSPID=HullerMSP export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_HULLER_CA export CORE_PEER_MSPCONFIGPATH=${TEST_NETWORK_HOME}/organizations/peerOrganizations/huller.varion.com/users/Admin@huller.varion.com/msp export CORE_PEER_ADDRESS=localhost:11051 - elif [ $USING_ORG -eq "export" ]; then + elif [ $USING_ORG == "export" ]; then export CORE_PEER_LOCALMSPID=ExportMSP export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_EXPORT_CA export CORE_PEER_MSPCONFIGPATH=${TEST_NETWORK_HOME}/organizations/peerOrganizations/export.varion.com/users/Admin@export.varion.com/msp diff --git a/varion/scripts/setAnchorPeer.sh b/varion/scripts/setAnchorPeer.sh index 25c192cb..f46c26b0 100755 --- a/varion/scripts/setAnchorPeer.sh +++ b/varion/scripts/setAnchorPeer.sh @@ -22,16 +22,16 @@ createAnchorPeerUpdate() { infoln "Generating anchor peer update transaction for ${ORG} on channel $CHANNEL_NAME" - if [ $ORG -eq "farmer" ]; then + if [ $ORG == "farmer" ]; then HOST="peer0.farmer.varion.com" PORT=7051 - elif [ $ORG -eq "pulper" ]; then + elif [ $ORG == "pulper" ]; then HOST="peer0.pulper.varion.com" PORT=9051 - elif [ $ORG -eq "huller" ]; then + elif [ $ORG == "huller" ]; then HOST="peer0.huller.varion.com" PORT=11051 - elif [ $ORG -eq "export" ]; then + elif [ $ORG == "export" ]; then HOST="peer0.export.varion.com" PORT=12051 else