DEV Community

Why You Should Self-Host Everything

Błażej Adamczyk on May 27, 2024

In today's digital age, it seems like everything is subscription-based. If you're not paying for a service, you're likely being monetized by watchi...
Collapse
 
amjadmh73 profile image
Amjad Abujamous

Thank you for writing this article. There is a reddit community where we help each other figure things out if someone is stuck at a certain task. Anyone self hosting their software is welcome to join!

reddit.com/r/selfhosted/

Collapse
 
sein_digital profile image
Błażej Adamczyk

I'm already part of it :D

Collapse
 
nexustx profile image
Jack

Go to !selfhosted@lemmy.world on join-lemmy.org/ instead. Unlike Reddit, Lemmy can actually be self-hosted and it's federated, just like Mastodon.

Thread Thread
 
best_codes profile image
Best Codes

Not what is being discussed here. We are talking about self-hosting websites, not posting on Reddit.
The Reddit link was a link to a community related to the post.

Collapse
 
nexustx profile image
Jack

Reddit sucks, use Lemmy instead. It's open source and can actually be self-hosted, and different instances are federated via ActivityPub, just like with Mastodon. And don't forget what Reddit did to 3rd-party clients. There's no reason to use it in 2024. There's a relatively big self-hosting community on Lemmy: !selfhosted@lemmy.world

Collapse
 
sein_digital profile image
Błażej Adamczyk

you are selling that lemmy hard

Thread Thread
 
nexustx profile image
Jack

Cuz Reddit hates their users and their CEO is an absolute asshole

Thread Thread
 
ezpieco profile image
Ezpie

Well finally someone agrees with me! I knew that jerk was a... well you know... a jerk... Yeah I don't english, and that's the reason why you use Lambda! I EzpieCo am the creator and the only protector of privacy and happiness!!! I have created the world's first ever open-sourced community driven privacy focus trust based social media app, Lambda!

I know I am a professional marketer, real profession with a PhD... Yup I am a profession at my job.

But seriously I sure hate Zuck Muckerberg and Steve Huffman

Collapse
 
phlash profile image
Phil Ashby

Thank you for raising this topic and providing practical options for a home server (personally I have a Dell mini-tower sever with a 4TB disk array running Debian), looking forward to the articles about software packages :)

Are you going to cover some of the downsides too, such as: email deliverability in an increasingly closed ecosystem of just a few large providers; denial-of-service risks on residential network links; broadband providers dislike of self-hosting (not all it must be said!); information / network security considerations when exposing service endpoints to the 'net (the patch vigilence required, monitoring / alerting, defence tools, etc.)?

Collapse
 
tnypxl profile image
tnypxl

broadband providers dislike of self-hosting (not all it must be said!);

It's not the self-hosting that matters to ISPs. Its exposing your residential broadband connection to incoming traffic from the public internet. The point of self-hosting is largely not that at all. If anything you're likely using VPNs or some kind of private proxy to access your self-hosted platform remotely (if you're not running it in the cloud).

Collapse
 
phlash profile image
Phil Ashby

Ah OK - I didn't get that from the original article - I was assuming self-hosting Internet facing services specifically to avoid centralised monopolies, such as email, web pages, file-sharing, social media, etc. You were looking at Internet-accessible home services 😄

Thread Thread
 
tnypxl profile image
tnypxl • Edited

No, I meant exactly that. ISPs don’t care you’re using those self-hosted services unless you’re trying to distribute and download copyrighted content.

Collapse
 
sein_digital profile image
Błażej Adamczyk

Exactly what @tnypxl said. Self-hosting is not about exposing anything to internet. It's all about keeping it in the intranet. You can of course connect to your network via various options, like VPN (having static IP, or Dynamic DNS) or via tunneling (there are sites that act as tunneling proxy and manager, so you don't worry about setting up VPN by yourself)

Collapse
 
mmuller88 profile image
Martin Muller 🇩🇪🇧🇷🇵🇹

downsides and upsides please :)

Collapse
 
nlxdodge profile image
NLxDoDge

