Changing npm proxy in hyperledger composer - hyperledger-fabric

I am facing some issues with my network proxy, so I am trying hit and trial sort of approach to try different proxies. I need to give the proxy configuration during composer network install command within npmConfig file, now once I have given one proxy, how can I change it, as I cannot use composer network install again for same business network.

The npmrcFile option is available on the composer network install command and once the install is done - the npmrcFile is bundled with that install package on the peers.
Because you cannot build a chaincode container due to proxy issues (ie your issues stated), start will not be successful and so thus you cannot use composer network upgrade with -o <options> to upgrade the business network with new npmrcFile changes via 'options'. This is why its best to try it out your proxy configs in a simple Dev Fabric environment - you can blow away the peer each time and install a new Fabric - once it is working (its a one-off task), then you have the correct npmrcFile to install as appropriate etc.
If need be you could use wget http://npmregistry:4873/ from a test docker container (where you do a test npm install) to see if you can connect via your network proxy - then once you know, your config file should be read when it (re-)tries the docker build.
Hope this helps.

Related

Installing and Starting old network (.BNA) files in hlf1.4

I created a network (.BNA) and this installs and starts successfully under hlfv12 using composer v20.9 network install and composer network start commands).
All other components (e.g. composer-rest-server and composer-playground) work fine.
I have successfully installed hlf 1.4 and can get the sample, first-network, generated, up and down.
How can I install and start my old network (.BNA) under hlf 1.4? I understand Composer v20.9 does still work under hlf1.4.
Thanks.

Hyperledger Caliper tutorial for Composer network

I want to execute a performance evaluation test on a deployed Hyperledger Composer business network using Hyperledger Caliper.
Into the official documentation there is a section for the Composer configuration but I think that it's not very user friendly for those approaching this framework for the first time and I cannot find a better basic step-by-step tutorial for configuring and running an evaluation test.
Check that all the prerequisites are installed:
NodeJS 8 (LTS), 9, or 10 (LTS) higher versions are not supported as
the dependancy chain does not permit this
node-gyp
Docker
Docker-compose
Build Caliper:
Run npm install in Caliper root folder to install base dependencies locally
Run npm run repoclean in Caliper root folder to ensure that all the packages are clean
Run npm run bootstrap to bootstrap the packages in the Caliper repository. This will install all package dependancies and link any cross dependancies. It will take some time to finish installation. If it is interrupted by ctrl+c, please recover the file package.json first and then run npm run bootstrap again.
Do not run any of the above commands with sudo, as it will cause the bootstrap process to fail
Install the Caliper CLI
Execute the following command from the packages/caliper-tests-integration directory:
npm run e2e_install
Run a Sample Benchmark
from caliper/packages/caliper-samples/ run
caliper benchmark run -c benchmark/composer/config.yaml -n network/fabric-v1.3/2org1peercouchdb/composer.json -w ../caliper-samples/
where the parameters means:
-w : path to a workspace directory (required)
-c : relative path from the workspace to the benchmark configuration file (required).
-n : relative path from the workspace to the config file of the blockchain network under test (required).
To create tests for your Business Network you need to modify the config.yaml and composer.json files. You also have to create a .js file where you need to implement the test to be runned, and specify the path to this file in the callback section of config.yaml file.
For more informations check https://hyperledger.github.io/caliper/docs/1_Getting_Started.html

Error trying to enroll user and return certificates

I am trying to deploy Hyperledger Composer Business Network to IBM Blockchain Platform BaaS on IBM Cloud. I used the following steps:
Create connection.json
Create composer card for admin identity
Import the card to composer
Request certificates for an identity
When I am trying step 4, I am getting an error stating:
"Error: failed to request identity. Error trying to enroll user and return certificates. Error: Calling enrollment endpoint failed with error [Error: connect ECONNREFUSED 169.60.181.250:31011]
Command failed"
I have updated the versions. And I guess the issue is due to network rules which is set in my environment. So I would request IP Range which IBM BaaS Starter and Enterprise kit consumed for Peers, Certification Authority.
Please let me know if anyone have information on IP Series.
I am guessing this is on the Starter Plan?
If so, 1) ensure that you have the latest Node version (8.10.0), and npm (5.6.0). You can check your node version with
node -v and npm with npm -v
If npm or node are earlier versions, update them.
Starter Plan is currently compatible with Composer-cli v0.18.1
2) check your composer-cli version with
composer -v
If it is not v0.18.1, then uninstall composer:
npm uninstall -g composer-cli
and install v0.18.1:
npm install -g composer-cli#0.18.1
Now, once you create your blockchain service on IBM Cloud, when you launch your service, and ensure you are in the overview tab. Click on connection profile -> download, and rename it to connection-profile.json and place it in the folder where you have your .bna file. Then, open up the connection-profile.json file you just downloaded and go all the way to the bottom where you see registrar. Under that, you will see enrollId and 'enrollSecret'. Your first command then should be using that enrollSecret from the connection-profile. Ensure you are in the same directory as your recently downloaded connection-profile.json. The first command should be:
composer card create -f ca.card -p connection-profile.json -u admin -s <enrollSecret>
after that issue this command:
composer card import -f ca.card -n ca
and lastly:
composer identity request --card ca --path ./credentials
This should solve your problem. Also, I have written a full blog of me deploying a custom .bna to Starter Plan if you have any other concerns.

