Self-Hosting Setup

Introduction

This journal entry was written by me, Brandon Nolet, in the context that I’ll soon be moving my self-hosting setup to a Raspberry Pi 4 (once I purchase one) and I want at least a little bit of a plan in executing that move.

Current Setup

Currently I’m set up with a VPS from Digital Ocean and on that server I have several pieces of free software that I self-host for personal benefit. The droplet (that’s what DO calls their VPS’) configuration I chose is the minimal one but that’s more of a financial decision rather than a functional one. I would much prefer having additional space to test other, heavier, self-hosted softwares.

These are the software projects that I self-host and will aim to fully self-host with the news Raspberry Pi setup:

  • nginx
  • Let’s Encrypt
  • Nextcloud
  • Wallabag
  • Gitea
  • Hugo (personal blog)
  • Wordpress (linuxliaison blog)
  • Matomo (linuxliaison blog analytics)

Each of these projects has a specific purpose and does not link to each other in any way except for it all using nginx (or apache w/ the Wordpress) for serving the webpages. All of these services, save Wordpress, are running inside Docker containers so make for maximum ease of setup and for portability.

Currently, the Gitea, Wallabag, and Hugo containers sit behind an nginx proxy container written by jwilder. As well, there’s a companion container for the nginx proxy that automatically creates/renews the SSL certificates required for the different subdomains I use to access my self-hosted services.

The Nextcloud instance is hosted at home and sits behind a locally hosted nginx proxy which sits behind the VPS hosted nginx proxy. This is because I needed a way to access Nextcloud through the standard ports but my ISP blocks those ports (80, 443). As well, I needed the communications between the Nextcloud instance and the VPS-hosted nginx proxy to be encrypted which is the reason for the locally hosted nginx proxy.

All domains are registered through namecheap but the nameservers are controlled by DigitalOcean. I do this because their nameservers just much faster. I use a few subdomains, but nothing too complicated.

That being said, this is not going to, entirely, be the future setup.

Future Setup

When I move to the RPi4 I’ll still be using Docker, of course, but I’ll be moving things around.

I’ll be completely ditching the VPSs and hosting everything locally. In order to get around the port blocking I’ll have to use a dynamic DNS service so that will be some research to do so that I can understand how that works. I need all services to, minimally, be reachable through ports 80 and 443 (80 to register the SSL certs with LE).

Using dynamic DNS I hope that I won’t have to host the nameservers at home. That would be extra hassle and I think would turn this into an actual project from my perspective. Welp, RPi4s are still out of stock so I have some time to finish this writing project!

The Wordpress installation is going to completely go bye-bye because I don’t think it’s necessary for the way that I use it. I don’t need Matomo as all I care about is knowing which articles are getting more hits than others and the plugins are all janky anyway and don’t really add much. I’ll be using Hugo instead for my linuxliaison blog as that seems like it would be the most sustainable. I’ll need to find a theme that accepts comments because even though I’m comfortable with removing features, I’d like people to be able to comment directly on the LinuxLiaison blog. This might be the biggest change in the setup.

When all is said and done these are the services I’ll be self-hosting:

  • Wallabag
  • Gitea
  • Nextcloud
  • nginx
  • Let’s Encrypt
  • Hugo (personal and linuxliaison blog)
  • Drone

I’ll be getting two RPi4s for the purpose of production and testing. This way I can simply mirror the MicroSD of one RPi4 and put the mirror in the testbench RPi4 for…testing purposes of course! This will allow for the best uptime and perhaps to eventually host for other people in the meantime (as a way to net maintain financially).

I’ll also have to look into VLAN separation for this because even though I’m willing to host from home, I’d rather be able to segregate my home network (“more private” data) from my hosting network. That will be especially important if I let other people use my services.

Last second addition: I will also be adding Drone CI/CD to my set up to make deployment of my blog posts automatic from repo to Hugo. I think I’ll make a tutorial for this once I get that set up, over on the LinuxLiaison blog.

Considerations

This is more of a summary of what you just read but I’m putting it in this format to make it easier for me to look back on:

  • dynamic DNS: How does it work? How much will I pay for it? Can it be used as a nameserver too?
  • Routing/Networking: Can I separate the hosting network from the home network using my current router?
  • Hugo for LinuxLiaison blog: What options are available for turning my WP site into a Hugo site? Will it literally just be a conversion with Pandoc? Is there a plugin for this?
  • RPi4: What accessories will I need to purchase with it?
  • Let’s Encrypt: Will it work behind dynamic DNS?
  • Matomo erasure: Is there a plugin/webpage for hugo that will tell me the most popular pages over a given period of time?
  • Data transfer: what directories/files do I need to transfer over? How do I instantiate all the services into another docker container with the same data at home?

Conclusion

Maybe this actually is a project and I’m just trying to find an excuse to add another project to my plate. Fine, I’ll admit it. It’s a project! But, it’s a pragmatic project. As well, I really do think it’ll be a while before I’ll be able to get my hands on an RPi4 because well…they’ve been out of stock for almost a week now and I don’t anticipate they’ll return to inventory before at least a few weeks from now. Then there’s shipping time, etc, etc.

There will be an update to this post (probably just called “Self-Hosting Setup: update”).