• Stars
    star
    156
  • Rank 239,589 (Top 5 %)
  • Language
    Shell
  • License
    MIT License
  • Created almost 9 years ago
  • Updated about 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Hypriot Cluster Lab

Hypriot Cluster Lab

CircleCI

PLEASE NOTE: This repo is currently not maintained.

The Hypriot Cluster Lab allows to create a Docker Swarm Cluster very easily.

The Cluster Lab can be used to

  • run distributed applications in a real or virtual cluster
  • work, learn and experiment with Docker and Docker Swarm Clustering
  • learn about networking, load balancing and high availability
  • ... and much more!

The Cluster Lab is made with love(tm), lots of glue code and technologies such as Docker-Engine, Docker-Compose, Docker-Swarm and Consul.

Key features

Cluster Lab is self-configuring
Cluster-Lab nodes are configured to form a cluster fully automatically. No configuration by the user is necessary.

Cluster Lab is fast to set up
Get started in minutes rather than hours.

Cluster Lab is Multi-Platform
Run Cluster Lab on Mac OS X, Linux, Windows and ARM devices.

Getting started

A node in a Cluster Lab can either be a leader or a follower. The role of a node is determined by the start order of the cluster nodes. The first node autmatically becomes the leader node. All nodes that start after the leader automatically become follower nodes.

Vagrant

To get started with the Cluster Lab based on Vagrant is really easy. Vagrant allows to run the Cluster Lab based on virtual machines.

First ensure that you a have recent version of Vagrant installed and test if it is working:

$ vagrant version
Installed Version: 1.8.1
Latest Version: 1.8.1

You're running an up-to-date version of Vagrant!

Then clone this repository with:

git clone https://github.com/hypriot/cluster-lab.git

Afterwards change into the vagrant subdirectory:

cd cluster-lab/vagrant

To finally start up the Cluster Lab execute the following final command:

vagrant up --provider virtualbox

This should by default create a cluster wth 3 nodes called leader, follower1 and follower2. On each node all the necessary dependencies are installed, configured and started. This can take quite some time. Please be patient.

To log into one of the nodes - for instance - the leader node run the following Vagrant command:

vagrant ssh leader

Replace the last argument with the name of the node you wanna log into.

Then you can check that your Docker Swarm Cluster is working:

$ sudo su
$ docker -H tcp://192.168.200.1:2378 info
Containers: 9
 Running: 9
 Paused: 0
 Stopped: 0
Images: 6
Role: primary
Strategy: spread
Filters: health, port, dependency, affinity, constraint
Nodes: 3
 follower1: 192.168.200.30:2375
  β”” Status: Healthy
  β”” Containers: 3
  β”” Reserved CPUs: 0 / 1
  β”” Reserved Memory: 0 B / 1.018 GiB
  β”” Labels: executiondriver=native-0.2, hypriot.arch=x86_64, hypriot.hierarchy=follower, kernelversion=4.2.0-30-generic, operatingsystem=Ubuntu 15.10, storagedriver=overlay
  β”” Error: (none)
  β”” UpdatedAt: 2016-03-09T22:56:05Z
 follower2: 192.168.200.45:2375
  β”” Status: Healthy
  β”” Containers: 3
  β”” Reserved CPUs: 0 / 1
  β”” Reserved Memory: 0 B / 1.018 GiB
  β”” Labels: executiondriver=native-0.2, hypriot.arch=x86_64, hypriot.hierarchy=follower, kernelversion=4.2.0-30-generic, operatingsystem=Ubuntu 15.10, storagedriver=overlay
  β”” Error: (none)
  β”” UpdatedAt: 2016-03-09T22:56:18Z
 leader: 192.168.200.1:2375
  β”” Status: Healthy
  β”” Containers: 3
  β”” Reserved CPUs: 0 / 1
  β”” Reserved Memory: 0 B / 1.018 GiB
  β”” Labels: executiondriver=native-0.2, hypriot.arch=x86_64, hypriot.hierarchy=leader, kernelversion=4.2.0-30-generic, operatingsystem=Ubuntu 15.10, storagedriver=overlay
  β”” Error: (none)
  β”” UpdatedAt: 2016-03-09T22:56:24Z
Plugins:
 Volume:
 Network:
Kernel Version: 4.2.0-30-generic
Operating System: linux
Architecture: amd64
CPUs: 3
Total Memory: 3.054 GiB
Name: 0a2ac29fe31b

As you can see we now have working Swarm Cluster with 3 nodes.

Raspberry Pi / ARM

To get started with the Cluster Lab on a Raspberry Pi you will need the following:

  • At least two Raspberry Pi's (v1,2,or 3) and for each a _power supply, a MicroSD card and a network cable.
  • A network switch that is connected to the Internet

Note that the network switch must not filter IEEE 802.1Q VLAN flags out of network packets.

Option 1: Flash SD card image and boot each nodes from it

  • Download our SD card image here
  • Flash the image on one SD card for each Raspberry Pi (this script makes flashing easy for you)
  • Plug the SD cards in each node and power only one node on. This node will be the leader of the cluster
  • Get the IP address of this node and open your browser at http://{IP of the leader node}:8500. You should see the Consul web interface listing one node. Proceed with the next step only if you see the web interface. Grant the node about 2 minutes to boot up.
  • Power on all other nodes. After about 2 minutes you should see all of them being listed in the Consul web interface.

Option 2: Install the Cluster Lab as Debian Package

  • Boot one node on the latest HypriotOS (you need "Version 0.5 Will" or above. Other OSes have just not been tested yet.
  • Get the IP of this node and connect to it via SSH (See our getting-started guide with HypriotOS if you need help here!

ssh pi@<IP of the node>

  • Install the Cluster Lab package by executing

sudo apt-get update && sudo apt-get install hypriot-cluster-lab && sudo systemctl start cluster-lab

  • On any device in the same network, open a browser at http://{IP of the node}:8500. You should see the Consul web interface listing one node. Proceed with the next step only if you see the web interface. Grant the node about 2 minutes to boot up.
  • Install the Cluster Lab package on all other nodes with the same command as above. About 2 minutes after each install, you should see the nodes being listed in the Consul web interface.

Troubleshooting

For both the Vagrant and the Raspberry Pi variant of the Cluster Lab the Cluster Lab is managed as a systemd service. This means that the Cluster Lab is started on each node when the node is booting.

The Cluster Lab can be started and stopped on each cluster node like this:

# start Cluster Lab
$ cluster-lab start

# stop Cluster Lab
$ cluster-lab stop

In case of problems the verbosity level of the start and stop commands can be increased to show more information about potential problems.

$ VERBOSE=true cluster-lab start

Internet Connection
  [PASS]   eth1 exists
  [PASS]   eth1 has an ip address
  [PASS]   Internet is reachable
  [PASS]   DNS works

Networking
  [PASS]   eth1 exists
  [PASS]   vlan os package exists
  [PASS]   Avahi os package exists
  [PASS]   Avahi-utils os package exists
  [PASS]   Avahi process exists
  [PASS]   Avahi cluster-leader.service file is absent

Configure basic networking

Networking
  [PASS]   eth1.200 exists
  [PASS]   eth1.200 has correct IP from vlan network
  [PASS]   Cluster leader is reachable
  [PASS]   eth1.200 has exactly one IP
  [PASS]   eth1.200 has no local link address
  [PASS]   Avahi process exists
  [PASS]   Avahi is using eth1.200
  [PASS]   Avahi cluster-leader.service file exists

This node is Leader

DHCP is enabled

DNSmasq
  [PASS]   dnsmasq os package exists
  [PASS]   dnsmasq process exists
  [PASS]   /etc/dnsmasq.conf backup file is absent

Configure DNSmasq

DNSmasq
  [PASS]   dnsmasq process exists
  [PASS]   /etc/dnsmasq.conf backup file exists

Docker
  [PASS]   docker is installed
  [PASS]   Docker process exists
  [PASS]   /etc/default/docker backup file is absent

Configure Docker

Docker
  [PASS]   Docker is running
  [PASS]   Docker is configured to use Consul as key-value store
  [PASS]   Docker is configured to listen via tcp at port 2375
  [PASS]   Docker listens on 192.168.200.30 via tcp at port 2375 (Docker-Engine)

Consul
  [PASS]   Consul Docker image exists
  [PASS]   Consul Docker container is running
  [PASS]   Consul is listening on port 8300
  [PASS]   Consul is listening on port 8301
  [PASS]   Consul is listening on port 8302
  [PASS]   Consul is listening on port 8400
  [PASS]   Consul is listening on port 8500
  [PASS]   Consul is listening on port 8600
  [PASS]   Consul API works
  [PASS]   Cluster-Node is pingable with IP 192.168.200.30
  [PASS]   Cluster-Node is pingable with IP 192.168.200.45
  [PASS]   Cluster-Node is pingable with IP 192.168.200.1
  [PASS]   No Cluster-Node is in status 'failed'
  [PASS]   Consul is able to talk to Docker-Engine on port 7946 (Serf)

Swarm
  [PASS]   Swarm-Join Docker container is running
  [PASS]   Swarm-Manage Docker container is running
  [PASS]   Number of Swarm and Consul nodes is equal which means our cluster is healthy

If everything works there should only be [PASS]ing tests.

There are also two more command that help troubeshoot problems.

After the Cluster Lab is started with cluster-lab start one can verify the health of the cluster on each node with

$ cluster-lab health

This should output the results of various self tests and all should [PASS].

If there are problems/failing tests a good strategy is to stop the Cluster Lab with

$ cluster-lab stop

This should reset the node into the original state it had before the start of the Cluster Lab.

Afterwards we can check if everything is ready for starting the Cluster Lab:

$ cluster-lab dependencies

Here we should also see only [PASS]ing tests.

Community & Help

Get in touch with us and the community in our Gitter chat.

Related projects

Maintainer

  • Andreas Eiermann @firecyberice
  • Mathias Renner @MathiasRenner
  • Govinda Fichtner @Govinda-Fichtner

More Repositories

1

image-builder-rpi

SD card image for Raspberry Pi with Docker: HypriotOS
Ruby
1,065
star
2

flash

Command line script to flash SD card images of any kind
Shell
1,004
star
3

rpi-kernel

Build a Linux kernel for Raspberry Pi 0/1/2/3/3B+
Shell
134
star
4

blog

Repository for the Hypriot Blog
JavaScript
87
star
5

rpi-alpine-scratch

Raspberry Pi compatible Docker Image with a minimal linux system.
Shell
83
star
6

arm-compose

Automated build for docker-compose on ARM
Shell
73
star
7

rpi-node

RPi-compatible Docker image with Node.js
Shell
72
star
8

device-init

Initialize a device on boot with user defined configuration
Go
70
star
9

golang-armbuilds

Pre-compiled GOLANG tarballs for ARM devices.
Shell
69
star
10

os-rootfs

The root filesystem of HypriotOS
Shell
68
star
11

rpi-mysql

RPi-compatible Docker image with Mysql
Shell
67
star
12

rpi-docker-builder

Build steps to build hypriot-docker for Raspberry Pi
Shell
65
star
13

qemu-register

Docker Image to register Qemu interpreters for ARMHF/AARCH64/PPC64LE/Risc-V in Docker Host w/ Linux Kernel 4.8+
Shell
61
star
14

rpi-busybox-httpd

Raspberry Pi compatible Docker Image with a minimal `Busybox httpd` web server.
Makefile
60
star
15

x11-on-HypriotOS

Instructions how to install X11 on a HypriotOS based Raspberry Pi system
Shell
38
star
16

image-builder-odroid-c2

Build SD card image for ODROID C2
Ruby
36
star
17

rpi-node-haproxy-example

Run Node.js webservers behind haproxy with docker-compose on Raspberry Pi
JavaScript
36
star
18

rpi-nano-httpd

A nano sized web server packed into a Docker Nano Container
Assembly
35
star
19

rpi-traefik

Build an ARM docker image for TrΓ¦fΙͺk, a modern reverse proxy
29
star
20

rpi-python

RPi-compatible Docker Image with Python
29
star
21

rpi-node-neopixel-example

Example using Adafruit's NeoPixel with Node.js in Docker on Raspberry Pi
JavaScript
29
star
22

rpi-gogs-raspbian

Raspberry Pi compatible Docker Image with a minimal gogs git server.
Makefile
28
star
23

rpi-alpine

Alpine for ARM
25
star
24

rpi-influxdb

Docker image for InfluxDB on ARM
Shell
25
star
25

rpi-java

RPi-compatible Docker Image with Java
Makefile
22
star
26

image-builder-raw

Raw Image for HypriotOS
Shell
21
star
27

rpi-noip

rpi-noip is a docker image of the official no-ip Dynamic DNS Update client
Dockerfile
20
star
28

rpi-consul

RPi-compatible Docker Image with Consul
Makefile
20
star
29

Pirate-ShieldTV

Hacking the Nvidia ShieldTV to use Ubuntu Linux for ARM64/AARCH64
Shell
19
star
30

rpi-redis

RPi-compatible Docker Image with Redis
Shell
18
star
31

rpi-cluster-lab-demos

Demos for the Hypriot Cluster Lab
18
star
32

rpi-dockerui

Builder for an ARM compatible Docker image of https://github.com/crosbymichael/dockerui
17
star
33

docker-machine-hypriot

Docker Machine driver for Hypriot
Shell
16
star
34

image-builder-odroid-xu4

Build SD card image for ODROID XU4
Ruby
16
star
35

rpi-drone

Raspberry Pi compatible Docker Image with drone CI server
Makefile
15
star
36

rpi-swarm

Raspberry Pi compatible Docker image with Docker Swarm - https://github.com/docker/swarm
15
star
37

rpi-golang

Docker Image packaging for GOLANG, used for Raspberry Pi
Makefile
15
star
38

image-builder-odroid-c1

Build SD card image for ODROID C1 and C1+
Ruby
15
star
39

image-builder-nvidia-shieldtv

Build SD card image for NVIDIA ShieldTV
Ruby
14
star
40

rpi-node-example-hello-world

Node.js example in Docker for Raspberry Pi
HTML
12
star
41

rpi-hugo

Raspberry Pi compatible Docker Image with Hugo - a static webpage builder
Makefile
10
star
42

rpi-whoami

Simple Docker Image that prints its Container ID. For RPi only.
Go
9
star
43

image-builder

Docker image for Hypriot's image-builder-* repos
Dockerfile
9
star
44

rpi-iojs

RPi-compatible Docker Image with io.js
Makefile
8
star
45

rpi-ruby

RPi-compatible Docker image with Ruby
8
star
46

rpi-tor-relay

7
star
47

arm-machine

Automated build for docker-machine on ARM
Shell
6
star
48

swarmlab

Vagrant-based Swarmlab to easily experiment with Docker Swarm Mode.
Shell
6
star
49

rpi-kitematic

Put Kitematic into a Docker Container Image and run it locally on your Raspberry Pi.
Shell
6
star
50

armhf-busybox

busybox ARM Docker container image
Ruby
5
star
51

hypriot.github.io

HTML
5
star
52

rpi-google-coder

Google Coder as ARM compatible Docker image
Makefile
5
star
53

rpi-registrator

Builder for an ARM compatible Docker image of https://github.com/gliderlabs/registrator.
5
star
54

talk

The team at Hypriot simplifies the way you get Docker running on ARM. Let's talk about this in our Gitter chatroom!
3
star
55

image-builder-bananapi

Build SD card image for Banana Pi
Ruby
3
star
56

rpi-crate

RPi-compatible Docker Image with Crate.io
Makefile
3
star
57

rpi-cron-example

RPi-compatible Docker Image - example usage of a cron job in a container
Makefile
2
star
58

rpi-minecraft

Shell
2
star
59

dockerfiles

Repository for our internal dockerfiles
Makefile
2
star
60

hypriot-talks

This is your first repository
HTML
2
star
61

rpi-consul-template

Raspberry Pi compatible Docker Image of Consul Template
Makefile
2
star
62

rpi-java-hello-world

A Hello World in Java with a RPi compatible Docker image
Java
2
star
63

hardware-lists

Contains lists of hardware that is recommended to use in Hypriot projects.
2
star
64

rpi-openvswitch-builder

Builder for Open vSwitch packages compatible to the Raspberry Pi
Shell
2
star
65

image-builder-cubie

This is your first repository
Shell
1
star
66

armhf-hello-world

ARM version of hello-world
1
star
67

rpi-noobs-builder

create NOOBS zip with HypriotOS
Shell
1
star