MinIO server gauge with Raspberry Pi
Today we’ll take a look at an IoT pressure gauge for your MinIO server. This is a cool hack built by Alex Ellis with the Raspberry Pi, Docker and MinIO.
After contributing code to the Open-Source MinIO project to enable webhooks Alex wanted visualize the traffic passing through his server. His hack shows the rate that objects get uploaded to a live server.
In this post we give a live demo, then go over the bill of materials, a high-level diagram and finally link out to the source-code on Github so you can try this for yourself.
Live demo:
Here is a video of the Pressure Gauge in action.
Bill of materials
- 1x Raspberry Pi Zero with 40-pin male header
- 1x 8GB class 10 micro-SD card
- 1x Pimoroni Blinkt! 8-LED add-on
- USB-OTG to USB-A cable
- MinIO server running in the cloud, on-prem or on your laptop.
The Blinkt! costs around 5USD and was created by Pimoroni in the UK as a cheap and effective output for IoT projects. Through a simple Python or Golang library you can program 8 RGB LEDs and build fun projects.
Alex put together a talk and demo for Dockercon last year called Protecting the Datacenter with IoT. It consisted of half a dozen Raspberry Pi sensors and Blinkts all connected through Docker and Redis to provide real-time alerts about thermal issues and tampering straight from your server room. You can see a live video of the demo and talk from Container Camp, London here.
Technical overview:
- Any compatible S3 client (such as the MinIO CLI) uploads files to an S3 bucket
- The MinIO server (running on the cloud, on-prem, your laptop or an RPi) generates a webhook over HTTP/s
- A Node.js/Express.js microservice running on the RPi picks up the webhook and increments a live Redis counter
objects_put
- A Python program polls Redis constantly and updates the colors on the Pi depending on how high the
objects_put
rate is
Q&A
- How does the pressure drop? Redis has an auto-expiry command called
EXPIRE
— this is used to turn the counter into a rolling rate. - How is the code deployed on the RPi? The three moving parts — Node.js, Python and Redis are all containerized with Docker and can be setup in one shot with Docker Compose.
- How do you enable webhooks on MinIO? See the introductory blog post on MinIO webhooks.
- Can I run the MinIO server directly on my Raspberry Pi? MinIO is available through Docker or as a stand-alone binary for most common platforms including all current models of the Raspberry Pi, Pine64 and other System-on-Chip boards (SoCs).
Next steps:
Head over to the MinIO quickstart guide and get up and running with Docker in one command.
- Fork the code and find out how to setup your own MinIO Gauge on Github.
- Read MinIO’s introductory blog post on S3 webhooks.