diff --git a/test-network/addOrg3/nerdctl/docker-compose-ca-org3.yaml b/test-network/addOrg3/nerdctl/docker-compose-ca-org3.yaml new file mode 100644 index 00000000..74dbf4d6 --- /dev/null +++ b/test-network/addOrg3/nerdctl/docker-compose-ca-org3.yaml @@ -0,0 +1,27 @@ +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +version: '3.7' + +networks: + test: + name: fabric_test + +services: + ca_org3: + image: hyperledger/fabric-ca:latest + labels: + service: hyperledger-fabric + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca-org3 + - FABRIC_CA_SERVER_TLS_ENABLED=true + - FABRIC_CA_SERVER_PORT=11054 + ports: + - "11054:11054" + command: sh -c 'fabric-ca-server start -b admin:adminpw -d' + volumes: + - ../fabric-ca/org3:/etc/hyperledger/fabric-ca-server + container_name: ca_org3 diff --git a/test-network/addOrg3/nerdctl/docker-compose-couch-org3.yaml b/test-network/addOrg3/nerdctl/docker-compose-couch-org3.yaml new file mode 100644 index 00000000..d10766f3 --- /dev/null +++ b/test-network/addOrg3/nerdctl/docker-compose-couch-org3.yaml @@ -0,0 +1,42 @@ +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +version: '3.7' + +networks: + test: + name: fabric_test + +services: + couchdb4: + container_name: couchdb4 + image: couchdb:3.1.1 + labels: + service: hyperledger-fabric + # Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password + # for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode. + environment: + - COUCHDB_USER=admin + - COUCHDB_PASSWORD=adminpw + # Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service, + # for example map it to utilize Fauxton User Interface in dev environments. + ports: + - "9984:5984" + networks: + - test + + peer0.org3.example.com: + environment: + - CORE_LEDGER_STATE_STATEDATABASE=CouchDB + - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb4:5984 + # The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD + # provide the credentials for ledger to connect to CouchDB. The username and password must + # match the username and password set for the associated CouchDB. + - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin + - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=adminpw + depends_on: + - couchdb4 + networks: + - test diff --git a/test-network/addOrg3/nerdctl/docker-compose-org3.yaml b/test-network/addOrg3/nerdctl/docker-compose-org3.yaml new file mode 100644 index 00000000..208f6d04 --- /dev/null +++ b/test-network/addOrg3/nerdctl/docker-compose-org3.yaml @@ -0,0 +1,51 @@ +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +version: '3.7' + +volumes: + peer0.org3.example.com: + +networks: + test: + name: fabric_test + +services: + + peer0.org3.example.com: + container_name: peer0.org3.example.com + image: hyperledger/fabric-peer:latest + labels: + service: hyperledger-fabric + environment: + - FABRIC_CFG_PATH=/etc/hyperledger/peercfg + #Generic peer variables + - FABRIC_LOGGING_SPEC=INFO + #- FABRIC_LOGGING_SPEC=DEBUG + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_PROFILE_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt + # Peer specific variables + - CORE_PEER_ID=peer0.org3.example.com + - CORE_PEER_ADDRESS=peer0.org3.example.com:11051 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/msp + - 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=peer0.org3.example.com:11051 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org3.example.com:11051 + - CORE_PEER_LOCALMSPID=Org3MSP + volumes: + - ../peercfg:/etc/hyperledger/peercfg + - ../../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com:/etc/hyperledger/fabric + - peer0.org3.example.com:/var/hyperledger/production + working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer + command: peer node start + ports: + - 11051:11051 + networks: + - test diff --git a/test-network/nerdctl/docker-compose-test-net.yaml b/test-network/nerdctl/docker-compose-test-net.yaml index 4466a85e..899eb61b 100644 --- a/test-network/nerdctl/docker-compose-test-net.yaml +++ b/test-network/nerdctl/docker-compose-test-net.yaml @@ -26,32 +26,34 @@ services: - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7050 - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + - ORDERER_GENERAL_LOCALMSPDIR=/opt/hyperledger/orderer/msp # enabled TLS - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_GENERAL_TLS_PRIVATEKEY=/opt/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/opt/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/opt/hyperledger/orderer/tls/ca.crt] + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/opt/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/opt/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/opt/hyperledger/orderer/tls/ca.crt] - ORDERER_GENERAL_BOOTSTRAPMETHOD=none - ORDERER_CHANNELPARTICIPATION_ENABLED=true - ORDERER_ADMIN_TLS_ENABLED=true - - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CERTIFICATE=/opt/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/opt/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/opt/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/opt/hyperledger/orderer/tls/ca.crt] - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 - ORDERER_OPERATIONS_LISTENADDRESS=orderer.example.com:9443 - ORDERER_METRICS_PROVIDER=prometheus working_dir: /root command: orderer volumes: - - ../system-genesis-block/genesis.block:/var/hyperledger/orderer/orderer.genesis.block - - ../organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp - - ../organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls - - orderer.example.com:/var/hyperledger/production/orderer + # todo: track down why nerdctl compose can NOT mount these files into /var/hyperledger in the orderer container. + # todo: why are we mounting a genesis block when the test network uses the channel participation API? + # - ../system-genesis-block/genesis.block:/opt/hyperledger/orderer/orderer.genesis.block + - ../organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/opt/hyperledger/orderer/msp + - ../organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/opt/hyperledger/orderer/tls + - orderer.example.com:/opt/hyperledger/production/orderer ports: - 7050:7050 - 7053:7053 @@ -65,10 +67,9 @@ services: labels: service: hyperledger-fabric environment: - #Generic peer variables - # - FABRIC_CFG_PATH=/etc/hyperledger/fabric/cfg - #- FABRIC_LOGGING_SPEC=INFO - - FABRIC_LOGGING_SPEC=DEBUG + - FABRIC_CFG_PATH=/etc/hyperledger/peercfg + - FABRIC_LOGGING_SPEC=INFO + #- FABRIC_LOGGING_SPEC=DEBUG - CORE_PEER_TLS_ENABLED=true - CORE_PEER_PROFILE_ENABLED=false - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt @@ -83,14 +84,14 @@ services: - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051 - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051 - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/msp - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9444 - CORE_METRICS_PROVIDER=prometheus - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0org1"} - CORE_CHAINCODE_EXECUTETIMEOUT=300s volumes: - # - ${DOCKER_SOCK}:/host/var/run/docker.sock + - ./peercfg:/etc/hyperledger/peercfg - ../organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com:/etc/hyperledger/fabric - # - ../organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls - peer0.org1.example.com:/var/hyperledger/production working_dir: /root command: peer node start @@ -106,8 +107,7 @@ services: labels: service: hyperledger-fabric environment: - #Generic peer variables - # - FABRIC_CFG_PATH=/etc/hyperledger/fabric/cfg + - FABRIC_CFG_PATH=/etc/hyperledger/peercfg - FABRIC_LOGGING_SPEC=INFO #- FABRIC_LOGGING_SPEC=DEBUG - CORE_PEER_TLS_ENABLED=true @@ -124,16 +124,15 @@ services: - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:9051 - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:9051 - CORE_PEER_LOCALMSPID=Org2MSP + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/msp - CORE_OPERATIONS_LISTENADDRESS=peer0.org2.example.com:9445 - CORE_METRICS_PROVIDER=prometheus - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0org2"} - CORE_CHAINCODE_EXECUTETIMEOUT=300s volumes: - # - ${DOCKER_SOCK}:/host/var/run/docker.sock + - ./peercfg:/etc/hyperledger/peercfg - ../organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com:/etc/hyperledger/fabric - # - ../organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls - peer0.org2.example.com:/var/hyperledger/production - # - ../podman_cfg/core.yaml:/etc/hyperledger/fabric/cfg/core.yaml working_dir: /root command: peer node start ports: @@ -159,7 +158,6 @@ services: volumes: - ../organizations:/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations - ../scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/ - - ../podman_cfg:/etc/hyperledger/fabric/cfg depends_on: - peer0.org1.example.com - peer0.org2.example.com diff --git a/test-network/nerdctl/core.yaml b/test-network/nerdctl/peercfg/core.yaml similarity index 99% rename from test-network/nerdctl/core.yaml rename to test-network/nerdctl/peercfg/core.yaml index 32c23205..4b173e63 100644 --- a/test-network/nerdctl/core.yaml +++ b/test-network/nerdctl/peercfg/core.yaml @@ -342,8 +342,7 @@ peer: Security: # Path on the file system where peer will find MSP local configurations - mspConfigPath: msp - + mspConfigPath: mspreally # Identifier of the local MSP # ----!!!!IMPORTANT!!!-!!!IMPORTANT!!!-!!!IMPORTANT!!!!---- # Deployers need to change the value of the localMspId string. diff --git a/test-network/network.sh b/test-network/network.sh index c31e6ac0..cfdcb331 100755 --- a/test-network/network.sh +++ b/test-network/network.sh @@ -290,9 +290,14 @@ function deployCCAAS() { # Tear down running network function networkDown() { + # stop org3 containers also in addition to org1 and org2, in case we were running sample to add org3 - DOCKER_SOCK=$DOCKER_SOCK ${CONTAINER_CLI_COMPOSE} -f $COMPOSE_FILE_BASE -f $COMPOSE_FILE_COUCH -f $COMPOSE_FILE_CA down --volumes #--remove-orphans - ${CONTAINER_CLI_COMPOSE} -f $COMPOSE_FILE_COUCH_ORG3 -f $COMPOSE_FILE_ORG3 down --volumes #--remove-orphans + for descriptor in $COMPOSE_FILE_BASE $COMPOSE_FILE_COUCH $COMPOSE_FILE_CA $COMPOSE_FILE_COUCH_ORG3 $COMPOSE_FILE_ORG3 + do + infoln "Decomposing $descriptor" + DOCKER_SOCK=$DOCKER_SOCK ${CONTAINER_CLI_COMPOSE} -f $descriptor down --volumes #--remove-orphans + done + # Don't remove the generated artifacts -- note, the ledgers are always removed if [ "$MODE" != "restart" ]; then # Bring down the network, deleting the volumes @@ -341,9 +346,9 @@ COMPOSE_FILE_COUCH=${CONTAINER_CLI}/docker-compose-couch.yaml # certificate authorities compose file COMPOSE_FILE_CA=${CONTAINER_CLI}/docker-compose-ca.yaml # use this as the docker compose couch file for org3 -COMPOSE_FILE_COUCH_ORG3=addOrg3/docker/docker-compose-couch-org3.yaml +COMPOSE_FILE_COUCH_ORG3=addOrg3/${CONTAINER_CLI}/docker-compose-couch-org3.yaml # use this as the default docker-compose yaml definition for org3 -COMPOSE_FILE_ORG3=addOrg3/docker/docker-compose-org3.yaml +COMPOSE_FILE_ORG3=addOrg3/${CONTAINER_CLI}/docker-compose-org3.yaml # # chaincode language defaults to "NA" CC_SRC_LANGUAGE="NA"