My Raspberry Pi server with yunohost

I will try to make this entry resemble a tutorial, hopefully this ends up being useful to someone.

Why start over?

I had been playing around with Open Media Vault before (see this entry for details), but it was mainly based on docker images and I could never get Nextcloud up and running (the closest I came was installing nextcloudpi, but I could never get the docker image to run using external storage).

Also I never got to the part of using letsencrypt to access everything through https, pretty sure there's a tutorial out there somewhere.

Then tragedy happened, for some reason my SD card just died and I was left with nothing.

After that I decided that my setup needed some improvements, and to be completely honest I also wanted to try something different, in yunohost almost everything is a one-click step when it comes to installing apps so that was a huge point in favor, here I am telling you my story:

Initial setup

After the SD card incident, booting from an external drive seemed like the best option. There are 2 prerequisites for that to happen:

  1. update the pi's bootloader in eeprom (detailed steps here, see section: Update the bootloader)
  2. burn the OS image to the external drive, and use your favorite file browser to copy & replace some files to the boot partition (no need to do this if you're using 64 bit Raspbian OS). This is the list of files that need to be replaces (just get them from the repo):
    • fixup.dat
    • fixup4.dat
    • fixup4cd.dat
    • fixup4db.dat
    • fixup4x.dat
    • fixup_cd.dat
    • fixup_db.dat
    • fixup_x.dat
    • start.elf
    • start4.elf
    • start4cd.elf
    • start4db.elf
    • start4x.elf
    • start_cd.elf
    • start_db.elf
    • start_x.elf

In my particular case the base was Raspberry Pi OS lite, I know, you may be thinking: “Aren't there yunohost images already out there? save yourself some trouble!” and my answer is documented here. Then after updating, it's possible to install yunohost (4.0.3 at the time of writing) with a curl one liner: curl https://install.yunohost.org | bash

Post intsall steps are pretty straightforward, here's a link.

I ended up using a noho.st domain as it was graciously offered for free.

My multi-HDD setup

Note: What this section describes has to be done after yunohost is up and running in the system, I tried doing it the other way around and that caused my SATA HAT to stop working altogether, no HDDs were detected, fan stopped spinning and the little LCD display showed nothing

A while back I got an awesome RADXA Quad-SATA HAT that houses 4x1TB HDDs. It is not detected or working out of the box but the installation process is detailed here. So my system has 5 HDDs (4 in the SATA-HAT and the one I boot from connected one of the pi's USB ports).

I also wanted to have some sense of security for my data so naturally I set up 2x RAID1 arrays (mdadm is your best friend, here's a useful guide)

All this sounds very nice, doesn't it? There's always a catch: since the external drives are on the SATA HAT it is not possible to just edit fstab and auto-mount them on the system, there is a service associated with the SATA HAT that needs to be running to “see” the drives. My hacky solution for now is mounting the drives everytime I restart the system (yes, by hand, like a caveman).

App installing and configuration

Installing apps was surprisingly easy, Gitea, Wordpress, Nextcloud and Piwigo are one clic installs except for Synapse (again, related post here), the fix is just installing from testing branch: sudo yunohost app install https://github.com/YunoHost-Apps/synapse_ynh/tree/testing --debug

Since the apps are installed in the boot drive I decided to move or reference content to/from the other drives. My Nextcloud instance has access to the external storage so I'm able to “upload” pictures to my external drives. then I just made symlinks from /home/yunohost.app/piwigo/.galleries to reference the album directories in the external drives. Here's an useful link, also, hopefully you don't screw up like me but here's a link on how to remove symlinks. Hacky solution, yes, but it works.

So far my idea is to “upload” content to external storage through Nextcloud and follow the same approach (for blogposts, videos, etc ...)

I am also testing communication through my Synapse instance (I can be found as @lopeztel:lopeztel.hoho.st) and the Nextcloud Talk plugin with my folks back home.

Improvements

Because what kind of engineer would I be if I was satisfied? Improvements:

Well, that's all, any suggestions are greatly appreciated.

#selfhosting #yunohost #raspberrypi Day 10 of #100DaysToOffload