While I am also self hosting a couple things, keep in mind that internet isn't free, just as electricity.
A have a bit more lifting to do with other applications 🏴‍☠️ (kugh), but my CPU uses at best 65 watts at 100%, if I pay 30 cents for every KWh at 50% CPU usage average, at the end of the year it costs me around 85 euro's.

And internet costs me around 60 euro's a month, because of the monopoly that they have here, sadly. So that's 720 euro's a year (Which I am paying regardless, but anyways).

And the server itself was like 300-400 euro's when building myself.

Collapse
 
sein_digital profile image
Błażej Adamczyk

That true, but the electricity and internet bills vary depending on country/region you are from, and those are inevitable anyway. Of course, you have to pay extra for electricity running your own server, but the cost of internet remains the same regardless.

Collapse
 
opisek profile image
Opisek • Edited

Honestly, a Raspberry Pi will do just fine! Don't discourage people from using it. The more people get into self-hosting, the better, and we should not be gate-keeping anyone. I rocked a Raspberry Pi 4B with 4GB of RAM for the longest time with over 20 or 30 containers and different services. Since you're likely the only person using them, the limited processing power and memory isn't a huge problem. Only about one year ago did my Raspi start to fail me (though I suspect changing the thermal paste could've done the trick) which is when I switched to a much more powerful setup made from repurposed parts of my gaming computer, that I upgraded at the same time.

Collapse
 
sein_digital profile image
Błażej Adamczyk

Sure, for couple containers you are running and lightweight version of rasbian it's fine. But the more containers you run, the more you start to realize it's limitations. Although I have version 3 not 4 or 5, so maybe there was higher performance spike then what I imagine. Nonetheless, for media server for example, raspy seems not enough :)

Collapse
 
opisek profile image
Opisek

Oh yeah, the performance is significantly better. Raspberry Pis 4 and up run on 64 bit instead of 32 bit for starters. Media servers might be where they hit the limits, especially if we're talking about 4K.

Collapse
 
xcs profile image
Cristian

Awesome article!

I also think self-hosting is the future, and have considered it to be so for many years while working on my self-hosted analytics platform. I avoided providing a "hosted" solution, because that would alter my goal of making self-hosting as easy as possible.

Collapse
 
rishabk7 profile image
Rishab Kumar

Great post, I would also suggest, if you have an older laptop or you are planning to upgrade your PC, use the old one as a homelab server. I did something similar, I have a 2012 dell laptop, which is pretty outdated for daily use, but I upgraded it with an SSD(costed me $150) and configured it with linux. Now it acts as my homelab.

I would add that there is some complexity to set this up, especially in terms of security!

Collapse
 
sein_digital profile image
Błażej Adamczyk

Sure! Security considerations are minor in the local network, but it's worth your time nonetheless.

Collapse
 
deozza profile image
Edenn Touitou

Sure, because self-hosting prevents you from electricity outages, network outages, price surges for both of these, you can have redundancies, you are a security expert and can assure your clients you are protected against 99% of malwares and cyber attacks, you will never trip on the RJ45 and unplug the server causing severe damages to your SLA.

Self hosting is good for personnal projects and hacking as a hobby. Not for production deployment.

Collapse
 
sein_digital profile image
Błażej Adamczyk

Exactly. The post is all about homelab. Homelab is exactly what you do for personal projects and hacking :)

Collapse
 
dipanjan profile image
Dipanjan Ghosal

To avoid bankruptcy in case your cloud provider decides to keep scaling you "unlimitedly" on a ddos attack

Collapse
 
nieebel profile image
Nieebel

Great overview for self hosting: fosstodon.org/@selfhst

Collapse
 
nieebel profile image
Nieebel

You could also install Docker on refurbish old/broken Android smartphones and use them as an Raspberry Pi alternative: digitalcourage.social/@aligyie/108...

Collapse
 
documendous profile image
Documendous

Very good article. This needs to be emphasized imo. It would help many new and aspiring devs to better understand what goes on from front to the very back. Great post!

Collapse
 
wickenhauser profile image
Mark

I totally agree! I tell everyone that the cloud is just someone elses computer, and no matter how look at it, they have control over your data and access to your data.

Collapse
 
ronen_magid_4e425854de7c9 profile image
ronen magid • Edited

