Instantiating Chaincode in Hyperledger Composer with local npm registry

限于喜欢 提交于 2019-12-12 09:57:06

问题


I want to instantiate a chaincode in an environment without any Internet connection. As the chaincode container will issue npm install upon instantiation, I added a new container called npmregistry in the docker-composer.yml so that it is provisioned alongside the rest of the Fabric containers and belongs to the same docker network (composer_default). Note I'm using the fabric-tools downloaded from https://hyperledger.github.io/composer/latest/installing/development-tools.html)

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

in the npmConfig config, i put: registry=http://npmregistry:4873/ and I issued the commands to deploy the 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

However, the chaincode container does not see, to resolve the verdaccio (npmregistry) container

I made sure that the verdaccio container is in the same network as others and issuing a wget http://npmregistry:4873/ from the peer container is successful. Thus i "cheated" a bit and attempted to hardcode the docker network gateway IP address into npmConfig

registry=http://172.18.0.1:4873/

I restarted deploying all over again, now it works. Seeing the verdaccio logs below, as there's no internet access, it fallbacks to the local repo (packages already available in the folder)

But during deployment, I received the following error:

Response from attempted peer comms was an error: Error: 8 RESOURCE_EXHAUSTED: received trailing metadata size exceeds limit

Looking into the Peer logs, I found the following:

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 

Any help is appreciated. My environmnent:

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

来源:https://stackoverflow.com/questions/49872981/instantiating-chaincode-in-hyperledger-composer-with-local-npm-registry

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!