A system for gathering measurements from RuuviTag (https://ruuvi.com/) via bluetooth, saving them to InfluxDB and showing them on Grafana. All running on two node cluster on Raspberry Pi 3 B+ or Raspberry Pi 4 B.
This is not a production ready system: RBAC is not used, grafana and influxdb passwords are not managed, all Ansible automation is not idempotent etc..
The Ansible automation:
- Setups ssh keys and disables password access
- Installs Kubernetes with kubeadm
- Creates local persistent volumes to kubernetes
- Builds the
ruuvi
docker image and starts up the services.
Why was this done:
- To learn more about kubernetes
- To use RuuviTag for something fun
Prepare your controller machine (tested on WSL):
- Install Ansible (2.8)
- Run
ansible-galaxy install -r requirements.yml
- When running on windows WSL run
export ANSIBLE_CONFIG=./ansible.cfg
to use the config file regardless of the file permissions.
Set up the raspberry pi:
- Download raspbian lite (buster) image and flash the sd card
- Create empty file
ssh
to the boot partition of the SD card to enable ssh - Boot up the rasberry pi
- Create Ansible inventory for your environment.
- See
inventories/inventory-template
dir for example - Create ssh key and configure the needed variables to the group vars
- Save the inventory to
inventories/inventory
folder or changeansible.cfg
to match your dir
- See
- Run ansible
ansible-playbook install.yml -k
. For the first run you'll need to use-k
and give the raspbian's default passwordraspberry
when asked. - Login to grafana with
admin:admin
http://host_ip:30000/
Remember to remove the old fingerprint from ~/.ssh/known_hosts after reflashing or you will just get SSH Error: data could not be sent to remote host
when running Ansible.
- ruuvi container hangs sometimes
- Use fancier storage plugin for persistent volume support
- Use helm
- InfluxDB and Grafana charts. InfluxDB didn't work straight out of the box because of missing arm images.
- Create chart for the ruuvi deployment
- Reclaiming persistent volumes does not work
- The ruuvi container is run as root because of ruuvi library limitations