Hosting from home is okay if you have a blog or a simple non critical free app. But you cannot compare the reliability of cloud services to the mess you can experience as a residential internet customers. Your paying customers don't care if Verizon is now digging in your neighborhood and networks' down, or if your cable providers suspects your incoming traffic and blocks or throttles it. I think it's pretty safe to assume that you'll step on the "network doesn't work" landmine at the worst of times -- when you're actually successful and begin ramping up on traffic and traction. Imagine having to shut down your service for a week or 10 days so you can migrate to the cloud.... how many clients will you be able to keep?

With that said--- the choice isn't limited to "AWS/GCP/Azure" or "Your home office" when it comes to hosting. You can co-locate as well and put your "metal" infrastructure at a professionally managed hosting center. You gain full control over hardware costs and pay for electricity (as you would at home) but you benefit from a reliable, professional grade network that isn't subject to residential limitations (e.g. "hey Verizon, I know I only have 1Gbit, but I need my house to support 100Gbit because my app took off. Can you install that by Monday?"........ [hangup]).

Collapse
 
sein_digital profile image
Błażej Adamczyk

I think you completely missed the point. This is related to homelab and intranet, not business essential infrastructure. The point of doing homelab is to play around, run some services locally that are open-source and reduce subscription costs (this is for the cost-saving), do some pentesting environment, or - if we actually considering business related cases - run internal business apps on the on-prem server. And guess what? ISP for companies offer priority lines with 2-6hr SLA. Running SaaS startup on your home network is not a part of discussion here. And I agree, that's a crazy scenario.

Collapse
 
ronen_magid_4e425854de7c9 profile image
ronen magid

I believe you're right about me missing the point then.

Collapse
 
best_codes profile image
Best Codes

In today's digital age, it seems like everything is subscription-based. If you're not paying for a service, you're likely being monetized by watching ads or providing personal data to companies that don't necessarily have your best interests at heart.

Your links at the bottom are affiliate links. 🤪

Collapse
 
sein_digital profile image
Błażej Adamczyk

You gotta pay for that electricity bill running that server :D

Collapse
 
best_codes profile image
Best Codes

Haha, of course. I understand. :)

Collapse
 
langrisha profile image
Filip Dupanović

I use a Chromebook for development. It's from 2021 and I still like the machine, but with the specs I'm pretty much forced to work from remote environments.

Having a good connection to your development environment and editor's server is kind of important. I mostly use VS Code and I travel a lot, and unless I'm able to move my environment as I change continents, the experience degrades.

I'm kind of used to it, but whenever I get my hands on a expensive device to work from a bit, I miss the instantaneous startups and feedback from interacting with the terminal.

Collapse
 
kwnaidoo profile image
Kevin Naidoo

Depending on the type of data, self-hosting is not a bad idea.

I build servers often, and one of the biggest disadvantages of self-hosting is disaster recovery. Many of these services will replicate and backup your data in multiple locations, they also have teams of security experts constantly patching and improving security so you don't have to worry about hacking so much.

Perhaps another approach is to buy a dedicated or VPS server from a cloud provider and set up your infrastructure there. It's fairly easy to set up a VPN or purchase a 3rd party VPN and lock your traffic just to your local home network.

The hosting company can then handle the maintenance, backups, and security to an extent.

PS: If you want to self-host PHP applications (or any other stack for that matter), have a look at my open-source tool: plexscriptables.com/

Collapse
 
rolfstreefkerk profile image
Rolf Streefkerk

another issue, in this geographical region, are power outages.

for some, a UPS will be mandatory, if you're running a live service that is.

Collapse
 
grex2595 profile image
Rayten Arnold Rex

I think it's pretty important to include the other costs. For streaming services like Netflix and backup services like DropBox, you'll need storage and redundancy. That gets expensive quick. For streaming services, some of that money goes into creating/acquiring new content. That's going to cost money. For backups, you should have an offsite copy of your backups. Now you need to double your home infra to accommodate safe backups. I still agree with the premise of self-hosting being a good replacement for some of these services, plus it's fun, but I'm not so sure you save money switching from Netflix to home media, or from DropBox to home backup.

Collapse
 
sein_digital profile image
Błażej Adamczyk

