.gitignore | ||
Justfile | ||
LICENSE | ||
README.md |
author | date |
---|---|
Kristoffer Grönlund | 2025-10-10 |
själv är bäste dräng
=> Self is best dräng
=> A motivational speech on self hosting
Microsoft
Amazon
Apple
The internet is
too American
too Big
too Boring
Long live the _weird internet!
We live in capitalism. Its power seems inescapable. So did the divine right of kings. Any human power can be resisted and changed by human beings. Resistance and change often begin in art, and very often in our art, the art of words.
― Ursula K. Le Guin
We live in the cloud. Its power seems inescapable. So did the divine right of kings. Any human power can be resisted and changed by human beings. Resistance and change often begin in art, and very often in our art, the art of self hosting.
― me
me
Kristoffer Grönlund
the slides
$ git clone https://git.liten.app/krig/baeste-draeng
$ cd baeste-draeng
$ just run
What do I mean by self hosting?
- Pick a cloud service you use
- Find an alternative
- Run it yourself (on a VPS)
...
- instead of Discord
- run Mattermost
...
- instead of Github
- run Forgejo
Why
- It's not that hard.
- It's fun.
- Resist Enshittification.
ENSHITTIFICATION
Github is not improving, only getting worse.
There are other choices!
Self-hosting lets me experiment!
Other reasons
- Too much AI
- Privacy concerns
- Own your data
- Cloud costs are unpredictable
Why not?
Email is a pain due to blacklisting.
- I use Fastmail (AU)
- For sending I use Brevo (FR)
...not impossible? see
https://maxadamski.com/blog/2025/10/email.html
...but definitely not on Hetzner.
A framework for hosting stuff yourself
First: Somewhere to put your stuff.
- Hetzner (germany)
- OVHcloud (france)
- Hostinger (lithuania)
- Glesys (sweden)
- A raspberry pi at home (more on that later)
DNS
Pick a domain name.
THIS IS THE HARDEST PART :(
Running at home
- Tailscale / Wireguard
- Old laptop
- NAS
- UPS
Great for large storage like photos, movies.
(Tailscale is Canadian, it's OK)
Data center at home
- pro: pretty blinkenlights
- pro: heats the home
- con: takes up space
- con: very loud
OS / System setup
- Debian
- cloud-init
- ansible
cloud-init
Script to setup VPS at creation, supported by Hetzner.
Example to start from here:
- Set up user, SSH, firewall...
ansible for setup
Can do more complex setup than cloud-init.
- name: Disable PasswordAuthentication
notify: Restart sshd
ansible.builtin.copy:
dest: /etc/ssh/sshd_config.d/10-no-pwd.conf
mode: '600'
content: |
PasswordAuthentication no
ansible, OS upgrades
I use ansible for ongoing maintenance.
- name: apt upgrade
hosts: all
tasks:
- name: apt update upgrade
become: true
ansible.builtin.apt:
upgrade: yes
update_cache: yes
cache_valid_time: 86400 #One day
Backups
#!/bin/bash
set -e
source /etc/restic-env
BACKUP_PATHS="/var/lib/docker/volumes \
/home /etc /data"
restic snapshots || restic init
restic backup $BACKUP_PATHS
restic forget --keep-last 7 --keep-monthly 1 --prune
Backups, where to
- Any S3-compatible storage provider
- Hetzner
- bunny.net
restic also supports SFTP over SSH, local directory, ...
restic restore
to restore from backup
restic mount
to browse the backup snapshot like a directory
No one except Google really needs Kubernetes
Keep It Simple Selfhoster
Coolify
- UI based service management
- Made for self hosting
- Makes running container-based services trivial
- Nice to have UI (can check stuff from phone)
- Notifications, backups, Docker Compose...
- Easy to setup
Other options
- dokku
- dokploy
- caprover
- plain systemd/docker
- ...
Haven't tried those myself!
Monitoring
- Beszel
- Dashboard
- More notifications
SSL Certificates
- Let's Encrypt (easy with Coolify)
- Make sure to monitor certificate expiry!
- Uptime Kuma can do this (run it with Coolify)
Disaster recovery
- Try VPS restore from backup
- If that fails:
- Spin up new VPS
- Setup using cloud-init/ansible
- Restore data using
restic restore
I've been self hosting some things for years.
Never had any major problems.
Incident: Mastodon fork became unmaintained.
Cause: Was running obscure fork. :p
Solution: Switched to GotoSocial.
Incident: Certificate about to expire.
Cause: Bug in Coolify (forgot config).
Solution: Fixed Coolify config, upgraded to get fix.
Incident: Services went offline.
Cause: Outage at Hetzner.
Solution: Fixed itself before I woke up.
That's it!