Micro Selfhosting

I had a little bit of time and motivation on my hands and a Raspberry Pi 4B dormant and unused. So I tried to see how much I can host on it and it’s going surprisingly well. I wanted to have some applications that make kind of sense to be online, that I would use myself, and that I could eventually offer to some of my folks around here. Those services include rss feeds, something to read later, lightweight content hosting, and chatting. After some research and reading I decided on the following setup

Basic Setup

I used the official Raspberry Pi Imager to burn Alpine to a micro sd card. I have a 32GB card that came with the Raspberry Pi. Next I followed the steps outlined here to have a headless setup, but I didn’t do the memory optimization things yet. Next:

For the moment I ommit information on how to setup the domain, the dns records, the port forwarding, but that’s all part of the setup as well if you want to access the locally running Pi from the outside. I also chose to the applications running under /srv/* together with their data and configs. That makes it easier for me to create propoer backups later, I hope (but I have to set that up yet).

Config Files

Create and Activate Services

These are in place to start the different applications when the Pi boots.

Backups

Is done via webdav in my case.

#!/bin/sh

# === CONFIG ===
WEBDAV_URL=""
USERNAME=""
PASSWORD=""

# === applications ===
APPS="yarr readeck agate snac"

# === backup every data directory ===
for APP in $APPS; do
    SOURCE_DIR="/srv/$APP/data"
    TIMESTAMP=$(date +%Y%m%d_%H%M%S)
    BACKUP_FILE="$APP-$TIMESTAMP.tar.gz"

    echo "📦 Backing up: $SOURCE_DIR"

    # Ensure source dir exists
    if [ ! -d "$SOURCE_DIR" ]; then
        echo "⚠️  Source directory $SOURCE_DIR does not exist. Skipping."
        continue
    fi

    # Create archive
    tar -czf "$BACKUP_FILE" -C "/srv/$APP" data
    if [ $? -ne 0 ]; then
        echo "❌ Failed to create archive for $APP"
        continue
    fi

    # Upload via WebDAV
    echo "📤 Uploading to: $WEBDAV_URL$APP/$BACKUP_FILE"
    curl -v -u "$USERNAME:$PASSWORD" -T "$BACKUP_FILE" "$WEBDAV_URL$APP/$BACKUP_FILE"

    # Check upload result
    if [ $? -eq 0 ]; then
        echo "✅ Success: $BACKUP_FILE uploaded"
        rm "$BACKUP_FILE"
    else
        echo "❌ Upload failed for $BACKUP_FILE"
    fi

    echo "---"
done