Hyperledger Composer Installation process
Hyperledger Composer Installation process listed below for reference.
Below process taken directly from Hyperledger Composer Documentation. This is specifically for creating a development environment and rather using a Playground online or local. The only difference here is that, I have given screenshots about each step.
Step 1: Pre-requisites check
Step 2: Installing Hyperledger Composer development tools
Step 3: Optional tools
Step 4: Starting Hyperledger Fabric
Hyperledger Composer Installation steps,
Step 1: Pre-requisites check (this one is mandatory and important before installation)
1.1 To run Hyperledger Composer and Hyperledger Fabric, we recommend you have at least 4Gb of memory.
The following are prerequisites for installing the required development tools:
- Operating Systems: Ubuntu Linux 14.04 / 16.04 LTS (both 64-bit), or Mac OS 10.12
- Docker Engine: Version 17.03 or higher
- Docker-Compose: Version 1.8 or higher
- Node: 8.9 or higher (note version 9 is not supported)
- npm: v5.x
- git: 2.9.x or higher
- Python: 2.7.x
- A code editor of your choice, we recommend VSCode.
If installing Hyperledger Composer using Linux, be aware of the following advice:
- Login as a normal user, rather than root.
- Do not su to root.
- When installing prerequisites, use curl, then unzip using sudo.
- Run prereqs-ubuntu.sh as a normal user. It may prompt for root password as some of it’s actions are required to be run as root.
- Do not use npm with sudo or su to root to use it.
- Avoid installing node globally as root.**
1.2 Download the sh file as mentioned below
curl -O https://hyperledger.github.io/composer/prereqs-ubuntu.sh
chmod u+x prereqs-ubuntu.sh
./prereqs-ubuntu.sh
This step takes sometime as OS updates go through along with installation of nodejs, npm & docker. Below screenshots for reference for entire installation of this script.
Upon completion, please logout of the session and then move to Step 2. A new terminal session should be opened here.
Step 2: Installing Hyperledger Composer development tools
Follow below process to install Hyperledger Composer development tools. Below packages need to be installed using non root user. Cross check node and npm version before proceeding further.
2.1 composer-cli
The composer-cli contains all the command line operations for developing business networks.
command: npm install -g composer-cli
2.2 generator-hyperledger-composer
The generator-hyperledger-composer is a Yeoman plugin that creates bespoke applications for your business network.
command: npm install -g generator-hyperledger-composer
2.3 composer-rest-server
The composer-rest-server uses the Hyperledger Composer LoopBack Connector to connect to a business network, extract the models and then present a page containing the REST APIs that have been generated for the model.
command: npm install -g composer-rest-server
2.4 Yeoman
Yeoman is a tool for generating applications. When combined with the generator-hyperledger-composer component, it can interpret business networks and generate applications based on them.
command: npm install -g yo
Step 3: Optional tools
3.1 Install the Hyperledger Composer VSCode plugin from the VSCode marketplace.
3.2 If you want to run the connect to a business network using the Playground locally, install the composer-playground using the following command.
command: npm install -g composer-playground
3.3 To run the playground locally run the following command
command: composer-playground
Playground should open automatically at the following address: http://localhost:8080/login
This completes Composer installation process.
Step 4: Starting Hyperledger Fabric
Create any new directory under specific directory that you are working on. As mentioned in the site, we will use the same directory, fabric-tools folder here.
mkdir fabric-tools
cd fabric-tools
curl -O https://raw.githubusercontent.com/hyperledger/composer-tools/master/packages/fabric-dev-servers/fabric-dev-servers.zip
unzip fabric-dev-servers.zip
If this is the first time, you’ll need to download the fabric runtime first. If you have already downloaded it, then start the fabric environment, and create a Hyperledger Composer profile. After that you can then choose to stop the fabric, and start it again later.
cd fabric-tools
./downloadFabric.sh
list the docker images that were downloaded in above step.
./startFabric.sh
./createPeerAdminCard.sh
Then at the end of your development session we can execute below commands,
./stopFabric.sh
./teardownFabric.sh
This completes setting up Hyperledger Composer development environment in our local system. Refer to this blog entry that contains details about Hyperledger project.