Skip to content

Instantly share code, notes, and snippets.

@sumitpatel93
Created June 22, 2020 18:29
Show Gist options
  • Save sumitpatel93/57d1d89e19100f14dcaa01f33dd41296 to your computer and use it in GitHub Desktop.
Save sumitpatel93/57d1d89e19100f14dcaa01f33dd41296 to your computer and use it in GitHub Desktop.
https://medium.com/@malliksarvepalli/hyperledger-fabric-1-4-on-multiple-hosts-using-docker-swarm-and-compose-ec668db0bad5
https://usuarioperu.com/2019/11/18/hyperledger-fabric-docker-swarm-multiples-hosts/
HOST 1 --->[email protected]
HOST 2 ---> ip-172.31.35.202
HOST 3 ---> ip-172.31.23.92
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y build-essential
sudo snap install docker
#Install docker compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# fabric binaries of 1.4
curl https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash -s -- 1.4.0 1.4.0 -d -s
If error comes in pulling the images
sudo chmod 666 /var/run/docker.sock
#get 1.4 hlf fabric samples
curl -sSL http://bit.ly/2ysbOFE | bash -s -- 1.4.7 1.4.7 0.4.20
# To start the swarm network
On host 1
sudo docker swarm init --advertise-addr <IP-address-of-manager>
docker swarm init : this will make the current node, as a manager of the network and token will be given
**Do check the ports , that they all are open on both hosts
On host 2
docker swarm join --token SWMTKN-1-3wzgyordg866tp2hv756qxz6g1lts528xqyihaldn35hn3vmw1-3uqj63nifvdf5ivhqsa39jb42 172.31.36.188:2377
#Create a network ("hyp-net" in my case) on manager host
docker network create --attachable --driver overlay hyp-net
docker network create first-network
#if you want to copy any folder from local to ec2
scp -i henrietta-blockchain.pem henrietta-blockchain.pem [email protected]:~
scp -i henrietta-blockchain.pem [email protected]:~/fabric-samples/fabric-multi-network/channel-artifacts ~/Downloads
#Copy files from ec2 to local
scp -i /directory/to/abc.pem [email protected]:path/to/file /your/local/directory/files/to/download
scp -i henrietta-blockchain.pem [email protected]:~/go.zip ~/Downloads
#Copy files from one ec2 to another ec2
scp -i ~/Path-To-Key-File/AAA.pem /path/file ec2-user@<Private IP of Machine B>:/path/file
scp -i ~/henrietta-blockchain.pem /fabric-samples/fabric-multi-network/channel-artifacts.zip [email protected]:/fabric-samples/fabric-multi-network
# To find the list of processes running on the machine
sudo netstat -plntu
# kill a process
sudo pkill <process name>
#zip a folder
zip -r filename.zip /path/to/folder1 /path/to/file2
#change the hostname of the ec2
sudo hostnamectl set-hostname hospital.localdomain
commands by sirgui
bash byfn.sh generate
bash start.sh up -d
docker logs -f orderer.example.com
bash byfn.sh down
docker system prune --volumes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment