My goal is to have a knowledge repository that empowers like-minded geeks to wrestle back control of their data from these corporations by self-hosting tools and applications on servers they administer.
The Way of The Bro
Whether you’re new to self-hosting or a seasoned self-hoster, you probably already know that there are a thousand-and-one different ways to set things up. This site takes a very opinionated approach to things and prefers free and open-source projects over anything else. So while there might be better/easier/more-customizable methods out there, this is the way that I have things setup - The Way of The Bro. It works for me and, if you follow these instructions, it’ll work for you too.
Choosing a Tech Stack for Self-Hosting
- Operating System: Debian Linux
- Containers: Docker
- Reverse Proxy: Traefik
- Lifecycle Management: Portainer
- Backups: Restic
Basics
We’ll start off with the foundation work for our tech stack - the basic building blocks on which everything else is built.
Operating System : Debian Linux
The Operating System is the bottom layer of the foundation. For this, I have chosen Debian. It is a rock-solid Linux distribution on which many other distributions are built (including popular ones like Ubuntu and Pop!_OS).
Being a server-based minimalist distribution, it provides the core functionality we need without the extra fluff other distributions push on you. It prefers stability over bleeding-edge-features and provides a simple path for upgrades.
Containers : Docker
Containers have been an absolute life-saver for self-hosters. Gone are the days of having to match libraries and services, figuring out dependencies and *gasp* compiling from source. The Bro uses and recommends Docker. Yes, there are podman, Kubernetes and LXC/LXD, but Docker is the easiest and is The Way of The Bro.
Reverse Proxy : Traefik
The vast majority of the applications that The Bro uses are web-based. Serving all of these applications through a single endpoint helps with configuration and management. The Bro uses and recommends Traefik.
As you will see, Traefik is going to allow us to store each application’s proxy configuration within its own configuration (by using environment variables). Add to this the absolutely awesome (and free!) Let’s Encrypt SSL certificates and you’ll never have to worry about SSL certificates and renewals again.
Management
Now that we’ve laid down the foundation, we need to consider how we’re going to manage the myriad of containers and services we’re going to be spinning up. We need to look at lifecycle management (creating/starting/stopping/deleting), backups (safeguard that precious data) and monitoring (we’ve worked hard to get it up, let’s make sure it stays up).
Lifecycle Management : Portainer
The Bro is a big fan of the docker-compose format, but managing a bunch of YAML files through the command line may not be the best use of our time. Luckily, we have Portainer. Lifecycle management AND a pretty web interface? Yes please!
Backups : Restic
With self-hosting comes great responsibility. If you lose your data, you have noone to blame but yourself! Let’s make sure that our hard work is backed-up in case disaster strikes (and you know it will). The Bro uses and recommends Restic. Are there other options out there? Yes.. BUT.. Restic gives us encrypted backups and a multitude of storage backends (local to a USB drive, remote to an SFTP host and remote to an S3 bucket). Over the years, it has proven to be a solid backup solution with minimal management required. Set it and forget it!