Skip to content
Snippets Groups Projects
README.md 2.82 KiB
Newer Older
Francisco Damiao's avatar
Francisco Damiao committed
# Purpose:

This repository contains the necessary scripts and tools to instatiate a Hyperledger Blockchain network for development.
Francisco Damiao's avatar
Francisco Damiao committed
The installation script also deploys the Anchoring Codechain (Smart Contract) for OpenDSU anchors with the associated node based REST server.
Francisco Damiao's avatar
Francisco Damiao committed
# Installation:
Francisco Damiao's avatar
Francisco Damiao committed
Installation of all the necessary components is achieved by running the **install-all.sh** script. Make sure that you have **git** and **curl** installed.
Francisco Damiao's avatar
Francisco Damiao committed
Notice that the Hyperledger Fabric network is downloaded and installed by executing the Hyperledger installation script from the internet. If security reasons arise download and execute the script manually.
Francisco Damiao's avatar
Francisco Damiao committed
# Starting up and initializing:
Francisco Damiao's avatar
Francisco Damiao committed
Run the **startInit.sh** script only once to create and start the necessary docker containers.
Francisco Damiao's avatar
Francisco Damiao committed
Startup progress can be followed by previously running the *monitordocker.sh* script in another shell window.
Francisco Damiao's avatar
Francisco Damiao committed
This script will download all the necessary docker images for the Hyperledger containers, create the necessary crypto material, deploy the codechain and build, deploy and start the hlf-adapter container.
Francisco Damiao's avatar
Francisco Damiao committed
# Starting:
Francisco Damiao's avatar
Francisco Damiao committed
Run this command only if the system was already initialized with the **startInit.sh** command and it was stopped with the **stop.sh** command. This will start all containers while preserving ledger data.
Francisco Damiao's avatar
Francisco Damiao committed
# Stopping:
Francisco Damiao's avatar
Francisco Damiao committed
Run this command: **./stop.sh** to stop all the system containters, without loosing data.
Francisco Damiao's avatar
Francisco Damiao committed

# Stopping and removing:

Run the *stopDown.sh* command to stop all containers and remove them from the system. This operation will delete all ledger data.
## Note

For some uses this has been reported to fail with errors such as:
```txt
Removing network fabric_test
ERROR: error while removing network: network fabric_test id fcf19eadfcea1635308b69394e3eea32dbf42171c9abb48948a2b386c4325030 has active endpoints
Error: No such volume: docker_orderer.example.com
Error: No such volume: docker_peer0.org1.example.com
Error: No such volume: docker_peer0.org2.example.com
```

If it happens manually remove the network and volumes with commands such as 
```sh
$ docker network prune
$ docker volume prune
```
but be *careful* that these commands will also remove other networks
and volumes that are not in use by running containers.

# Configure the environment:

Francisco Damiao's avatar
Francisco Damiao committed
If needed to run Hyperledger commands, just run the script **configenv.sh** with the command **source ./configenv.sh** . **IMPORTANT:** The script should be **sourced** for the environment variables to pass to the global environment to use the Hyperledger tools
Francisco Damiao's avatar
Francisco Damiao committed

This just configures the environment with the path to the Hyperledger binaries without the need of a global machine configuration to user Organization1.

# TL;DR:

Francisco Damiao's avatar
Francisco Damiao committed
**Start 1st time:**
 './install-all.sh
Francisco Damiao's avatar
Francisco Damiao committed
./startInit.sh'
Francisco Damiao's avatar
Francisco Damiao committed
**Stopping:**
 './stop.sh'
Francisco Damiao's avatar
Francisco Damiao committed
**Starting up again:**
 './start.sh'
Francisco Damiao's avatar
Francisco Damiao committed
**Stop all and purge all data:**
 './stopDown.sh'