Hyperledger Fabric v1.0 on a Raspberry Pi Docker Swarm – Part 3

As I said in my last post this step is fairly easy and overall gave me the least amount of trouble.

  1. Setting up a Hyperledger Fabric development environment on a Raspberry Pi
  2. Building Hyperledger Fabric on Raspberry Pi
  3. Setting up a Docker Swarm on Raspberry Pi
  4. Deploying a Hyperledger Fabric network on the Swarm with Docker Stack and testing with BYFN.

Before we dive in I want to mention some prerequisite equipment you’ll need.  You  should have at least 3 Raspberry Pis (<– this looks so wrong to me… Pies?) to setup up a true Raspberry Pi Docker Swarm.  This means you’ll need SD card for each and a way to power them, I recommend a USB power hub like this (something with 60 watts and 6 ports).

Establishing the Master

If you’ve been following along with this series you should already have a RasPi setup to do your builds we’ll use this same RasPi as our Swarm Master.  I recommend connecting to your master via SSH so you can copy the token from the following command.
docker swarm init

Setup your additional Raspis

Now that we have a master and our join token lets setup our workers.  This process should feel pretty similar to the setup from step 1, because it is.

  • Put Raspbian Lite on your SD card (I’m using Raspbian Stretch Lite and Etcher).
  • Bootup & Login
    • Default User: pi
    • Default Pass: raspberry
  • Perform initial config of your RasPi
    sudo raspi-config

    • Change the password
    • Network Options:
      • Change the hostname (something like hyperledger-swarm-nodeX <– this will be important in the next step if yours are different than mine)
      • Connect to WiFi (unless you want to use a switch and wires…)
    • Localisation Options (Optional):
      • Set the timezone
      • Localise the keyboard to the US
      • Set the WiFi country to the US
    • Interface Options:
      • Enable SSH
    • Advanced Options:
      • Memory Split = 16 (MB)
  • Ensure your WiFi is up (ifconfig – make sure you have an IP on wlan0)
  • Update and upgrade
    sudo apt-get update
    sudo apt-get dist-upgrade
  • Reboot after upgrade
    sudo reboot
  • Install Docker
    curl -sSL https://get.docker.com | sh
  • Create a new user
    sudo adduser *username*
    sudo usermod -aG sudo *username*
    sudo usermod -aG docker *username*
  • Install git
    sudo apt-get install git

Notes

Some of my RasPis are old and finicky…

If you run into issues with Hash Sum mismatches or notice that things like apt-get update take FOREVER check your wifi signal (sudo iwlist wlan0 scan).  2 of my 5 RasPis have issues with their on board WiFi now.  I’m not sure if the issue is hardware or Stretch related… but I put a dongle from my old RasPi 2 on one of my 3s and plugged ethernet into the other one and that seemed to resolve the issue.

Add Nodes to the Swarm

Once the RasPi is configured ssh into it and paste in the docker swarm join command and token that was outputed from the swarm init command into your terminal.

docker swarm join --token SWMTKN-1-xxxxxxxx 192.168.1.xxx:2377

Should output:

This node joined a swarm as a worker.

Verify

Once all of your nodes have been added check your master node and confirm that it’s got all of them registered.
docker node ls

Should output:

ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
bwspa23y1q9u8vf9o47z4nzl7 * hyperledger-swarm-master Ready Active Leader
jprbnpd43aob1fdwb5gcxv5ke hyperledger-swarm-node1 Ready Active
u19qeett9ycr0qg4mpjimv3zk hyperledger-swarm-node2 Ready Active
84cbc1zwt385bplvvwl38kcah hyperledger-swarm-node3 Ready Active

That’s it now we are ready for the grand finale, running the E2E test on our swarm.  See you on the next one.

4 thoughts on “Hyperledger Fabric v1.0 on a Raspberry Pi Docker Swarm – Part 3

  1. Kevin says:

    Thanks for these wonderful tutorial, this is exactly what I’m trying to achieve. Thus, I’m looking forward to hear about the 4th step 🙂 (Which will help me a lot for my project)

    You are the best,

    Kev

  2. jo says:

    Can’ wait part 4 😉

  3. Leez says:

    I have been following this blog for updates. Have you managed to run the network?

    1. Joe says:

      Yes, at least I did last year… I’ll be going through the BYFN stuff in my next post.

Tell me what you REALLY think...

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>