Setup development environment for Hyperledger composer on windows
There is no direct best ( or at least I don’t know ) way to create a good development environment for the hyper ledger composer on windows. I have installed hyper ledger on windows and it’s also not working satisfactorily. I want to develop in windows while want to run it smoothly like in Ubuntu.
So the way I found is virtual box and ssh.
Vagrant is kind of the thing that gives this readymade. But .box file we need to download is very slow in speed [ 150 kbps] and for me, it was disconnecting continuously. So I left the vagrant and find another way to get the facility provided by the vagrant.
I am going to show the way I created my development environment.
That's it. If you have this two things you are ready to go.
Prepare Ubuntu Server Virtual Box Machine
Either install ubuntu 16.04 on the virtual box or import the ubuntu server virtual machine to the Virtual Box.
|Add Ubuntu server virtual box machine|
Open Virtual Machine and install OpenSSH So we can access the VirtualBox machine via ssh from the host os [ windows]
Install OpenSSH Server
|Install open ssh on the ubuntu server machine|
Set Port Forwarding
Now make port forwarding to access the ssh of the virtual machine
Goto the network tab of the virtual machine
- select network tab
- add an entry of ssh
- ssh host port: 3022
- guest port: 22
- hyperledger composer playground
- host port: 10020
- guest port:8080
|set port forwarding|
Set Shared folder
It's actually essential to create a shared folder which is mounted to the ubuntu server VirtualBox machine. So we can use our windows editors to create and modify the files while it also accessible by the ubuntu server VirtualBox machine to execute the code.
To create a shared folder you first need to install the VirtualBox-guest-additions-iso
Traverse to the /usr/share/virtualbox you will find here the VirtualBox-guest-additions.iso file
To install guest additions programs follow the steps
Mount the iso file using mount function
Install the guest additions iso
|Mount and install the virtualbox-guest-additions-iso|
after installing the iso reboot the virtualbox machine and run the following commands
Make a shared folder in the virtualbox
Mount the Windows Share folder on the Ubuntu server
|Mount Shared folder inside the Ubuntu Server VirtualBox Machine|
Setup Hyperledger Composer pre-requests
Now as we have enabled the ssh and also done the port forwarding we can ssh in our virtualbox machine and set up the hyperledger composer.
Start Ubuntuuntu server machine, Open your favourite ssh client [ for me its cmd 😏 ] and ssh through the forwarded port [ that is 3022]
|ssh to your ubuntu server virtualbox machine|
Now run (copy/paste) the following command in the cmd/ssh-client
Upper command will
- fetch the shell script configured to install the programs required for hyperledger composer and
- make the file executable
Upper Command will
- execute the file we just fetched and install all the required programs for the hyperledger composer
After completion of the script, your ubuntu server virtualbox machine is ready to set up the hyperledger-composer on it.
Through ssh run the following commands as well
$ npm install -g composer-cli
$ npm install -g composer-rest-server
$ npm install -g generator-hyperledger-composer
$ npm install -g yo
It's time to install the hyperledger composer playground
$ npm install -g composer-playground
$ curl -O https://raw.githubusercontent.com/hyperledger/composer-tools/master/packages/fabric-dev-servers/fabric-dev-servers.tar.gz
$ tar -xvf fabric-dev-servers.tar.gz
[ This command will fetch the fabric-dev-server and extract it ]
$ cd ~/fabric-tools
$ ./downloadFabric.sh[ This command will fetch the hyperledger fabric - docker images - will take very long ]
$ cd ~/fabric-tools
[ This command will do initail seeding for you ]
after you followed all the steps run the final command
[ This command will spin up the hyper ledger ]
goto the web browser in windows and goto the url
you should get this output
|hyperledger composer on windows using ubuntu virtualbox machine|
Hope you find it useful.
All shell command for install of hyperledger shown here is copied from Hyperledger composer website.