
(More) self-hosting best practices for devs
Last week I asked this subreddit for advice on self-hosting best practices for developers. Ya'll gave me some great suggestions, including:
- Distributing with Docker, along with a compose file
- Using a non-root user
- Tagging the image with semantic versioning (
v1.5.1) - Using YAML instead of ENV, and documenting all the values
- Adding a health-check endpoint
- Providing an installer script (
install.sh) - Making the DB configurable rather than hard-coding the instance names
- Allowing maintainers to handle backups, but documenting the restore process
I implemented all those and added a few more things that I hope will help:
- A doc site that syncs with my main repo's
/docsdir, so the self-hosted instructions don't get stale. - A selfhosted CD pipeline. A GitHub Action deploys to a VPS that mimics a homelabber's setup and runs automated tests after every PR. If it fails, a webhook sends a note to our support channel. This helps us not break things for selfhosters during normal development.
- Documenting how to set up the firewall & reverse proxy. Probably overkill for this group, but I always forget so I figured why not.
- Showing the version in the cmd palette, allowing the user to always know which version they're on.
If anyone is feeling generous and wants to give any specific feedback, here is the full selfhosting guide.
My takeaway from all this as a dev who is new to selfhosting was to get better at Docker and stick to the conventions. I'm glad I asked and am excited to keep simplifying even further. Thanks!