Skip to content

Commit d9cfc3d

Browse files
mbwhitejt-nti
authored andcommitted
Correct 2.4 to be Node 16
Also update the compatibility to be clearer on the versions of node that do not work. Version 1.4 libraries will NOT work with node 16 Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
1 parent e1ae5b3 commit d9cfc3d

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

COMPATIBILITY.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,28 @@
22

33
Github is used for code base management, issues should reported in the [FABCN](https://jira.hyperledger.org/projects/FABCN/issues/) component in JIRA.
44

5-
65
## Summary of Compatibility
76

87
This table shows the summary of the compatibility of the Node modules at versions 1.4 and 2.x, together with the Nodejs runtime they require and the Fabric Peer versions they can communicate with.
98

10-
| | Peer Connectivity v1.4 | NodeJS | Peer Connectivity v2.x |
11-
| ------------------------------ | ---------------------- | ------ | ---------------------- |
12-
| Node modules **v1.4.5** | Yes | 8 | Yes |
13-
| Node modules **v2.2.x/v2.3.x** | Yes | 12 | Yes |
14-
| Node modules **v2.4.x** | Yes | 16 | Yes |
9+
| | Peer Connectivity v1.4 | Supported NodeJS | Peer Connectivity v2.x |
10+
| ------------------------------ | ---------------------- | ---------------- | ---------------------- |
11+
| Node modules **v1.4.5** | Yes | 8 | Yes |
12+
| Node modules **v2.2.x/v2.3.x** | Yes | 12 | Yes |
13+
| Node modules **v2.4.x** | Yes | 16 | Yes |
1514

1615
By default a Fabric Peer v1.4 will create a Nodejs v8 runtime, and a Fabric Peer v2.2/2.3 will create a Nodejs 12 runtime. The Fabric v2.4 will create a Nodejs 16 runtime. Whilst these are defaults, 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.
1716

1817
For example `CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:2.1` will allow the use of the latest Node 12 runtime to be used within a Peer v1.4.
1918

2019
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.
2120

21+
### Version 1.4 compatibility with later Nodejs runtimes
22+
2223
Note that the `fabric-contract-api` & `fabric-shim` node modules must be at v1.4.5 or greater to work with Node version 12. If you therefore use a contract originally written to work with Fabric 1.4, check the node modules before deploying on Fabric v2.
2324

25+
Also please note that that the v1.4 libraries WILL NOT work with Node16. Unless you configure a different node environment, any chaincode using the v1.4 libraries will need to move to v2.4 before being able to run with a Fabric v2.4 Peer.
26+
2427
## Compatibility
2528

2629
The key elements are :

docker/fabric-nodeenv/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44
#
5-
ARG NODE_VER=16.4.0
5+
ARG NODE_VER=16
66
FROM node:${NODE_VER}-alpine
77
RUN apk add --no-cache \
88
make \
9-
python \
9+
python3 \
1010
g++;
1111
RUN mkdir -p /chaincode/input \
1212
&& mkdir -p /chaincode/output \

docker/fabric-nodeenv/docker.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@ const util = require('util');
1515
const { shell: runcmds } = require('toolchain');
1616

1717
const version = JSON.parse(fs.readFileSync(path.join(__dirname,'package.json'))).version;
18-
const node_version = process.env.NODE_VERSION || '12.16.1';
1918
const build_dir = path.join(__dirname);
2019
const tag = version + '-' + git.short();
2120

2221
// build and tag the fabric-nodeenv image
2322
const imageBuild = async () => {
2423
await runcmds(
2524
[
26-
util.format('docker build --build-arg NODE_VER=%s -t hyperledger/fabric-nodeenv:%s -f %s %s',
27-
node_version, tag, path.join(build_dir, 'Dockerfile'), build_dir),
25+
util.format('docker build -t hyperledger/fabric-nodeenv:%s -f %s %s',
26+
tag, path.join(build_dir, 'Dockerfile'), build_dir),
2827
util.format('docker tag hyperledger/fabric-nodeenv:%s hyperledger/fabric-nodeenv:%s',
2928
tag, version),
3029
util.format('docker tag hyperledger/fabric-nodeenv:%s hyperledger/fabric-nodeenv:latest', tag)

0 commit comments

Comments
 (0)