sawtooth-raft icon indicating copy to clipboard operation
sawtooth-raft copied to clipboard

Added compose file to setup multinode Raft network on different physi…

Open pankajgoyal2 opened this issue 6 years ago • 5 comments

…cal machines.

Signed-off-by: Pankaj Goyal [email protected]

pankajgoyal2 avatar Mar 28 '19 00:03 pankajgoyal2

How can we test this?

vaporos avatar Mar 28 '19 02:03 vaporos

Steps to create Sawtooth-raft network using docker-swarm

  1. Create 3 physical machines with Ubuntu 18.04. Lets call those machines as node1, node2 and node3
  2. Install docker and docker-compose in all the machines
  3. node1 will be master node and node2 and node3 are worker nodes
  4. open certain ports on all the nodes: 2377/tcp, 7946/udp, 7946/tcp, 4789/udp

Initialize swarm Swarm has to be initialized on master node (node1). In order to do this, run the below command on node1:  docker swarm init The output of above command will be something like this: Swarm initialized: current node (bvz81updecsj6wjz393c09vti) is now a manager.

To add a worker to this swarm, run the following command:

docker swarm join \
--token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx \
172.17.0.2:2377

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions. As the above output shows, worker nodes need to join the swarm by running the following command: docker swarm join
--token SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx
172.17.0.2:2377 So, run the above command on node2 and node3. This way node2 and node3 will join the swarm.

Create swarm network Run the below command on master node (node1) to create swarm network:  docker network create –d overlay raftnetwork The above command creates a network named ‘raftnetwork’ which will be used by the docker compose file.

Validator keys management Run the swarm/validator_keys.yaml file. This will generate the validator key pairs in /home/Ubuntu/validator_keys folder  docker-compose -f swarm/validator_keys.yaml up  docker-compose -f swarm/validator_keys.yaml down

Copy /home/Ubuntu/validator_keys folder in all the other nodes to /home/Ubuntu folder.

Environment variables On master node (node1), define the following variables in swarm/.env file: export TAG=1.1 <1.1/latest/nightly> export node1=<hostname_of_node1> export node2=<hostname_of_node2> export node3=<hostname_of_node3>

Create docker containers Run the below command on master node (node1):  docker stack deploy –c swarm/raft_3_nodes.yml raft You can check all the services started by above command:  docker service ls The above command should show that all services are running. Now, all the containers should be running in respective machines. This can be checked on each node that respective containers are running. On master node, there is a shell conainter running. This can be used to start the intkey workload after generating the user key.

At any time, the services created by stack deploy can be destroyed by:  docker service rm $(docker service ls -q) Services can be started again by running “docker stack deploy –c swarm/raft_3_nodes.yml raft”

pankajgoyal2 avatar Mar 28 '19 03:03 pankajgoyal2

The author on the commit is 'Ubuntu' which is why the DCO is failing.

vaporos avatar Mar 28 '19 03:03 vaporos

Thanks for the nice instructions!

vaporos avatar Mar 28 '19 03:03 vaporos

Could you update your commit message to follow the format described in https://chris.beams.io/posts/git-commit/

Likewise, include some more information about the commit and what it changes/provides.

peterschwarz avatar Apr 22 '19 15:04 peterschwarz