Enjoying Pi on a Diet

2021-03-01

The Forgotton Fruit

I was diddling one day with my gemini capsule, using it as an orbital slingshot to warp into a space lane full of other peoples worlds and musings, when I glanced up from my screen and noticed a weird little box on the top shelf of my desk. This red and white dusty package had been there for quite some time and I'd obviously forgotten about it and neglected it unwittingly.

It was a 'Raspberry Pi 3 Model B' I'd bought in a playful day dream a year or two ago, about exploring the joys of a single board computer. I'd stashed it in plain sight, but had more or less overlooked it as the dream faded away.

Well, here I am paying for a Digital Ocean droplet to host my tiny gemini site and I have a box here that could possibly do the same job. Why don't I go on this adventure and learn how to get this brightly coloured chap doing something useful. If nothing else, I might learn something new.

The Full English

I booted it up, to see if it worked. A full english brekfast of software lay before me installed on a NOOBS installation of Raspian! I realise I'm not going to want a full desktop enivronment with a cornucopia of software installed for getting a small gemini server up and running, so I started thinking about alternatives.

Time to trim

Luckily a good friend of mine pointed me in the direction of DietPi.

https://dietpi.com

This rather helpful roll out of an OS for your raspberry pi, lets you perform a very minimal setup and use its own tools to build in ONLY the modules you require.

This is exactly what I was looking for.

I snuffed around my box of 'bits and bobs' like a pig hoofing up truffles to find an SD card to install it on. I didn't want to nuke my official Raspberry NOOBS install SD card. Luckily, I unearthed an SD card yanked from a old phone of mine.

I set about following their clear instructions to install DietPi on the card:

https://dietpi.com/docs/install/

Swapping the card in and booting took a little time, but the initial config was quick, I changed some passwords and was in to their config and software tools to tweak what I wanted and install only the necessaries.

Follow the recipe

I used Chris Were's instructions on setting up a Gemini server:

gemini://chriswere.uk/gemserver.gmi

using the Agate software

https://github.com/mbrubeck/agate

I only needed to make a couple of changes with the way the DietPi was set up out of the box.

Drop the bear

Since the DietPi is designed to be as lightweight as possible, pulling as little resources and power, it uses Dropbear as its SSH software.

https://matt.ucc.asn.au/dropbear/dropbear.html

I had no idea how to configure dropbear to set up a self signed certificate and key so I installed the more resource hungry package OpenSSH using DietPi's config TUI module. It was a compromise I could live with.

Sync the R

The minimal install of DietPi doesn't come with RSYNC installed and since I use some of Drew/Uoou's scripts (adjusted for my setup)

gemini://friendo.monster/log/lace.gmi
https://gitlab.com/uoou/dotfiles/-/tree/master/stow/bin/home/drew/.local/bin/tiny

that use RSYNC, I was able to run DietPi's Sync module which installs RSYNC for you. Very handy.

Finding the Pi house

Since I'm on a home broadband setup, my IP address is not necessarily static - so it's not easy to point my gemini domain to my DietPi gemini server. My IP could change over time.

Luckily my good friend stepped in again and pointed me in the direction of NOIP Free.

https://noip.com/free

NOIP allows you to setup Dynamic DNS (DDNS) whereby you:

The DUC polls your IP for any changes, if it changes it updates the NOIP service tied to your custom hostname. Effectively maintaining a mechanism by which you can access your equipment and serve gemini pages on a normal non-static broadband.

You have to renew your free hostname every 30 days but the free service works and is enough to run a gemini server on a DietPi so I'm a happy camper.

In order to point my domain to my gemini server I basically set up a CNAME record on my Domain registrar's (NameCheap) site pointing the gemini sub-domain to the NOIP custom hostname.

Enjoy

If you're reading this, you're doing so on my self-hosted DietPi.

<<