---
title: Self-hosting — Dennis Krul
description: What I self-host, from files, photos and passwords to code and CI, and the free software it runs on: Debian, Proxmox, Ansible, Docker and Caddy.
url: https://www.krul.nu/self-hosting
---

Home lab

# Self-hosting

The services I use every day, run on my own machines with free software, so my data stays mine and I can always move.

## The machines

A handful of servers: a few VPSes at European hosting companies for what has to be reachable from anywhere, and at home a [Proxmox VE](https://www.proxmox.com/en/products/proxmox-virtual-environment/overview) hypervisor with its guests and a small server that holds the backups. They, my desktop and my development VMs all run [Debian](https://www.debian.org/).

## All of it as code

No server is set up by hand. Every machine is described in one Git repository and configured by [Ansible](https://www.ansible.com/): users, SSH, firewall, updates, mail, backups and the containers each one runs. [Infrastructure as code](https://en.wikipedia.org/wiki/Infrastructure_as_code) means a rebuilt server comes back the same, and every change is a commit I can review and undo.

The services run as containers with [Docker Compose](https://docs.docker.com/compose/). My own apps, this site among them, are PHP on [FrankenPHP](https://frankenphp.dev/).

### Files

[OpenCloud](https://opencloud.eu/en) keeps my files and syncs them between my devices, instead of Dropbox or OneDrive.

### Photos

[Immich](https://immich.app/) backs up the photos from our phones and finds one by face, place or what is in it, instead of Google Photos.

### Passwords

[Vaultwarden](https://github.com/dani-garcia/vaultwarden), a lean server for the Bitwarden apps, holds the passwords.

### Tasks

[Vikunja](https://vikunja.io/) keeps the to-do lists and projects.

### Code

[Forgejo](https://forgejo.org/) hosts my Git repositories and its container registry, and its Actions build, test and deploy them: this site, EMS and the price API go live from there.

### Sign-in

[Pocket ID](https://pocket-id.org/) gives everything one sign-on with a passkey, over OpenID Connect; [OAuth2 Proxy](https://oauth2-proxy.github.io/oauth2-proxy/) puts it in front of the apps that cannot speak that themselves.

## The front door

[Caddy](https://caddyserver.com/) answers every web request, with certificates from Let’s Encrypt, and passes each to its service. In front of the apps it runs [Coraza](https://coraza.io/), a [web application firewall](https://en.wikipedia.org/wiki/Web_application_firewall) with the [OWASP Core Rule Set](https://coreruleset.org/), and [CrowdSec](https://www.crowdsec.net/) bans the addresses that keep trying.

Underneath, [nftables](https://netfilter.org/projects/nftables/) lets in only what each machine serves, [OpenSSH](https://www.openssh.com/) takes keys only, and containers that need the internet go out through a [Squid](https://www.squid-cache.org/) proxy that knows where they may go.

## Updates and monitoring

Debian’s [unattended upgrades](https://wiki.debian.org/UnattendedUpgrades) install updates by themselves, and reboot only when one needs it. [Diun](https://crazymax.dev/diun/) tells me when a container image has a new release; my own images update each morning.

[Beszel](https://beszel.dev/) watches every machine and container, and [Postfix](https://www.postfix.org/) sends what the servers have to say to my mailbox.

Two watchers sit outside, so they still speak up when my own machines cannot: every backup job reports to [Healthchecks.io](https://healthchecks.io/), which tells me when one fails or does not run at all, and [UptimeRobot](https://uptimerobot.com/) checks from the internet that the VPSes are up and answering.

## One place for the logs

Everything logs to the [systemd](https://systemd.io/) journal: the services, the containers through Docker’s [journald log driver](https://docs.docker.com/engine/logging/drivers/journald/), and Caddy’s access log. Every machine sends its journal with [systemd-journal-upload](https://www.freedesktop.org/software/systemd/man/latest/systemd-journal-upload.service.html) to a log store I wrote myself, which keeps the last weeks in [SQLite](https://www.sqlite.org/) with a full-text index, and masks passwords and tokens on the way in.

Its web viewer, behind the same single sign-on, searches, filters and follows all machines at once, charts the volume over time, and for a refused request explains why: which WAF rule or CrowdSec ban stopped it. It mails me when a machine goes quiet, or when its errors or refused requests suddenly pile up.

## Backups

Every server is backed up twice, with two different tools, so one bug cannot take out both: [borgmatic](https://torsion.org/borgmatic/) with [BorgBackup](https://www.borgbackup.org/), encrypted, to storage at another provider, and [rsnapshot](https://rsnapshot.org/) to the server at home. That one pulls the backups with read-only access, so a server that is broken into cannot delete its own history.

The virtual machines at home go to [Proxmox Backup Server](https://www.proxmox.com/en/products/proxmox-backup-server/overview), and the photos and passwords have a standby copy at home that can take over.

## What I don’t run

Mail stays with [Fastmail](https://en.wikipedia.org/wiki/Fastmail): running a mail server well is a job of its own, and I would rather spend the time on the rest. Nor is any of this a product: it is my own setup, shared to show what is possible. If you are thinking of doing the same, [get in touch](https://www.krul.nu/contact.md).
