diff --git a/packages/cactus-test-tooling/src/main/typescript/fabric/fabric-samples-env-constants.ts b/packages/cactus-test-tooling/src/main/typescript/fabric/fabric-samples-env-constants.ts new file mode 100644 index 0000000000..077bb0cc72 --- /dev/null +++ b/packages/cactus-test-tooling/src/main/typescript/fabric/fabric-samples-env-constants.ts @@ -0,0 +1,125 @@ +export interface IFabricOrgEnvInfo extends NodeJS.ProcessEnv { + [key: string]: string | undefined; + readonly CORE_PEER_TLS_ENABLED: string; + readonly CORE_PEER_LOCALMSPID: string; + readonly CORE_PEER_TLS_CERT_FILE: string; + readonly CORE_PEER_TLS_KEY_FILE: string; + readonly CORE_PEER_ADDRESS: string; + readonly CORE_PEER_MSPCONFIGPATH: string; + readonly CORE_PEER_TLS_ROOTCERT_FILE: string; + readonly ORDERER_TLS_ROOTCERT_FILE: string; +} + +export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ENABLED_ORG_1 = "true"; +export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_LOCALMSPID_ORG_1 = + "Org1MSP"; +export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_CERT_FILE_ORG_1 = + "/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt"; + +export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_KEY_FILE_ORG_1 = + "/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key"; + +export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_ADDRESS_ORG_1 = + "peer0.org1.example.com:7051"; + +export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_MSPCONFIGPATH_ORG_1 = + "/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp"; + +export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ROOTCERT_FILE_ORG_1 = + "/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"; + +export const FABRIC_25_LTS_FABRIC_SAMPLES__ORDERER_TLS_ROOTCERT_FILE_ORG_1 = + "/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem"; + +/** + * Contains the file paths and other configuration parameters (such as flags, + * hostnames etc.) that are a match for what you need to execute peer commands + * from within the "cli" container of the fabric samples test network. + * + * The aforementioned test network ships with 2 organizations by default, this + * is the configuration to make the peer binary talk to the **first** organization. + * + * Important note: The paths are only accurate within the mentioned `cli` container + * as defined in the compose .yaml files describing the test network. Therefore, + * if you have shelled into the Cacti All-in-One Fabric container, these are not + * useful there, instead you need to shell into the nested `cli` container by + * executing something like `docker exec -it cli bash` which will then get you + * to the environment where these paths are representative and useful. + * + * @see https://github.com/hyperledger/fabric-samples + */ +export const FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1: IFabricOrgEnvInfo = { + CORE_PEER_TLS_ENABLED: + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ENABLED_ORG_1, + CORE_PEER_LOCALMSPID: + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_LOCALMSPID_ORG_1, + CORE_PEER_TLS_CERT_FILE: + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_CERT_FILE_ORG_1, + CORE_PEER_TLS_KEY_FILE: + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_KEY_FILE_ORG_1, + CORE_PEER_ADDRESS: FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_ADDRESS_ORG_1, + CORE_PEER_MSPCONFIGPATH: + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_MSPCONFIGPATH_ORG_1, + CORE_PEER_TLS_ROOTCERT_FILE: + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ROOTCERT_FILE_ORG_1, + ORDERER_TLS_ROOTCERT_FILE: + FABRIC_25_LTS_FABRIC_SAMPLES__ORDERER_TLS_ROOTCERT_FILE_ORG_1, +}; + +export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ENABLED_ORG_2 = "true"; + +export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_LOCALMSPID_ORG_2 = + "Org2MSP"; + +export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_CERT_FILE_ORG_2 = + "/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.crt"; + +export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_KEY_FILE_ORG_2 = + "/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.key"; + +export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_ADDRESS_ORG_2 = + "peer0.org2.example.com:9051"; + +export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_MSPCONFIGPATH_ORG_2 = + "/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp"; + +export const FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ROOTCERT_FILE_ORG_2 = + "/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt"; + +export const FABRIC_25_LTS_FABRIC_SAMPLES__ORDERER_TLS_ROOTCERT_FILE_ORG_2 = + "/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem"; + +/** + * Contains the file paths and other configuration parameters (such as flags, + * hostnames etc.) that are a match for what you need to execute peer commands + * from within the "cli" container of the fabric samples test network. + * + * The aforementioned test network ships with 2 organizations by default, this + * is the configuration to make the peer binary talk to the **second** organization. + * + * Important note: The paths are only accurate within the mentioned `cli` container + * as defined in the compose .yaml files describing the test network. Therefore, + * if you have shelled into the Cacti All-in-One Fabric container, these are not + * useful there, instead you need to shell into the nested `cli` container by + * executing something like `docker exec -it cli bash` which will then get you + * to the environment where these paths are representative and useful. + * + * @see https://github.com/hyperledger/fabric-samples + */ +export const FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_2: IFabricOrgEnvInfo = { + CORE_PEER_TLS_ENABLED: + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ENABLED_ORG_2, + CORE_PEER_LOCALMSPID: + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_LOCALMSPID_ORG_2, + CORE_PEER_TLS_CERT_FILE: + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_CERT_FILE_ORG_2, + CORE_PEER_TLS_KEY_FILE: + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_KEY_FILE_ORG_2, + CORE_PEER_ADDRESS: FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_ADDRESS_ORG_2, + CORE_PEER_MSPCONFIGPATH: + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_MSPCONFIGPATH_ORG_2, + CORE_PEER_TLS_ROOTCERT_FILE: + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ROOTCERT_FILE_ORG_2, + ORDERER_TLS_ROOTCERT_FILE: + FABRIC_25_LTS_FABRIC_SAMPLES__ORDERER_TLS_ROOTCERT_FILE_ORG_2, +}; diff --git a/packages/cactus-test-tooling/src/main/typescript/fabric/fabric-test-ledger-v1.ts b/packages/cactus-test-tooling/src/main/typescript/fabric/fabric-test-ledger-v1.ts index 07c05eb0c5..8fba66f734 100644 --- a/packages/cactus-test-tooling/src/main/typescript/fabric/fabric-test-ledger-v1.ts +++ b/packages/cactus-test-tooling/src/main/typescript/fabric/fabric-test-ledger-v1.ts @@ -83,6 +83,10 @@ export const DEFAULT_FABRIC_2_AIO_IMAGE_NAME = export const DEFAULT_FABRIC_2_AIO_IMAGE_VERSION = "2023-08-17-issue2057-pr2135"; export const DEFAULT_FABRIC_2_AIO_FABRIC_VERSION = "2.4.4"; +export const FABRIC_25_LTS_AIO_IMAGE_VERSION = + "2024-03-03--issue-2945-fabric-v2-5-6"; +export const FABRIC_25_LTS_AIO_FABRIC_VERSION = "2.5.6"; + /* * Provides default options for Fabric container */ diff --git a/packages/cactus-test-tooling/src/main/typescript/public-api.ts b/packages/cactus-test-tooling/src/main/typescript/public-api.ts index 440d12cfe6..ed5bff1d84 100755 --- a/packages/cactus-test-tooling/src/main/typescript/public-api.ts +++ b/packages/cactus-test-tooling/src/main/typescript/public-api.ts @@ -52,6 +52,8 @@ export { DEFAULT_FABRIC_2_AIO_FABRIC_VERSION, DEFAULT_FABRIC_2_AIO_IMAGE_NAME, DEFAULT_FABRIC_2_AIO_IMAGE_VERSION, + FABRIC_25_LTS_AIO_FABRIC_VERSION, + FABRIC_25_LTS_AIO_IMAGE_VERSION, FabricTestLedgerV1, IFabricTestLedgerV1ConstructorOptions, FABRIC_TEST_LEDGER_DEFAULT_OPTIONS, @@ -193,3 +195,25 @@ export { envNodeToDocker } from "./common/env-node-to-docker"; export { envMapToDocker } from "./common/env-map-to-docker"; export { envNodeToMap } from "./common/env-node-to-map"; export * as SocketIOTestSetupHelpers from "./socketio-test-setup-helpers/socketio-test-setup-helpers"; + +export { + FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1, + FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_2, + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_ADDRESS_ORG_1, + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_ADDRESS_ORG_2, + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_LOCALMSPID_ORG_1, + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_LOCALMSPID_ORG_2, + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_MSPCONFIGPATH_ORG_1, + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_MSPCONFIGPATH_ORG_2, + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_CERT_FILE_ORG_1, + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_CERT_FILE_ORG_2, + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ENABLED_ORG_1, + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ENABLED_ORG_2, + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_KEY_FILE_ORG_1, + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_KEY_FILE_ORG_2, + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ROOTCERT_FILE_ORG_1, + FABRIC_25_LTS_FABRIC_SAMPLES__CORE_PEER_TLS_ROOTCERT_FILE_ORG_2, + FABRIC_25_LTS_FABRIC_SAMPLES__ORDERER_TLS_ROOTCERT_FILE_ORG_1, + FABRIC_25_LTS_FABRIC_SAMPLES__ORDERER_TLS_ROOTCERT_FILE_ORG_2, + IFabricOrgEnvInfo, +} from "./fabric/fabric-samples-env-constants"; diff --git a/tools/docker/fabric-all-in-one/Dockerfile_v2.x b/tools/docker/fabric-all-in-one/Dockerfile_v2.x index ccbacd25ca..2d1a327060 100644 --- a/tools/docker/fabric-all-in-one/Dockerfile_v2.x +++ b/tools/docker/fabric-all-in-one/Dockerfile_v2.x @@ -1,7 +1,7 @@ FROM docker:24.0.5-dind -ARG FABRIC_VERSION=2.4.4 -ARG FABRIC_NODEENV_VERSION=2.4.2 +ARG FABRIC_VERSION=2.5.6 +ARG FABRIC_NODEENV_VERSION=2.5.4 ARG CA_VERSION=1.5.3 ARG COUCH_VERSION_FABRIC=0.4 ARG COUCH_VERSION=3.2.2 @@ -172,9 +172,16 @@ RUN /bootstrap.sh ${FABRIC_VERSION} ${CA_VERSION} -d # But we need at least NodeJS 16 and npm v7 for the dependency installation to work. RUN sed -i "s/fabric-nodeenv:\$(TWO_DIGIT_VERSION)/fabric-nodeenv:${FABRIC_NODEENV_VERSION}/g" /fabric-samples/test-network/compose/docker/peercfg/core.yaml +RUN yq '.chaincode.logging.level = "debug"' \ + --inplace /fabric-samples/test-network/compose/docker/peercfg/core.yaml + # Set the log level of the peers and other containers to DEBUG instead of the default INFO RUN sed -i "s/FABRIC_LOGGING_SPEC=INFO/FABRIC_LOGGING_SPEC=DEBUG/g" /fabric-samples/test-network/compose/docker/docker-compose-test-net.yaml +# For now this cannot be used because it mangles the outupt of the "peer lifecycle chaincode queryinstalled" commands. +# We need to refactor those commands in the deployment endpoints so that they are immune to this logging setting. +# RUN sed -i "s/FABRIC_LOGGING_SPEC=INFO/FABRIC_LOGGING_SPEC=DEBUG/g" /fabric-samples/test-network/compose/compose-test-net.yaml + # Update the docker-compose file of the fabric-samples repo so that the # core.yaml configuration file of the peer containers can be customized. # We need the above because we need to override the NodeJS version the peers are @@ -191,6 +198,7 @@ RUN yq '.services."peer0.org2.example.com".volumes += "../..:/opt/gopath/src/git RUN yq '.services."peer0.org2.example.com".volumes += "../../config/core.yaml:/etc/hyperledger/fabric/core.yaml"' \ --inplace /fabric-samples/test-network/compose/docker/docker-compose-test-net.yaml + # Install supervisord because we need to run the docker daemon and also the fabric network # meaning that we have multiple processes to run. RUN apk add --no-cache supervisor