Yeah, but we are getting into pretty hardcore area. At this point it's probably time to invest into a RACK in your closet not Intel NUC :D Of course, even at this scale it's still cheaper in the long run. But yeah, at entry level you can still achieve that with simple NUC and NAS working in tandem.

Collapse
 
grex2595 profile image
Rayten Arnold Rex

Partially agree. When you start doing home media, you run out of space on your, I'll assume, 1TB SSD pretty quick with just a few 4K movies. My first purchase after getting more serious about this was 6 (I think) 4TB NAS drives. I need some time before my Netflix and Disney+ subscriptions eclipse that cost. Next is the movies. If I like and want to own about 3 or 4 movies released each year, that's going to cost me between 30ish and 120ish dollars per year depending on format. If you are a real movie nut, I would guess around 8-10 movies per year at 80ish to 300ish dollars per year depending on format.

One of the benefits of streaming services is distributed costs. We watch a couple movies per night. Let's say you watch a couple of movies per month. We're more expensive, but you help pay for our costs. When we switch to self-hosting, our costs will probably go up because you're no longer helping pay our bill. That's definitely somebody should take into consideration when trying to switch to self-hosting.

On a different note, I am putting racks in my house and getting much more expensive/powerful equipment, but that's got more to do with my passions/hobbies around self hosting than because I want to do all my own backups.

Thread Thread
 
sein_digital profile image
Błażej Adamczyk • Edited

If you are a real movie nut, I would guess around 8-10 movies per year at 80ish to 300ish dollars per year depending on format.

Unless you arrr! :D 🏴‍☠️

Collapse
 
aatmaj profile image
Aatmaj

Nice post. I had been thinking about this recently form the point of view of small enterprises and individuals who want to host a service like a webapp or machine learning servers. Or perhaps a hobbyist or individual developing a side project.

A limitation of this approach is that the device would require to be powered on 24x7 for running a server.
Morever, the system cannot scale and adjust to the load. Even when there is no requirement, the computing power is wasted while in time of load, there may be insufficient power.

Any ideas how to get around this?

Collapse
 
sein_digital profile image
Błażej Adamczyk

To save up a little energy and also some computing power you can incorporate docker monitor, that will rescale containers depending on the load.
For server itself you can use wake-on-lan approach. It's quite interesting topic, so I might write something more in the future about it, but I don't have anything concrete at the moment out of the top of my head.

Collapse
 
nieebel profile image
Nieebel

sustainability could also be a reason to self-host. You could lower the co2 footprint of your service by using refurbished hardware or choosing renewable energy or shut down when not needed.
There already some hosting providers going in this direction: lite.framacalc.org/green-webhost-r...

Collapse
 
tommytwopuds profile image
Tom

It seems strange to say this but it's very important to consider the support of your homelab over the years and decades.

Getting it all working now is great but things come along that change your priorities and the amount of time you can spend hacking on things. e.g. kids. If you go all in on this, you're in it for the long road! It is easy to let things slip when you don't time to maintain and then vulnerabilities and system instability creep in. I speak of this from bitter experience having run (and continue to run) a homelab for 20+ years, now with a family!

Oh, and whatever you do, always do it with automation first using infrastructure as code.

Collapse
 
captaindigitals profile image
CaptainDigitals • Edited

I've always advocated for self hosting especially for online businesses, because you can wake up and all your hard earned business be taken away from you because of x,y,z.

Even more important in regards to self hosting what I'm exploring is Web3 addresses to build a community and own my digital footprint pay once and own it forever instead of web2 addresses where you buy a domain and get charged yearly and pay for privacy etc.

Web3 urls is the future to me.

Freename.io

Collapse
 
sadiq-bd profile image
Sadiq Ahmed

I use a SBC. It has quad core cortex a53 with 1GB of ram ... Just like orange pi zero 2. And using cloudflare tunnel to expose local services. For now i don't have any external storage. But will try to add later.

Collapse
 
aminnairi profile image
Amin

Are there any good AMD-based home servers availble out there?

Collapse
 
sein_digital profile image
Błażej Adamczyk
Collapse
 
bcollins profile image
bcollins • Edited

