Code Monkey home page Code Monkey logo

raspberry-automation's Introduction

Raspberry Automation

CircleCI

How to Build:

Setup Rancher

To setup your Rancher Cluster, run the following:

./setup_cluster.sh

The script will output the K3S_TOKEN to a file called .k3s_token which is going to be used to bake the image.

There is a terraform module named packer_module that will run a docker image and bake an image. main.tf uses it and that is what is CircleCI uses as well as what is going to be run locally.

Image Baking

To bake an image, create a module like the one below. We are going to use the one defined in terraform/example as an example.

module "build_image" {
  source = "./packer_module"

  wifi_name     = var.wifi_name
  wifi_password = var.wifi_password
  ssh_key_path  = var.ssh_key_path
  master_ip     = var.master_ip
  k3s_token     = var.k3s_token
}

Here are what the terraform variables do:

  • $WIFI_NAME is the name of the wifi network that the Raspberry Pis are going to connect to.
  • $WIFI_PASSWORD is the password of the wifi network if there is one.
  • $SSH_KEY_PATH is the path of your public key to add to the authorized_keys of the image.
  • $K3S_TOKEN is the rancher provided token when creating a cluster. The default location is /var/lib/rancher/k3s/server/node-token, or if the setup_cluster script was used, .k3s_token.
  • $MASTER is the address to connect to the master. It needs the master port, which is normally 6443.

Flashing an image

flasher has also been provided to image an sd card. Run the command below (Assuming /dev/sdb/ is your sd card) to image the card.

sudo ./flasher -image=./output-arm-image/image -device=/dev/sdb

Accessing Your Cluster

Assuming kubectl is installed on the machine that ran the ./setup_cluster.sh command, setting the following environment variable to gain access to the cluster.

export KUBECONFIG="/etc/rancher/k3s/k3s.yaml"

Using the image above, any Raspberry Pis that startup using that image will automatically join your cluster.

raspberry-automation's People

Contributors

maximillianbrain1 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.