Git Product home page Git Product logo

pidoc's Introduction

pidoc

Please see original article here.

TL;DR

An autoconfiguring stack to build simple, scalable, and fully binary ARM compatible Raspberry Pi clusters on Intel or AMD architecture.

Stack

  1. Linux (host OS)
  2. Docker
  3. QEMU (containerized inside Docker)
  4. Raspbian (containerized inside QEMU)
  5. Docker Compose
  6. Ansible (on host)

Install Docker

sudo apt -y install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
apt-cache policy docker-ce
sudo apt -y install docker-ce

Add Current User to Docker Group

sudo usermod -aG docker ${USER}
exec ${SHELL}

Clone Repository

git clone https://github.com/mrhavens/pidoc.git
cd pidoc

Build Image

The Dockerfile is used to build two containers. The first container is the build container that includes all the dependencies for compiling QEMU, and the other is the app container for running QEMU.

docker build -t pidoc .

Install Docker Compose

sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Configure Cluster

Docker Compose is used for cluster creation. ssh is redirected from port 2222 inside the container to random ports within the specified range, as below.

# docker-compose.yml
#

version: '3'

services:
  node:
    image: pidoc
    ports:
      - "2201-2203:2222"

Build Cluster

To bring up three nodes as configured above with docker-compose, use the --scale option.

docker-compose up --scale node=3

Install Ansible

sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible -y

Ansible Configuration

To manage the cluster, once the containers start and Raspbian boots, ssh will be enabled and become available to Ansible. A few basic operations are provided here: update, upgrade, reboot, and shutdown. These can be expanded as needed to develop a more robust system.

Please note of the ports we specified in the docker-compose.yml file earlier, and edit your hosts inventory accordingly.

# hosts inventory
#

[all:vars]
ansible_user=pi
ansible_ssh_pass=raspberry
ansible_ssh_extra_args='-o StrictHostKeyChecking=no'

[pidoc-cluster]
node_1.localhost:2201
node_2.localhost:2202
node_3.localhost:2203

Attribution

Thanks goes to:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.