使用本地npm注册表在Hyperledger Composer中实例化Chaincode

时间:2018-04-17 08:13:00

标签: hyperledger-fabric hyperledger hyperledger-composer

我想在没有任何Internet连接的环境中实例化链代码。由于链代码容器在实例化时会发出npm install,我在npmregistry中添加了一个名为docker-composer.yml的新容器,以便它与其他Fabric容器一起配置并属于同一个docker网络(composer_default)。请注意,我使用的是从https://hyperledger.github.io/composer/latest/installing/development-tools.html下载的fabric-tools

npmregistry:
    container_name: npmregistry
    image: verdaccio/verdaccio
    volumes:
      - /home/user/repo/:/verdaccio/storage/
    ports:
      - 4873:4873

在npmConfig配置中,我把:registry = http://npmregistry:4873/并发出命令来部署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

但是,链代码容器看不到,要解析verdaccio(npmregistry)容器 enter image description here

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

registry=http://172.18.0.1:4873/

我重新开始重新部署,现在它可以工作了。看到下面的verdaccio日志,因为没有互联网访问,它回退到本地仓库(文件夹中已有的包)

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

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 

enter image description here

enter image description here

感谢任何帮助。我的环境:

  • Composer 0.19.0
  • Ubuntu 16.04
  • Hyperledger Fabric v1.1.0

0 个答案:

没有答案