Hyperledger composer install is not installing business network

I am using Ubuntu 16.04.2 LTS as VM, and composer v0.19.1. I have installed all the prerequisites as well as hyperledger composer and fabric by folowing the documents at hyperledger composer playgroung. I have followed the tutorial line by line to make a business network. When I want to install the business network by the following command:
composer network install --card PeerAdmin#hlfv1 --archiveFile tutorial-network#0.0.1.bna
It gives me the following error:
No connection type provided, probably because the connection profile has no 'x-type' property defined.
The screen shot of the error is provided as well.
I have checked and made sure that PeerAdminCard exists by
composer card list
And of course Fabric is started. I highly appreciate if someone mentions what I am doing wrong. Thank you.
The 2nd problem you are having is with the createPeerAdminCard.sh script - you are using an 'old' version of the where the default is Fabric v1.0.
The default is assuming hlfv1 because the environment variable FABRIC_VERSION is not set. So the createPeerAdminCard.sh script assumes you want a hlfv1 card and creates the files, but Composer v0.19 can't import that old card at the end of the script.
The fast solution is to export FABRIC_VERSION="hlfv11" then run the createPeerAdminCard.sh
I suspect that you may also have a problem with hlfv1 / v11 with the Fabric. You can check the Fabric version by running docker ps or docker images - if they have 1.0 at the end you need to remove them all and run downloadFabric.sh in the same window as you exported the FABRIC_VERSION variable, then run startFabric.sh
You need to remember to export that environment variable everytime you run one of those Fabric Tools scripts - so the better answer might be to delete the Fabric Tools folder and all docker Images and Containers - then download a new version of Fabric tools which includes the new default for Fabric 1.0
I was getting exactly the same error as you. Turns out if you update the Composer from version 0.16 or earlier, the card store still has the old PeerAdmin card which is now not compatible with version 0.19. Even deleting the card using composer card delete --card <CARD_NAME_HERE> doesn't work. The quick and dirty solution is to manually delete the card store. It is normally in ${HOME}/.composer, so to deleting this directory should work.
rm -fr ${HOME}/.composer
For your other problems, the easiest solution is to replace your older version of Hyperledger and do a new install from scratch. That means removing composer as well as killing and removing all previous Docker containers:
docker kill $(docker ps -q)
docker rm $(docker ps -aq)
docker rmi $(docker images dev-* -q)
Basically start from a clean slate if you can!
When you upgrade the composer modules from an earlier version to the latest version connection profile will not be compatible with the system. An ideal solution is to remove and delete the composer folder and create the .composer folder from the home directory and try creating PeerAdmin card again. Once that is done you are good to go for installing the starting the new business network application.

Build Meteor in Docker cannot pass proxy setting

I use latest Nodejs image as base image to build meteor project. The docker is behind the corporate proxy.
I tried curl and npm install -g. Both of them can go through the proxy and download packages.
However, when I try to use meteor update, error prompts as:
Unable to update package catalog (are you offline?)
=> Errors while upgrading packages:
error: tunneling socket could not be established, cause=socket hang up
Then the next step is using run meteor build, and I sometimes also got the error as
error: tunneling socket could not be established,
cause=140434436118336:error:140770FC:SSL
routines:SSL23_GET_SERVER_HELLO:unknown
protocol:../deps/openssl/openssl/ssl/s23_clnt.c:795:
I test the proxy setting by echo it before I ran meteor command. It shown correctly.
Can anyone help? There is an bug fixes in meteor states that meteor can use http_proxy setting. https://github.com/meteor/meteor/commit/3177d9ad416ae97a98a2b8c4b2b40a9fc03f6b9c
I've actually found this to be an issue that occurs with docker across a couple of projects and solve it by simply restarting my docker machine (working on OSX)
$ docker-machine restart dev
Also Meteor doesn't support the more recent versions of node due in part to complexities associated with Fibers, you'll probably want to build your container FROM node:0.10.40

Resources