Docker Swarm
The solution uses Docker Swarm to manage multiple nodes from a single device for easy management. To start a swarm run docker swarm init on your “main” node. This will be the same node you use to start and shut down the network. This will return a command along the lines of docker swarm join --token SWMTKN-1-xxxxxxxx 192.168.1.xxx:2377 which you need to call on all your other nodes to join the network. You can verify that all nodes have been joined by running docker node ls on the initial node. The initial node should also initialize an overlay network by running docker network create -d overlay --attachable hyperledger-fabric.
Start the network
Before you actually run a network you should regenerate your certificates and genesis block, but for a quick up and running test you can use the block and certificates provided in this repository. See the section below on how to regenerate this.
Assuming all prerequisites are installed and docker images are downloaded, run: docker node ls to check that all nodes in swarm is up and running.
To start the network run the command docker stack deploy --compose-file docker-compose-cli.yaml Hyperprov && sudo docker ps -a on your “main” swarm node. Then to start it move to /fabric-ca and run docker-compose up -d
This will start all containers and run a setup script script_ds.sh and utils.sh to create channel, join peers, install chaincode and do some tests on query and invoke.To follow the output of this script, get the id of CLI-container from docker ps that uses fabric-tools and run docker logs -f 6e4c43c974e7 where 6e4c43c974e7 is the id of CLI-container.
If you encounter any problems run docker stack ps Hyperprov --no-trunc on main swarm node to see useful error messages.
Shutting down can be done with docker stack rm Hyperprov on main swarm node, this will shut down all nodes in the network and cause it to lose its state.