I have always thought the future would be some kind of decentralized crypto based hosting network. Where people are able to put up their resources and be paid in crypto to guarantee uptime and reliability would be the future of safe and secure "self hosting". A bit surprised we aren't more there yet.

Collapse
 
captaindigitals profile image
CaptainDigitals

Freename.io

Collapse
 
bwca profile image
Volodymyr Yepishev

Couldn't one go with VPS? Or that's not sovereign enough? 🫣

Collapse
 
sein_digital profile image
Błażej Adamczyk

VPS adds to the monthly cost. Sure it's cheaper at first, but the cost builds up, and you get way more power with mini pc, or repurposed old parts.

Collapse
 
captaindigitals profile image
CaptainDigitals

And you own it. A VPS you pay for, it's not your platform, again you can wake up and the host be gone.

Collapse
 
jason_nichols_330710ac6c0 profile image
Jason Nichols • Edited

I have a few problems with this article. First off, why are you talking about NUC being the affordable option? Amazon renewed computers are cheap. For less than $200, you can pick up a nice i7 with 32 gigs of RAM and a TB SSD. With Rocky (free 1:1 bug for bug RHEL) installed CLI only, Apache, a few web-based admin tools, and maybe another hard drive or two, that's a LOT more than you will ever need for easily hosting personal audio/video streaming, network "cloud" storage, jitsi video conferencing, hosting your own WordPress or family only social media site, etc.

Also, I've been self-hosting everything for more than ten years and it hasn't really gotten any easier. With friendly distributions like Ubuntu and then Mint, it's been incredibly easy for a LONG time. Linux has come quite far since I installed my first RedHat distro, back, long before they went enterprise, when "red neck" was an official installation language. For a little more than 20 years, the only time I've had WinDoze on my daily drivers was when it was required by a company I worked for

I was streaming video from my living room to my friends' houses or hotel rooms before Netflix was even a wet dream for some Cali hippie. I had terabytes of recorded TV shows and movies ripped from DVD, sequentially encoded so it could be played without downloading the whole file first (streamed). As far as music, it was a well known rule that if somebody came into my apartment with a CD binder, it became my property until every CD had been ripped and encoded to mp3. I had access to it all, anywhere I had a computer and an internet connection.

If anything, modern web browsers have made it a bit HARDER to do so securely by balking over self-signed SSL certs. Yes, there's Let's Encrypt, but the goal is to be self-hosted and self-sufficient, isn't it? It's about, not only throwing off the shackles of subscriptions, but also not having something go away just because somebody decides to stop offering it. It's bad enough that I have "bought" a movie online that the provider lost streaming rights to, so I no longer had access to it. If LE goes down, I want to be able to encrypt my traffic without my browser screaming at me and making me click through 3,761,842,395 warnings about how my self-signed SSL certificate that I made myself and supports 512 bit encryption (double the standard encryption rate) may be fraudulent because no "trusted" CA backs it...

Collapse
 
xavier_carreragimbert profile image
Xavier Carrera Gimbert

I fully agree with your points, and I believe self-hosting can be a good option in certain cases.

However, there are several drawbacks:

  1. You have to spend time and resources on your infrastructure. In contrast, using a service like Vercel handles all of this with just a few clicks.
  2. You need to ensure that the computer running the website is always on and available.
  3. You must take full responsibility for the security of your infrastructure.
  4. You still need to rely on CDNs and other tools to make your website accessible worldwide.
  5. Your infrastructure might work but may not be as optimized and efficient as those provided by services like Vercel.

My point is that self-hosting can be a good option, but in many cases, it is not.

Someone who wants more control over their code might consider using a VPS and externalizing only certain services like DNS or database providers (e.g., Planetscale).

What do you guys think?

BONUS:
If you decide to self-host, take a look at Coolify, which makes the process much easier.

Collapse
 
ostap profile image
Ostap Brehin • Edited

Sounds great, but what if the homelab catches fire? Where'd you store the backup and would you?

Collapse
 
lotfijb profile image
Lotfi Jebali

i am a type of dev that wants everything almost ready hosting wise

Collapse
 
wwjw profile image
Wilco W

Is it possible to make Forem work with Wordpress? E.g. have one profile, share data between the two, allow forem comments underneath a Wordpress article?