Skip to content
This repository was archived by the owner on Jan 29, 2022. It is now read-only.

Conversation

@pankajgoyal2
Copy link

…cal machines.

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

@vaporos
Copy link
Contributor

vaporos commented Mar 28, 2019

How can we test this?

@pankajgoyal2
Copy link
Author

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”

@vaporos
Copy link
Contributor

vaporos commented Mar 28, 2019

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

@vaporos
Copy link
Contributor

vaporos commented Mar 28, 2019

Thanks for the nice instructions!

@@ -0,0 +1,362 @@
# Copyright 2018 Intel Corporation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2019

@@ -0,0 +1,37 @@
# Copyright 2018 Intel Corporation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2019

@peterschwarz
Copy link
Contributor

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.

Indroducing a way to create multinode Satooth-raft setup on different physical machines. This way minimizes the effort to create/manage/destroy the multiple docker containers on different containers on different physical machines.
1. validator_keys.yaml: This file helps to create validator pub/priv key pairs for each node
2. .env: This is environment file where the docker images TAG and hostnames of all machines needs to be defined
3. raft_3_nodes.yml: This is the compose file that brings up the 3 node docker based sawtooth-raft setup

Signed-off-by: Pankaj Goyal <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants