HomelabOS on a Raspberry Pi

General tips on hosting on a Raspberry Pi

Maloja

Wow! Got this self-hosted Last.fm style self-hosted scrobbler working on one of my servers after a lot of head scratching with my other development server. Can't quite work out why the other development server couldn't scrobble properly but I think it needs a rebuild anyway.

Not dared to try this on a Pi yet.

This works with the associated “Multi-Scrobbler” which is indescribably cool until you get it working (a challenge!)

Also as a note, possibly scrobbling from Tautulli would include Tidal plays?

Multi-Scrobbler

I need to make some notes on how I got this working, particularly the Spotify API.

Malojaplum

Not officially documented but bugger paying 30 quid for a tiny server and email SMTP on this “shit and giggles” little server.

mailgun How-To get Flex Plan

More of primer for another server I use for development that I want to hibernate when not using to save energy. Plus I'm too lazy to switch the darn thing on and off..

$ ip a

 eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 6c:4b:90:03:9c:9e brd ff:ff:ff:ff:ff:ff
    altname enp1s0
    inet 192.168.1.225/24 brd 192.168.1.255 scope global eno1
       valid_lft forever preferred_lft forever
    inet6 fd41:4bbf:28e6:6894:6e4b:90ff:fe03:9c9e/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 1701sec preferred_lft 1701sec
    inet6 fe80::6e4b:90ff:fe03:9c9e/64 scope link
       valid_lft forever preferred_lft forever```
       

MAC Address.. 6c:4b:90:03:9c:9e

 $ sudo ethtool eno1
        Settings for eno1:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Link partner advertised link modes:  10baseT/Half 10baseT/Full
                                             100baseT/Half 100baseT/Full
                                             1000baseT/Full
        Link partner advertised pause frame use: Symmetric
        Link partner advertised auto-negotiation: Yes
        Link partner advertised FEC modes: Not reported
        Speed: 1000Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: pumbg        
        Wake-on: d
        Current message level: 0x00000033 (51)
                               drv probe ifdown ifup
        Link detected: yes

The man-page for ethtool tell you what that cryptic pumbg means – the letters are different options that this interface supports for Wake-On-LAN. In this case they are:

Option Description p Wake on PHY activity u Wake on unicast messages m Wake on multicast messages b Wake on broadcast messages g Wake on MagicPacket messages There's an additional option which is what the interface was set on – d – as you can see in the last line of the output. This means Disable (wake on nothing). This option clears all previous options. I don't have many devices on my network, so I don't know that there's a lot of broadcasts, multicasts, etc. that would be waking it up all the time, but since one feature of Wake-On-LAN is that it only wakes the machine when it gets the “Magic Packet”, only the g and d options matter. Now that I knew it was supported, it was time to try it out.

~$ sudo ethtool --change eno1 wol g

Suspend to test..

``` $ sudo systemctl suspend

or if brave..
```$ sudo systemctl hibernate
$ wakeonlan -i 192.168.1.225 6c:4b:90:03:9c:9e

Create a file at /etc/systemd/system/wol.service (I think you can use another systemd sub-folder, and you can name the file anything you want, within reason, but this one seems to work well enough). In this file you put settings that look something like this:

[Unit]
Description=Enable Wake On Lan

[Service]
Type=oneshot
ExecStart = /sbin/ethtool --change eno1 wol g

[Install]
WantedBy=basic.target

Enable The Service

To enable it you can do this:

sudo systemctl daemon-reload
sudo systemctl enable wol.service

Make an alias command

alias wakeup='wakeonlan -i 192.168.1.225 6c:4b:90:03:9c:9e

Alias on server

alias snooze='sudo systemctl hibernate'

Stick them in .bash_aliases for Ubuntu.

The problem is with how HomelabOS has not updated the password hash algorithm. The fix is here

user.yml then needs to be edited with the corrected argon password deleting the garbled stuff from the file.

Docker

docker run -it authelia/authelia:latest authelia crypto hash generate argon2

To generate an Argon2 hash with the docker image without a prompt you can run:

Docker

docker run authelia/authelia:latest authelia crypto hash generate argon2 --password 'password' Output Example:

Digest: $argon2id$v=19$m=65536,t=3,p=4$Hjc8e7WYcBFcJmEDUOsS9A$ozM7RyZR1EyDR8cuyVpDDfmLrGPGFgo5E2NNqRumui4

plug this into user.yml

Syncthing and Tautulli also run on the Pi so can sync from phone and alos lok at Plex music play stats... Nerd.

Syncthing has a bug where files synced to a Samba share (images) are hidden files until you unhide them – A Samba bug where the compression and use of dot files doesn't quite work properly. The files do transfer.. just took me a while to find them then use “properties” in windows file manager to deselect “hide”.

Bilgeword Theme

Borrowed this theme for this blog. In Writefreely, go to “customise blog” and copy this code into the css box.


/* Written in 2020 by Max Henderson.
Modified in April 2020 by David Blue for bilge.world.

Version 2.3

   To the extent possible under law, the author(s) have dedicated all
   copyright and related and neighboring rights to this software to the
   public domain worldwide. This software is distributed without any
   warranty.

   You should have received a copy of the CC0 Public Domain Dedication
   along with this software. If not, see
   http://creativecommons.org/publicdomain/zero/1.0

   I am not a web designer or coder. This code is messy. Hope you enjoy.
   Open to any suggestions.

*/

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Condensed:wght@100;500;700&family=Merriweather:ital,wght@0,400;0,700;1,400;1,700&display=swap');

body {background-color: #FFF4E6;}
/* old background-color: #f2f2f2 */

#blog-title a {
    font-family: 'IBM Plex Sans Condensed', sans-serif !important;
    /* font-style:bold !important; */
    color: #00006b;
}

header nav a {
  font-family: 'IBM Plex Sans Condensed', sans-serif !important;
  font-size: 1.2em;
}

header p.description {
   /* font-style: italic; */
    font-family: 'IBM Plex Sans Condensed', sans-serif !important;
    line-height: 200% !important;
    color: #00006b !important;
    font-size: 1em;
    margin-left: inherit;
    margin-right: inherit;
}

body#collection header {
   margin-bottom: 1em !important;
}


header nav a {
    color: #00006b;
    font-family: 'IBM Plex Sans Condensed', sans-serif;
    /* margin-bottom: 1em; */
}

body, article {
    font-family: Merriweather, sans-serif !important;
    line-height: 150% !important;
    font-size: 1em !important;
    color: #0d0d0d;
    /* margin-top:1rem !important; */
}


body, article a:link {
    color: #00006b;
}

body, article a:visited {
    color: #F43B28;
 }

 h1 {
     color:#00006b !important;
     font-family: 'IBM Plex Sans Condensed', sans-serif;
     font-size: 2em !important;
 }

h2 {
    color:#00006b !important;
    font-family: 'IBM Plex Sans Condensed', sans-serif;
    font-size: 1.4em !important;
}

h3 {
    font-family: 'IBM Plex Sans Condensed', sans-serif;
    font-size: 1.15em !important;
}

h4 {
    font-family: 'IBM Plex Sans Condensed', sans-serif;
    font-size: 1em !important;
}

h5 {
    font-family: 'IBM Plex Sans Condensed', sans-serif;
    font-size: 1em !important;
}

h6 {
    font-family: 'IBM Plex Sans Condensed', sans-serif;
    font-size: .85em !important;
}

.post-title a:visited, .post-title a:link {
    font-family: 'IBM Plex Sans Condensed', sans-serif !important;
    color: #00006b !important;
    font-size: 1.7rem !important;
}

body#post article time.dt-published, body#subpage article time.dt-published {
  font-family: 'IBM Plex Sans Condensed', sans-serif !important;
  color: dimgray !important;
  font-size: 1rem !important;
}

body footer nav {
    color: #0d0d0d;
}

blockquote {
    font-family: 'IBM Plex Sans Condensed', sans-serif;
    color: #333333 !important;
}

hr{
  border: 2px solid red;
}


body footer a.home:link, body footer a.home:visited {
    color: #000000;
}

.action {
    font-family: 'IBM Plex Sans Condensed', sans-serif;
}

nav#manage ul a {
    color: #0d0d0d;
}

nav#paging a {
    color: #0d0d0d !important;
    font-family: 'IBM Plex Sans Condensed', sans-serif !important;
}


a.bt {
   background-color:#0d0d0d !important;
   color: #0d0d0d !important;
}

.custom-nav {
  text-align: center;
  text-transform: uppercase;
  font-family: 'IBM Plex Sans Condensed', sans-serif;
  color: red;
}
.custom-nav a:link, .custom-nav a:visited, .custom-nav a:hover, .custom-nav a:active {
   color: #00006b;
}
.custom-nav a:hover, .custom-nav a:active {
   text-decoration: underline;
}

#subscribe-btn {
    border: 1px #FF0000;
    background: #00006b;
    font-family: 'IBM Plex Sans Condensed', sans-serif;
    font-size: 1em;
    color: #FFF4E6;
}

A base install of HomelabOS using the DEV branch as this meant that Terraform worked properly and you can then spin up a DigitalOcean droplet to make a Bastion server connection and point a domain to this to make the whole caboodle web accessible. The Bastion (a digital ocean problem) will lose the resolv.conf nameserver occasionally so you have to poke at this with 1.1.1.1 or 8.8.8.8 for a working DNS for running make deploy.

Raspberry Pi uses the ARM64 v8 so no everything listed on HomeLabOs will work – in fact a lot of things have to be tweaked to get Docker containers with the correct architecture. The HomelabOS scripts will whinge that ARM64 v8 architecture is not the recognised architecture if using “make set ” – Use “make deploy” it will grind through the script but will work.

Here's where we go so far:

Heimdall Dashboard : Latest works with no problems. You get a nicely set out landing page for your microservices and this has been much improved of late to ease setting up non-listed applications. heimdall

Ghost : Version 5 will not play nicely yet with ARM64 v8 so version 4 it is. Robust and fast enough as blogging platform. Version 4 is an upgrade from HomelabOs as they use a very old version. Using 4 means you can mostly use newer (free) templates that you cannot on the standard version which is now pretty old. Mail stuff will work with Mailgun API. A different tale on how to set that up for another post..

Grocy : Grocery/food shop manager. works straight off. Grocy

FreshRSS : Working happily. FreshRSS is a self-hosted RSS and Atom feed aggregator. It is lightweight, easy to work with, powerful, and customizable. FreshRss

Pixelfed Self-hosted Instagram clone. Works but a bit resource hungry (see alternative with Chevereto) Pixelfed

PrivateBin PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Initial setup can throw some odd errors but it does all work. PrivateBin

Codeserver :

The Visual Studio Code Server is a service you can run on a remote development machine, like your desktop PC or a virtual machine (VM). It allows you to securely connect to that remote machine from anywhere through a local VS Code client, without the requirement of SSH.

Works nicely. Codeserver

Mealie Very cool recipe manager. Needed some docker-compose tweaks for an ARM64 v8 container version and some fiddling around with database settings but works. Patience as post install it can take a while to come live but is then stable.

Mealie

Plex Plex media server. HomelabOS install method is flaky as you will never get enough time on the “claim” token is using their method. I found using “docker-compose up -d” to bring up the server and then using the token claim to get a token and then manually pasting this into docker-compose.yml and the vault far more effective, particularly if you have other Plex servers running. Will handle a music library but larger file movie transcoding is probably a bit too taxing for a Pi. There are other music servers that will work but Plex is my media server of choice as it allows me to stream on Alexa devices. Emby will do this too but is a bit more fiddly to get working as an Alexa skill.

Plex

HedgeDoc HedgeDoc (formerly known as CodiMD) is an open-source, web-based, self-hosted, collaborative markdown editor. Needed a re-write of the docker-compose.yml as setup quite different to HomelabOS CodiMD – mainly setting up database environment correctly and using an ARM64 V8 version. Works nicely now but was a challenge to get working initially. Shaarli

Shaarli The personal, minimalist, super fast, database-free, bookmarking service. My custom docker-compose.yml but easy to set up (Not included in HomelabOS) but always very useful. Shaarli bookmark

Writefreely An open source platform for building a writing space on the web. This is what you are reading this on. Uses a customised docker-compose.yml as not included in HomelabOS. You'll need to play around with some config settings in a text editor.

Chevereto Chevereto is a powerful image and video hosting script that allows you to create a beautiful media hosting website with all the features you need. It's like a self-hosted IMGUR and useful for creating thumbnails for blogs like this if you want to keep things simple and “in house” I need to make proper notes on how I got this working: The install instructions are not great on the site and your images repository/volume must be set to www-data user and group and the install will choke unless the directory is writable. Probably the most fun headscratcher to get working. Chevereto