Joel Dare

The Raspberry Pi 400 in My Bedroom

I wrote a privacy focused analytics program, embedded it on a handful of personal sites and hosted it on a Raspberry Pi 400 on a desk at home.

Get your own private analytics using the Protective Metrics service that I created based on the code from this project.

Raspberry Pi and Stats Dashboard

The Dashboard

This is the fun part, so lets get it out of the way first. The dashboard is a web page with a set of tables showing impressions on various websites. It’s on a bright blue background with inset panels. It’s modeled after my nostalgia for the Renegade BBS I ran in my bedroom as a teen. Specifically, the waiting for caller screen.

The Counter

The counter is a bit like an early internet page counter but it uses JavaScript instead of an image. If you have JS disabled, you’re simply not counted. If you’re a bot, who processes JS, I’m counting you anyway.

It logs the date, time, the URL you requested and nothing more. I don’t log your IP address, your browser type, your country, or anything else.

It takes just 30-seconds to install on a new site. I just drop the script tag on the page and it’s ready to go.

It’s a microservice that’s just 36 lines of code. I imagine it can handle quite a few of these tiny requests but I have no idea how many.

The Database

It’s backed by a simple SQLite database. Each impression is logged to the DB.

A separate service run’s a series of queries against the database. The dashboard calls this service to get it’s list of totals. It’s polling, grabbing the totals every hour or so.

The Server

It’s running on my desk on a simple Raspberry Pi 400. It’s got a full desktop environment and I’m running the dashboard in a full screen browser window. All self-contained. There’s nostalgia here too. My first computer was a TRS-80 CoCo that was a computer and keyboard in one gray box. The Pi 400 certainly has parallels to that machine.

I’m runny the Caddy web server because I wanted to give it a try. Nginx may be a bit more performant but Caddy’s ease of configuration lured me in. I struggled with it at first, but I’m pretty happy with it now.

I don’t have a static IP so I use Namecheap with dynamic DNS. It’s not a hardy solution but it’s mine. I can live with a bit of downtime now and then.

Written by Joel Dare on October 20, 2022 and last updated on April 25, 2023