Skip to content

Latest commit

 

History

History
100 lines (60 loc) · 4.83 KB

README.installer.md

File metadata and controls

100 lines (60 loc) · 4.83 KB

Equinix Labs IoT workshop

This workshop deploys compute, storage, networking, and an IoT application to metal.equinix.com.

Conceptual architecture

Diagram:

Conceptual architecture

Private components:

Components exposed with TLS / Ingress or NodePort:

  • Ingress Controller - Traefik v1 (HostPort 80/443)
  • Serverless compute platform - OpenFaaS
  • MQTT Broker - emitter.io (NodePort) - 30080/30443
  • Business intelligence - Metabase (Ingress/TLS)
  • Metrics visualization - Grafana (Ingress/TLS)

Getting started

Before you begin using this repo you will need an Equinix Metal account.

Everything else you need to deploy this workshop is available in this repository.

Note: This repository is designed to be used with your own domain name and a number of DNS records. This enables TLS termination (HTTPS) to be used for exposed services.

You can register for a domain at Google Domains or Namecheap.com for a few dollars. You can also configure your domain there, after purchase.

1) Clone the repo

git clone https://github.com/equinix-labs/metal-iot

2) Create a bare-metal Kubernetes cluster and deploy the application

You will use Terraform to create the cluster and deploy components.

Once deployed find the IP for one of the cluster nodes in terraform console output, your Equinix Metal dashboard or the .tfstate file in /k8s/. Create a wildcard DNS A record using this IP (replace example.com with your domain):

  • A *.example.com - <IP>

3) Generate Drone Data

You can now send data to emitter from drone clients. A drone simulator is included to generate realistic client data for use with visualization tools. Be sure to configure the environment variables as decribed in the README.md - this will require kubectl to be properly configured from step 2.

4) Visualize the Drones in Realtime

A MapBox based web app is hosted in an OpenFAAS service and can be accessed via gateway.<your domain>/function/render-map. It provides realtime information on the drone clients location and status.

4) Visualize the Metrics

A Grafana instance is included to monitor OpenFAAS performance and can be accesed at grafana.<your domain>. The default login is username: admin, password: admin.

A Metabase instance is also hosted in the cluster at metabase.<your domain>. When you first access Metabase you'll need to configure the instance to connect to the postgres DB.

The default config parameters are listed below. Use kubectl to obtain the database password.

kubectl get secret --namespace default postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode
  • Type of Database: PostgreSQL
  • Name: Drone Data
  • Host: postgresql.default.svc.cluster.local
  • Port: 5432
  • Database name: postgres
  • Database username: postgres
  • Database password: <password obtained from kubectl>

Once connected to the database you can visualize the drone_event and drone_position tables. The first image below shows the locations corresponding to each drone position update - note the drones are clustered in the delivery region surrounding a warehouse. The second image shows the rate of battery consumption compared to the package payload size - note the abnormal battery to payload ratio for drones 0, 10, and 20 whic indicates the drones are running inefficiently compared to their peers.

Modifying the Project

This project is organized with each component having it's own self documented folder. Feel free to explore how each is tied back to the deploy script. A few key components are:

Note that the README in most components assumes you have already created a Kubernetes cluster along with installing and configuring kubectl on your PC.