Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(test-tooling): migrate AIO image to Fabric v2.5.6, add constants #3054

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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";
outSH marked this conversation as resolved.
Show resolved Hide resolved
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/[email protected]/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/[email protected]/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,
};
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
24 changes: 24 additions & 0 deletions packages/cactus-test-tooling/src/main/typescript/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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";
12 changes: 10 additions & 2 deletions tools/docker/fabric-all-in-one/Dockerfile_v2.x
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading