Skip to content

Commit

Permalink
[FABCN-392] Update to Node 12
Browse files Browse the repository at this point in the history
Set node engine to be the latest LTS at time of commit 12.6.1
Due to issues with comibation of the 12.6 and rewire, unit tests are run
with node 12.5.0

Updated timeout as Typescript compilation seems to have slowed down.

Signed-off-by: Matthew B White <[email protected]>
  • Loading branch information
mbwhite committed Apr 2, 2020
1 parent 418f742 commit 1917562
Show file tree
Hide file tree
Showing 21 changed files with 30 additions and 30 deletions.
8 changes: 4 additions & 4 deletions COMPATIBILITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ This table shows the summary of the compatibility of the Node modules at version
| | Peer Connectivity v1.4 | NodeJS | Peer Connectivity v2.x |
| --------------------- | ---------------------- | ------ | ---------------------- |
| Node modules **v1.4** | Yes | 8 | Yes |
| Node modules **v2.x** | Yes | 10 | Yes |
| Node modules **v2.x** | Yes | 12 | Yes |

By default a Fabric Peer v1.4 will create a Nodejs v8 runtime, and a Fabric Peer v2.x will create a Nodejs v10 runtime. Whilst this is the default, the docker image used to host the chaincode and contracts can be altered. Set the environment variable `CORE_CHAINCODE_NODE_RUNTIME` on the peer to the name of the docker image. For example `CORE_CHAINCODE_NODE_RUNTIME=example/customNodeRuntime:latest`
By default a Fabric Peer v1.4 will create a Nodejs v8 runtime, and a Fabric Peer v2.x will create a Nodejs 12 runtime. Whilst this is the default, the docker image used to host the chaincode and contracts can be altered. Set the environment variable `CORE_CHAINCODE_NODE_RUNTIME` on the peer to the name of the docker image. For example `CORE_CHAINCODE_NODE_RUNTIME=example/customNodeRuntime:latest`

The Node modules will connect to the peer whilst running; this is referred to as 'Fabric Peer Connectivity' in the table. For example, whilst the Fabric Peer v1.4 will create a Nodejs 8 runtime, if a Nodejs 12 runtime was configured, the node modules at v2.x still function when connecting to the Fabric Peer v1.4.

Expand All @@ -32,15 +32,15 @@ Node modules that are produced are `fabric-contract-api`, `fabric-shim`, `fabric

### Supported Runtimes

v2.x Node modules are supported running in Nodejs 10.15+, with the x86_64 architecture.
v2.x Node modules are supported running in Nodejs 12.16.1, with the x86_64 architecture.

v1.4.x Node modules are supported running Nodejs 8.16.1 with the x86_64 architecture.

Architecture Support: all docker images, runtimes, tools are tested under x86_64 ONLY

### Default Peer Runtime selection

When using Fabric 2.x, the default docker image that is used to run the Node chaincode is node:10.15.2-alpine 
When using Fabric 2.x, the default docker image that is used to run the Node chaincode is node:12.16.1-alpine 

*Note:* With the default docker image used by Fabric 2.x, the packaged code will be installed with npm. If a `package-lock.json` or a `npm-shrinkwrap.json` file is present, `npm ci --only=production` will be used. Otherwise `npm install --production` will be used. 

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The following [Rush categories](https://rushjs.io/pages/maintainer/add_to_repo/)

### Pre-requisites

* node v10.15.2 (npm v6.4.1) => recommend to use [nvm](https://github.com/nvm-sh/nvm)
* node v12.16.1 (npm v6.4.1) => recommend to use [nvm](https://github.com/nvm-sh/nvm)
* rush => `npm install -g @microsoft/rush`

> Note that npm v6 has some bugs that mean adding new dependencies etc are not properly picked up. Longer term we should consider moving to yarn or pnpm. However in practice this isn't a serious problem and has been possible to be worked around by issuing `rm ./common/config/rush/npm-shrinkwrap.json` and then `rush update`
Expand All @@ -33,7 +33,7 @@ They also need to have the `nodeenv` image present - this is build as part of th

## Using the repo

* Clone the repo, and ensure you are using node v10, and have rush installed
* Clone the repo, and ensure you are using node v12, and have rush installed
* `rush update` is needed to ensure everything is correctly linked and updated.

At this point the repo is fully ready for use and running tests, etc. A full sequence of build-test that is equivalent to the CI pipeline is
Expand Down
4 changes: 2 additions & 2 deletions TUTORIAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ The dependencies of `fabric-chaincode-api` and `fabric-shim` will be required.
"name": "chaincode",
"description": "My first exciting chaincode implemented in node.js",
"engines": {
"node": "^10.15.2",
"npm": "^6.4.1"
"node": "^12.16.1",
"npm": "^6.13.4"
},
"scripts": {
"test":"mocha.....
Expand Down
2 changes: 1 addition & 1 deletion apis/fabric-contract-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Visit [fabric-shim.github.io](https://fabric-shim.github.io/) and click on "Clas


## Support
Tested with node.js 8.9, and also the v10 LTS release.
Tested with Node v12 LTS release.

## License

Expand Down
2 changes: 1 addition & 1 deletion apis/fabric-contract-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"Fabric Shim"
],
"engines": {
"node": "^10.15.2",
"node": "^12.16.1",
"npm": "^6.4.1"
},
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion apis/fabric-shim-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"Fabric Shim"
],
"engines": {
"node": "^10.15.2",
"node": "^12.16.1",
"npm": "^6.4.1",
"eslint": "6.6.0"
},
Expand Down
8 changes: 4 additions & 4 deletions ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ variables:
- name: pipeline
value: ci
- name: node_version_spec
value: '10.x'
value: '12.16.1'

# Build on Ubuntu
pool:
Expand All @@ -64,7 +64,7 @@ stages:
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version_spec)
versionSpec: 12.15.0
- script: |
set -ev
node common/scripts/install-run-rush.js install
Expand Down Expand Up @@ -141,8 +141,8 @@ stages:
node common/scripts/install-run-rush.js start-fabric
node common/scripts/install-run-rush.js start-verdaccio # script will check for the ci variable and use built images
docker images | grep hyperledger && docker ps -a
node common/scripts/install-run-rush.js test:fv
node common/scripts/install-run-rush.js test:e2e
node common/scripts/install-run-rush.js test:fv --verbose
node common/scripts/install-run-rush.js test:e2e --verbose
displayName: 'FV Tests'
- task: PublishTestResults@2
Expand Down
2 changes: 1 addition & 1 deletion libraries/fabric-shim-crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"Fabric Shim"
],
"engines": {
"node": "^10.15.2",
"node": "^12.16.1",
"npm": "^6.4.1"
},
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion libraries/fabric-shim/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"Fabric Shim"
],
"engines": {
"node": "^10.15.2",
"node": "^12.16.1",
"npm": "^6.4.1"
},
"yargs": {
Expand Down
2 changes: 1 addition & 1 deletion rush.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
* Specify a SemVer range to ensure developers use a Node.js version that is appropriate
* for your repo.
*/
"nodeSupportedVersionRange": ">=10.13.0 <13.0.0",
"nodeSupportedVersionRange": ">=12.15.0 <13.0.0",
/**
* Odd-numbered major versions of Node.js are experimental. Even-numbered releases
* spend six months in a stabilization period before the first Long Term Support (LTS) version.
Expand Down
2 changes: 1 addition & 1 deletion test/chaincodes/annotations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ts_chaincode",
"description": "Chaincode testing typescript functionality and annotations",
"engines": {
"node": "^10.15.2",
"node": "^12.16.1",
"npm": ">=5.3.0"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion test/chaincodes/clientidentity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "chaincode",
"description": "Chaincode testing ClientIdentity functionality",
"engines": {
"node": "^10.15.2",
"node": "^12.16.1",
"npm": ">=5.3.0"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion test/chaincodes/crosschaincode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "chaincode",
"description": "Chaincode testing cross chaincode functionality",
"engines": {
"node": "^10.15.2",
"node": "^12.16.1",
"npm": ">=5.3.0"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion test/chaincodes/crosschaincode2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "chaincode",
"description": "Chaincode testing cross chaincode functionality",
"engines": {
"node":"^10.15.2",
"node":"^12.16.1",
"npm": ">=5.3.0"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion test/chaincodes/crud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "chaincode",
"description": "Chaincode testing crud functionality",
"engines": {
"node": "^10.15.2",
"node": "^12.16.1",
"npm": ">=5.3.0"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion test/chaincodes/encryption/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "chaincode",
"description": "Chaincode testing encryption functionality",
"engines": {
"node": "^10.15.2",
"node": "^12.16.1",
"npm": ">=5.3.0"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion test/chaincodes/events/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "chaincode",
"description": "Chaincode testing events functionality",
"engines": {
"node": "^10.15.2",
"node": "^12.16.1",
"npm": ">=5.3.0"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion test/chaincodes/query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "chaincode",
"description": "Chaincode testing query functionality",
"engines": {
"node": "^10.15.2",
"node": "^12.16.1",
"npm": ">=5.3.0"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion test/chaincodes/scenario/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "chaincode",
"description": "My first exciting chaincode implemented in node.js",
"engines": {
"node": "^10.15.2",
"node": "^12.16.1",
"npm": ">=5.3.0"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion test/fv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"testFabricThirdParty": "0.4.15",
"docsLatestVersion": "release-1.4",
"engines": {
"node": "^10.15.2",
"node": "^12.16.1",
"npm": "^6.4.1"
},
"engineStrict": true,
Expand Down
4 changes: 2 additions & 2 deletions test/fv/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async function install(ccName) {
try {
fs.writeFileSync(npmrc, `registry=http://${ip.address()}:4873`);
const folderName = '/opt/gopath/src/github.com/chaincode/' + ccName;
const cmd = `docker exec %s peer chaincode install -l node -n ${ccName} -v v0 -p ${folderName} --connTimeout 60s`;
const cmd = `docker exec %s peer chaincode install -l node -n ${ccName} -v v0 -p ${folderName} --connTimeout 180s`;
await exec(util.format(cmd, 'org1_cli'));
await exec(util.format(cmd, 'org2_cli'));

Expand All @@ -44,7 +44,7 @@ async function install(ccName) {

async function instantiate(ccName, func, args) {
const cmd = `docker exec org1_cli peer chaincode instantiate ${getTLSArgs()} -o orderer.example.com:7050 -l node -C mychannel -n ${ccName} -v v0 -c '${printArgs(func, args)}' -P 'OR ("Org1MSP.member")'`;
console.log(cmd)
console.log(cmd);
const res = await exec(cmd);
await new Promise(resolve => setTimeout(resolve, 5000));
return res;
Expand Down

0 comments on commit 1917562

Please sign in to comment.