https://github.com/benhid/314-swarm

DIY Raspberry Pi (Zero) cluster with Docker Swarm

https://github.com/benhid/314-swarm

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.5%) to scientific vocabulary

Keywords

cluster diy docker docker-swarm raspberry-pi-zero raspbian-stretch swarm-cluster
Last synced: 5 months ago · JSON representation

Repository

DIY Raspberry Pi (Zero) cluster with Docker Swarm

Basic Info
  • Host: GitHub
  • Owner: benhid
  • License: mit
  • Default Branch: master
  • Homepage:
  • Size: 132 KB
Statistics
  • Stars: 8
  • Watchers: 1
  • Forks: 3
  • Open Issues: 0
  • Releases: 0
Topics
cluster diy docker docker-swarm raspberry-pi-zero raspbian-stretch swarm-cluster
Created almost 8 years ago · Last pushed almost 8 years ago
Metadata Files
Readme License

README.md


zeroSwarm

Raspberry Pi (Zero) cluster with Docker Swarm

Stuff you'll need

In this project I'll use:

| Material | Units | Price | | ------------- |:-------------:| -----:| | Raspberry Pi Zero W | x2 | ~10€/each | | Samsung EVO (class 10) 32GB microSD card | x2 | ~13€/each | | 5V 2.4A Dual USB Charger | 1x | ~10€ | | (optional) TP-LINK TL-WR802N Nano router | 1x | ~25€ |

Steps

  1. Install Raspbian Stretch Lite on each microSD card. I've used the version from 2018-03-13.
  2. Enable SSH and set up Wi-Fi. In order to do this, insert the microSD into your pc, navigate to /media/YOUR_USER_NAME/boot and create an empty shh file: bash $ sudo touch ssh Then, open the other volume and use sudo nano /etc/wpa_supplicant/wpa_supplicant.conf to include the following lines: network={ ssid="YOUR_NETWORK_NAME" psk="YOUR_PASSWORD" key_mgmt=WPA-PSK }
  3. Reproduce step 2 on each microSD and turn on all the Raspberry's.
  4. After 20 seconds, scan your network to find the IP of each Raspberry Pi Zero. You can either access your Wi-Fi router's settings or use: bash $ sudo nmap -sn 192.168.1.0/24 Note: This step is optional if you have set up static IP addresses for all your nodes.
  5. SSH into your nodes (ssh pi@192.168.1.XYZ) and install Docker. By default the password is raspberry. Then (for each node) run: bash pi@raspberrypi:~ $ curl -sSL https://get.docker.com | sh Note: This will take a while!
  6. Only on the first (master) node initialize the swarm by using: bash pi@raspberrypi:~ $ sudo docker swarm init --advertise-addr 192.168.1.XYZ Where 192.168.1.XYZ is the IP of the current node. This will generate a command that will be used to add the rest of the nodes to the swarm.
  7. SSH into the rest of the nodes and run the command produced on the previous step to connect the swarm.
  8. On the master node (the one from step 6), run: bash pi@raspberrypi:~ $ sudo docker node ls to check all the nodes on the swarm. You can create a swarm of one manager node, but you cannot have a worker node without at least one manager node. This means that we'll have to promote our second node to a manager: bash pi@raspberrypi:~ $ sudo docker promote NODE_ID Node NODE_ID promoted to a manager in the swarm.

Now, let's create a service in our swarm with docker service create: bash pi@raspberrypi:~ $ sudo docker service create \ --name viz \ --publish 8080:8080/tcp \ --constraint node.role==manager \ --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \ alexellis2/visualizer-arm:latest

This will build and start an image with just one replica: pi@raspberrypi:~ $ sudo docker service ls ID NAME MODE REPLICAS IMAGE PORTS xxxx viz replicated 1/1 alexellis2/visualizer-arm:latest *:8080->8080/tcp

To scale that image, run: pi@raspberrypi:~ $ sudo docker service scale viz=4

At this point you should be able to visit 192.168.1.XYZ:8080 to see a nice swarm visualizer:


Visualizer

Congrats!

Owner

  • Name: Antonio
  • Login: benhid
  • Kind: user
  • Location: Málaga, Spain
  • Company: University of Málaga

Software / DevOps Engineer and Researcher @KhaosResearch

GitHub Events

Total
Last Year

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 5
  • Total Committers: 1
  • Avg Commits per committer: 5.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
benhid m****e@h****m 5

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels