Managing infrastructure as code and containerized applications on a k3s-managed Raspberry Pi cluster dedicated to home automation.
Pi Diagram |
---|
![]() |
I got tired of having to pick what to eat for dinner each month, thus meals-go was born. meals-go selects and renders a month's worth of recipes, including related grocery list. Executes in two modes: frontend+backend service deployment, and email cronjob.
Meals Website |
---|
![]() |
Services Architecture Diagram |
---|
![]() |
Services on k3s using Deployments and a NodePort. This setup allows viewing this month's meals from my phone, laptop, or tablet by hitting a Tailscale URL.
- meals-frontend written in Svelte, enables a few different functionalities:
- Current month calendar view,
- Enable/Disable meals form,
- Trigger email form to trigger the same workflow as next section.
- meals-backend written in GoLang and served using Gin.
- meals-db-sync-cronjob A scheduled CronJob synchronizes the Postgres database with the source of truth JSON file for recipes stored in S3. Recipe data is maintained in a private repository shared with my partner, where a CI/CD pipeline validates updates, with a post submit that pushes the latest JSON state to S3. As a result, updating recipes is as simple as opening a PR.
- email-cronjob every Thursday, finds next week's recipes and compiles a grocery list for all items, combining like items by quantity, and assigning each item to its respective aisle. This is then formatted and emailed to me and my partner. Email is sent using Amazon Simple Email Service
Example Email | Example PDF Attachment |
---|---|
![]() |
![]() |
I (too often) leave for work, round the corner, and immediately second guess whether I closed the garage door. So, I fixed this concern.
This Garage door monitoring system uses a Raspberry Pi 2 W hooked up with a magnetic door sensor. The magnetic door sensor detects when the garage door is in the "closed" position. Metrics are exposed via a Prometheus exporter, which are scraped by a Prometheus deployment I'm using across these projects. Finally, a dashboard is available to view the yes/no question through Grafana.
Garage Diagram |
---|
![]() |
Note: Getting started with the Hardware portion, particularly reading the state of the GPIO pin, was super doable thanks to this book Automate Your Home Using Go
Ansible install: $ sudo apt install ansible-core
Terraform install: https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli#install-terraform
Required non-checked files:
-
ansible/inventory/pi
:[common] <FILL IN> [artifactors] <FILL IN> [all:vars] ansible_python_interpreter=/usr/bin/python3
-
ansible/roles/common/vars/vars.yml
:pub_ssh_key_path: <FILL IN>
-
ansible/roles/workers/vars/vars.yml
:k3s_token: <FILL IN> k3s_url: <FILL IN>
-
terraform/nexus/local.tfvars
:nexus_url = <FILL IN> nexus_username = <FILL IN> nexus_password = <FILL IN> nexus_docker_repo_port = <FILL IN>
Sure! Mind the dust 😹
Pi Setup |
---|
|