Hyperledger fabric 使用本地npm注册表在Hyperledger Composer中实例化链码

Hyperledger fabric 使用本地npm注册表在Hyperledger Composer中实例化链码,hyperledger-fabric,hyperledger,hyperledger-composer,Hyperledger Fabric,Hyperledger,Hyperledger Composer,我想在没有任何Internet连接的环境中实例化链码。由于chaincode容器在实例化时将发出npm install,因此我在docker composer.yml中添加了一个名为npmregistry的新容器,以便它与其他结构容器一起供应,并且属于同一个docker网络(composer\u默认值)。注意:我使用的是fabric工具(下载自) 在npmConfig配置中,我输入:registry=并发出命令来部署BNA composer network install --card Peer

我想在没有任何Internet连接的环境中实例化链码。由于chaincode容器在实例化时将发出
npm install
,因此我在
docker composer.yml
中添加了一个名为
npmregistry
的新容器,以便它与其他结构容器一起供应,并且属于同一个docker网络(composer\u默认值)。注意:我使用的是
fabric工具(下载自)

在npmConfig配置中,我输入:registry=并发出命令来部署BNA

composer network install --card PeerAdmin@hlfv1 --archiveFile ~/Downloads/vehicle-manufacture-network.bna -o npmrcFile=/home/user/npmConfig

composer network start -n vehicle-manufacture-network -V 0.2.4-deploy.0 -c PeerAdmin@hlfv1 -A admin -S adminpw -f networkadmin.card
但是,chaincode容器看不到,无法解析verdaccio(npmregistry)容器

我确保verdaccio容器与其他容器位于同一网络中,并发出
wgethttp://npmregistry:4873/
来自对等容器的操作成功。因此,我“欺骗”了一点,并试图将docker网络网关IP地址硬编码到npmConfig中

registry=http://172.18.0.1:4873/
我重新开始了部署,现在一切正常了。看到下面的verdaccio日志,由于无法访问internet,它会退回到本地repo(文件夹中已经有可用的包)

但在部署期间,我收到了以下错误:

Response from attempted peer comms was an error: Error: 8 RESOURCE_EXHAUSTED: received trailing metadata size exceeds limit
查看对等日志,我发现以下内容:

2018-04-18 00:47:41.913 UTC [util] DockerBuild -> DEBU 4b7 Attempting build with image hyperledger/fabric-ccenv:x86_64-1.1.0
2018-04-18 00:48:26.098 UTC [chaincode-platform] func1 -> ERRO 4b8 Failed to generate platform-specific docker build: Error returned from build: 1 "npm WARN deprecated fs-promise@1.0.0: Use mz or fs-extra^3.0 with Promise Support
npm WARN deprecated nodemailer@2.7.2: All versions below 4.0.1 of Nodemailer are deprecated. See https://nodemailer.com/status/
npm WARN deprecated mailcomposer@4.0.1: This project is unmaintained
npm WARN deprecated socks@1.1.9: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN deprecated buildmail@4.0.1: This project is unmaintained
npm WARN deprecated socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0

> x509@0.3.3 install /chaincode/output/node_modules/x509
> node-gyp rebuild

gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: getaddrinfo EAI_AGAIN nodejs.org:443
gyp ERR! stack     at Object._errnoException (util.js:1022:11)
gyp ERR! stack     at errnoException (dns.js:55:15)
gyp ERR! stack     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
gyp ERR! System Linux 4.13.0-38-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /chaincode/output/node_modules/x509
gyp ERR! node -v v8.9.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 

感谢您的帮助。我的环境:

  • 作曲家0.19.0
  • Ubuntu 16.04
  • Hyperledger结构v1.1.0

如果您查看对等方的日志,您可能会看到有关错误的更多详细信息。是的,我附加了对等方日志,因此想到了一些事情。资源耗尽错误意味着您可能已耗尽内存或磁盘空间。另外,对于npm注册表,您是否也将所有依赖关系树包加载到其中,大约需要300个npm包
2018-04-18 00:47:41.913 UTC [util] DockerBuild -> DEBU 4b7 Attempting build with image hyperledger/fabric-ccenv:x86_64-1.1.0
2018-04-18 00:48:26.098 UTC [chaincode-platform] func1 -> ERRO 4b8 Failed to generate platform-specific docker build: Error returned from build: 1 "npm WARN deprecated fs-promise@1.0.0: Use mz or fs-extra^3.0 with Promise Support
npm WARN deprecated nodemailer@2.7.2: All versions below 4.0.1 of Nodemailer are deprecated. See https://nodemailer.com/status/
npm WARN deprecated mailcomposer@4.0.1: This project is unmaintained
npm WARN deprecated socks@1.1.9: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN deprecated buildmail@4.0.1: This project is unmaintained
npm WARN deprecated socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0

> x509@0.3.3 install /chaincode/output/node_modules/x509
> node-gyp rebuild

gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: getaddrinfo EAI_AGAIN nodejs.org:443
gyp ERR! stack     at Object._errnoException (util.js:1022:11)
gyp ERR! stack     at errnoException (dns.js:55:15)
gyp ERR! stack     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
gyp ERR! System Linux 4.13.0-38-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /chaincode/output/node_modules/x509
gyp ERR! node -v v8.9.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok