Vista de Lectura

Hay nuevos artículos disponibles. Pincha para refrescar la página.

Ten years of self-hosting

I want to use my first post to share my 10 year self-hosted journey.

Ten years ago, I lived in a student apartment that was terrible for someone loves the internet: there was no WiFi coverage and the power cut off every night after 10 PM. Each desk was assigned an 24/7 Ethernet port, however, the download speed was like ~10MB/s billed per GB.

During that time, portable drives were still quite popular in China. While their major use case was to carry some textbook-related materials for printing/presentation, students also exchanged some... precious Linux ISOs in person as dessert after dinner. I myself had a 512GB portable disk that stored around 200GB of such things, including some distros that people wouldn't recommend for children (I mean Arch or Linux with BTRFS before 2015). I often copied some of those to my phone at a really poor, unsatisfying, sdcard level of speed and conducted a meticulous examination of those content at bedtime.

This period marked the beginning of my journey into self-hosted solutions. I bought a Raspberry Pi and started using it as a WiFi access point. It worked smoothly and to some degree reduced my mobile bill. I soon realized that with a mobile power bank, I could have night WiFi coverage. Later, I discovered that the VLC app could directly play content from a network device using the SMB protocol, transforming my setup into a literally plug-and-play NAS. This setup gave me a very positive experience, which encourages me to always challenge things with self-hotsed solution.

Graduated from that university, I moved to the US for a master's degree. Despite having fast internet and full power/WiFi coverage, I faced a new challenge: accessing videos that required a China IP. This was particularly difficult since VPN software would not work due to the invisible wall known to every Chinese student aboard. Solutions like Shadowsocks were server applications, but my Raspberry Pi in China was in a wireless network backed by a NAT'ed ISP. How could I use it for this purpose?

I eventually used a VPS as a gateway and developed a solution quite similar to Tailscale. Its transport layer evolved multiple times, starting from TLS, DTLS (UDP version TLS), QUIC, KCP, to a home-made custom protocol for better performance in high latency network. The solution is not only for this purpose, but also for reducing the complexity of direct peer discovery and handling partial network failure e.g. one of the two routers is offline.

Now, I live in California in a small room with fast but not very stable internet. Working at a tech company allows me to invest more in my hobby as well as gain more knowledge about distributed systems. I subscribe to a Hetzner dedicated server located in Finland, set up a NAS at home, and run a small SBC server with 2x2TB drives at my parents' house in China. Now I have new challenge: persistently store important content, including photos, videos, code, and hard-to-find internet contents. Additionally, my parents, who believe in traditional Chinese medicine, needed to store numerous videos.

It's said that redundancy is the only way to reverse the increase of entropy. Silent bit rot, weird application behavior after months or years of server uptime, followed by sudden disk failures after a casual reboot are nothing surprising. Replication is necessary and geo-replication is better, but handling version conflicts, due to the nature of CAP in bidirectional sync, can be very hard, unless you know what can be sacrificed. While the concept of RAID is cool, is it truly useful for backups (rather than high availability)? Another hidden cost lies behind recognition, or to say it more clearly it is the maintenance load: How do you map your folder level replication/encryption/backup schedule configratuions to your whole dataset? Do you still remember it say 5 years later?

Those questions are somewhat opinion based, but I designed my own file system as the answer to those questions. My FS performs geo-replication, handles versioning and consistency, and runs on ZFS to provide read validation features. With this setup, I reached an extraordinary milestone: storing 3TB of content ... spreaded in 37TB of storage. The development process is quite pleasant and challengable and I recommend everyone to come up with their own solutions if time is allowed.

Combining the VPN and file system I developed, I created a quite stable system. I'd like to thank to the manufacturers (G* and K*) for their obviously mature and high quality mesh WiFi and HDD products, which made me consider automated failover e.g. network partitioning and disk failure more carefully and deeply.

Now, I have a better yet similar experience to when I first delved into self-hosted solutions back to 10 years ago — maintaining a server to play videos. The difference is that now, I'm more interested in problem-solving than the problem itself.

I love problem solving, that is why I love self-hosting. I know B2, Google Drive, combined with whatever somehow very secure VPN can achieve the same purpose in a ... much lower cost, but that is the point of self-hosted as a hobby, right?

submitted by /u/yukino_x
[link] [comments]
❌