I’ve been recently deploying apps rather frequently on my personal droplet that I use for self-hosting. I tried hosting some bulkier apps and I was surprised when they ran without crashing or bothering any of the other apps that were already deployed.
I was impressed by this setup, and I hope that writing this post inspires confidence in others to self-host their own software.
VPS Information
I have a single $6 droplet and a 50GB volume mounted to it that costs $5. I reckon most people would be able to do without needing that extra 50GB, but I have to mention it for the sake of completeness.
I have allocated 4GB of disk space for swap. I did that while attempting to host a minecraft server (and not succeeding), but I left it that way. My RAM usage usually doesn’t exceed 2GB in total, but I host apps like Plausible (Website Analytics) and Synapse (Matrix server), which recommend having 2-4GB of RAM.
- Memory: 1GB
- CPU: 1vCPU (Regular, not the Premium Intel/AMD offering)
- Disk: 25GB Disk + 50GB mount
- Datacenter: Bangalore
- OS: Ubuntu 20.04 (LTS)
- Cost per month: $6 (Droplet) + $5 (Extra disk space) = $11
Software that I self-host
# | App | Description | Deployment method | |
---|---|---|---|---|
1 | My blog | Static website built with Hugo | Static with Caddy | |
2 | Plausible | Website analytics | docker-compose | |
3 | Trilium | Notetaking | docker-compose | |
4 | Memos | Notetaking | docker-compose | |
5 | Miniflux | RSS Reader | supervisor | |
6 | Komga | Manga Reader | supervisor | |
7 | Synapse | Matrix homeserver | docker-compose | |
8 | Mautrix-Telegram Bridge | Matrix-Telegram Bridge | docker-compose | |
9 | Otto | Cute doggo discord bot that plays music and chess | supervisor | |
10 | Otto-web | Web app for otto | supervisor | |
11 | Minesweeper | Fully client-side minesweeper | Static with Caddy | |
12 | Self-hosting 101 Slides | Notes from my workshop, built with mdbook | Static with Caddy | |
13 | … more slides | More static sites from other talks | Static with Caddy |
Deployment tools
- Caddy: Webserver for
reverse_proxy
and serving static sites. - supervisor: For running services that I need to define (not systemd)
- docker-compose: To deploy more complex apps. I use
restart: unless-stopped
orrestart: always
to automate restart on rebooting crashes - Makefile / rsync: To write deployment scripts
- PostgreSQL: used by some of the apps
- Redis: Used by some of the apps
supervisor configuration is simple enough that I can define all my services in the same /etc/supervisord.conf
file
(unlike systemd). This is a huge help because I can copy paste configuration from the same file. It is easy to understand
so I know what to change.
The same is true for Caddy. I configure all my public sites in /etc/caddy/Caddyfile
. Most website entries only need 3-4
words of configuration. This file also acts as a registry that I can refer to, to know which sites I have deployed and
disabled. As an added plus, I don’t have to manually configure SSL for sites deployed on Caddy. I like this much more than
nginx and apache, where configuring new sites takes up multiple steps, and the Certbot SSL routine has to be repeated each
time.
I use docker-compose instead of supervisor when a project has messy dependencies. It is easy to setup and I don’t have to
add supervisor entry for it. I find this convenient. I use docker ps
to know which containers are running. I use volume
mounts so that apps that use more disk space can use the larger 50GB disk.
rsync
is very handy for deployments. I first heard about it after I had already had some experience hosting apps by hand
on servers, and I felt stupid about all the hacks I had used before that to transfer files between my computer and the VPS.
You can read more about it here.
While this is already a cost-effective setup, I want to move to actually hosting apps on my own hardware in the future. I’ve been putting it off because I’ve been on the move a lot recently. I recommend that even more if you can do it.
It’s been a rewarding journey for me. I have rotated different tools before settling on these, and I’m sure I’ll continue to explore more.
Ciao! 👋