Should I Self-Host or Use Cloud Services? An Intro to Self-Hosting

I've been wanting for a few weeks to create my own blog and also be able to host my personal projects. But a huge question I had was where would I place it? What provider should I use?

All of these questions I remember answering when working freelance some time ago, building an app and deploying to the (sometimes cheapest) provider that I knew how to use. But then, I started thinking, what about when I need something that hosts my apps, my content? Where should I put my tiny spot of the internet? And should it be just one spot?

Planning for this is no easy task. At first glance, you would want to maximize your value by having the most apps/blogs/apis in a single box (in the self-hosting world, that's what we call a server or VM) paying the least for it. This first approach can have problems, of course, in theory you could get some shady free server running that will steal your data or you can pay a tiny amount for a box in Australia with a huge ping time or even consider using those freemium tier Oracle VMs that shuts down your machine at will.

Paying for good hosting services can be expensive, especially if you would like to have the physical location of your box to be near you and you do not want to pay the big bucks for the rich bald guy because you live far away from us-east-1.

The other side of this story is using "cloud-ready" services to host your applications, like Railways, Vercel and Digital Ocean droplets, and not having to worry about infrastructure or having to ask a LLM "how to change the port used to ssh into a machine".

However, when you don't have to worry with setting up your server you end up worrying about how much money you will pay these companies to run your applications for you.

This is not even the main point of why I think maybe using these cloud services to host your applications is not ideal. I think it comes down to learning. Have you ever bought a domain? Set it up to have Cloudflare DNS? Set up a web server with Caddy to reverse proxy requests to specific applications? Maybe you have, and maybe you have more experience with it than I do (probably); if so, it is because you had to do it a number of times to get it right.

You had to tinker with your server, reboot it, install updates, ask for help and install some SSL certificates on the way. Sometimes you would redirect all traffic to HTTPS and forget you did not have your domain set up correctly, and had to do it all over again.

This stuff reminds me of the time I've spent during my undergrad. It really is about learning by getting your hands dirty. For me, personally, this is the best way of fixating something that I will not forget.

Also, if you're anything like me, you would like to own something, tinker with it as you would like, and not be limited by a subscription, a license change or something that's so tiny at the end of the contract we sign when we finish creating our account.

That's why I've decided to get a box, and pay as little as possible and have the host be a trustworthy provider. From what I've found, Hetzner, RackNerd and Contabo are decent providers at a cheap price. This is very important because it is not easy being Brazilian and having to multiply by 6 every price tag you encounter in your searches.*

So I've settled it. I'm going to get a Hetzner box, and started my journey. For starters, I've begun researching about what did I need to do to secure my server: setting up SSH correctly, adding a new user, preventing someone from logging in as root and so on. I found and followed a really well-explained video by CJ at Syntax

After that, I've set up Ghost, an open-source blog platform (found it while checking out Jorge Castro's minimalist and clean blog, discovered him while checking out Bazzite and Bluefin websites, check him - and them - out!) and then started to configure my deployment solution. I'm still working on it, but I've configured Caddy and Docker and then the reverse proxy to redirect different requests to each service. I'm still following other tutorials and maybe this one by Dreams of Code is more fast-paced if you already know what you're doing.

Feel free to comment or reach out to me. This is my first blog post. First of many I hope!

*: About Brazilian providers: they sometimes have some strange decisions regarding marketing and how they present their price to us customers. Some, like Hostinger, have a big section dedicated to showing the price you would get if you get a 2 year deal contract, and also after that period the next two years would have an increase in price. If you choose to pay monthly, you will be "readjusted" to a higher pricing point as well.