first commit

This commit is contained in:
raphy 2024-12-06 04:12:34 +01:00
commit 2505bf3004
Signed by: Wintermute
GPG Key ID: D85876B31F4275CF

93
selfhost.md Normal file
View File

@ -0,0 +1,93 @@
+++
template="rants/defaultrant.html"
title="Self-hosting guide"
content="Sefhosting guide"
draft=true
[extra]
backtotop="true"
+++
# Why
Today a lot of our digital infrastructure is being built by a handful of companies. These companies have enormous power: they can spy or help governments spy on users, they have control of your data, and, honestly, they're either trying to get money from you, or you're what's being sold. Because nothing is free!
### Some things are free but require technical skills
Luckily you can host your own infrastructure and run and manage your own digital services.This is still not free but can be done on a laughable budget, such using a (relatively) cheap raspberry pi or clone, or getting a cheap VPS (2-5$ month). Some people throw solar panels into the mix making it really free.
You'll probably have to learn a lot of things, especially if you don't have experience with Linux, networking, etc. Self-Hosting is a time-consuming hobby and there is always tinkering involved. This is a very good thing if learning is one of your goals but tot everyone can afford to waste a weekend trying to set up a complex firewall configuration.
# How
If you do have the time, you should:
## Getting started
### Picking Hardware
I am not an expert in hardware. If you know about hardware text me and help me write this section.
I've hosted my services on raspberries from 3 through 4. This website is hosted on a raspberry. If you can get your hands on a raspberry or a similar board, you can get yourself a very capable computer which also consumes very little electricity!
Depending on what you're planning to do you might need better hardware, and probably you won't regret getting a lot of disks: since you run a server 27/4, speed won't matter as much unless you want to run heavy tasks real time (video transcoding being the most popular), but disk space is never too much. Backups, backups backups.
Just think that the entirety of wikipedia is 24GB (English, no pictures, compressed) as October 2024.
You might also need some specialized hardware if you want to do AI, but I am not qualified to speak of it.
If you don't want to invest in hardware but still want to try out selfhosting, you can rent a server for a monthly fee:
### Picking a cloud provider
I found very convenient to have a small VPS on a cloud provider even if you decide to own your hardware at home. This is because cloud providers have good uptime, good network speed and a public ip, three things residential networks often lack.
There are many cloud providers our there, you can find crazy deals at [LowEndBox](https://lowendbox.com/). Some other famous providers are [Akamai (Linode)](/www.linode.com), [Vultr](https://www.vultr.com/), and many more. I use Digital Ocean, for which you can find a referral link on the homepage.
If you have a server at home, you can use your VPS as the public entrypoint of your services: point your domains to the public VPS static ip and route the traffic to your server(s) at home. This hides your ip address and protects your home network from a rudimental DDoS attack.
### Buy a domain
To give your services an url such as `photos.mywebsite.com`, you have to buy the `mywebsite.com` domain. You can buy domains on [NameCheap](www.namecheap.com), [GoDaddy](url) and many more. `dekedin.me` was bought on NameCheap, and they have good support.
It is wise to buy your domain and your VPS in two different places, because if one company decides you're not a good customer anymore (or shuts down the product you use, or goes bankrupt) it's easier to switch when you're not entirely relying on a single one.
You can buy the domains from a website and handle your DNS records elsewhere.
For instance, I manage my DNS records through DigitalOcean, despite having bought them on NameCheap. This is useful because DigitalOcean has better APIs for my needs!
This means that you can probably buy a domain anywhere. I don't have any good suggestions on the matter.
### Picking an operating system
So you have some hardware, or a machine on the cloud!
#### Native
If you don't want to think too much about it, use a popular or suggested (from your cloud provider or for your hardware, like Raspibian for Raspberry) OS.
I use [Void Linux](#). This is because I am used to it and just generally enjoy their design decisions. You can pick any distro you're familiar with.
[FreeBSD](#) is also a very good choice, being kind of niche it might require more time to set up and what you'll learn will not transfer easily to Linux. This is a shame because some of the things you will learn have no Linux equivalent, like the ease of jail management and the tight ZFS integration. These two features are especially useful for server use, and combining them allows for some very efficient setups. FreeBSD recently got support for OCI container images too, and this will greatly enhance Linux-Freebsd interoperability.
Another nice thing about learning FreeBSD is just exploring a system that's different than Linux. It's very refreshing and instructive to learn that there are different ways to solve some problems.
#### Multi-node
Or, you could install [Proxmox](url), and use it to manage different OSes on virtual machines. Virtualization is not free, but nothing stops you from running software on the proxmox host.
Even if you have a single physical machine, setting up 2-3 virtual machines makes for a very convenient testing ground for distributed applications, or multi-node apps in general.
One day you might upgrade your setup with another physical server, or you might already own multiple servers. You might decide to run part of your services on the cloud, where they'll scale to infinity if needed.
If you learn to manage multiple machines from the start scaling out to infinity will come for free. Currently the state of the art for this is Kubernetes, which is admittedly very complex but whose complexity can hardly be avoided.
Kubernetes is also overkill for most applications, but it has some very nice properties for system administrators.
You can even run Kubernetes on low end hardware using k3s or k0s. These are also very good to learn kubernetes.
### Get software
Now that you can install software, you can:
awesome selfhosted[]/awesome sysadmin