Pushing site to production

Cyril Šebek • 7/6/2024, 9:34:25 AM

Here, I will start with an explanation of how I got here: to having my own website and writing a blog, almost pretending as if I am someone and someone will read this.

You need a website RIGHT NOW

That was the title of a YouTube video by NetworkChuck three years ago. In that video, he lists three reasons:

  1. Stand out
  2. Make a difference
  3. Create opportunities

I would say that if you are interested in his reasons, go check out that video. Personally, I would expand it with a 4th point:

  1. Learn

Even by following his video on how to get your own website for free, you might learn something. But if you decide to go a step further and invest that 200 CZK (~8 EUR) and buy yourself a domain, you’ll learn even more. Or take an even bigger step and get yourself proper hosting and manage that. Maybe you are a Linux user and feel the need to frown upon everything that wasn’t coded in the command line; then you can program your site from scratch. Just doing that will teach you an incredible amount about how the web works. And maybe your first website won’t be really pretty, but you can always make it better later as you learn more. In fact, that’s what I’ve done—this is probably my 6th iteration of my personal website.

The “Linux user’s way”

Since I am a Linux user, I had to opt for the hardest possible way—well, maybe not THE HARDEST, but close enough, I’d say. Of course, I haven’t coded my own OS just to run my website on my custom-designed CPU, so it could have been harder, but I decided that using a website builder was not for me, a true Linux user. Since I was already playing with some microcomputers, I thought, “Wow, maybe I could use my Raspberry Pi.” And yes, of course, I could. I started by setting up my Raspberry Pi as a home server of sorts.

While researching, I found a lot of amazing stuff that you could self-host, and I fell into that rabbit hole—Pi-hole, Unbound DNS, Jellyfin, Nextcloud—it felt like I tried everything. That was when I realised that one single Raspberry Pi would not be enough, so I got another… and another… and then I suddenly had four running in a Kubernetes K3s cluster.

The Pi cluster (or DRAG0N_PI, as I’ve named it) was great, but it had some issues, mostly due to the limitations of the Pis themselves, like hardware encoding/decoding, 4GB RAM limit, etc. So I did the only sensible thing and upgraded once more—to an old computer with a 4th generation i7 CPU, 16GB of RAM, and a dedicated RX 580 GPU. It worked like a charm, but it too had some issues. The most prominent was the fact that it had trouble turning on after a power outage, and there was no real way to remotely turn it on.

Then one day, I found someone offering old IBM servers. The first one I got was an x3550 M3, but I didn’t even have the time to properly set it up before I got more—two x3550 M4s with a managed 24-port switch and an old IBM StorWize V3700 storage unit with an expansion enclosure, fully kitted with disks totaling 25TiB of raw HDD storage. Of course, that was a bit expensive, but still surprisingly cheap, only about 6500 CZK (~270 EUR).

That was in October 2023. I then set everything up, migrated what I had, and expanded what could be expanded. I had more than enough of everything—CPU cores? Each server decked with 2 CPUs, and each CPU being 6c/12t (6 cores, 12 threads), totaling 48 threads. RAM? Older DDR3 ECC RAM is pretty cheap, totaling 142 GB. Storage? The 25TiB in 42 drives, as already mentioned. Pretty sweet, right? But now you may ask, how am I managing all that? Am I just running Ubuntu Server on everything? Of course not—actually Debian, but that’s under the hood. I am running Proxmox. It’s a great piece of software for managing something like that, although I would recommend it even for single servers and even smaller servers, like my previous “one old computer” server.

Finally building the website ?

So now, it’s been almost a year since I bought my domain and started self-hosting something on it. My website at the time was mostly placeholder plain HTML that just said it was my domain, with a bit about me, my hardware, and what I’d done so far. But it looked terrible.

So, I did the only sensible thing—I made a bet with my friend (who also has his own website, but built using a website builder) on who would have the better website by the end of summer 2023. Yes, that was when my website was being hosted on a cluster of Pis and slowly migrated to an old computer. To put it lightly, I didn’t win that bet. I redid my website in Next.js and realised how much I actually hate Next.js.

Believe it or not, that version of my website didn’t look too terrible, but it was very empty because the CMS didn’t really work. Adding content would have taken me an unreasonable amount of time. So right after setting up my fancy IBM servers, I started working on another version of my site…and didn’t finish. I tried a couple more times but never actually finished. I was still trying to make it work with Next.js or React because my friend had recommended it to me sometime before that. I also tried writing my own C web server because, for some reason, I thought that would be a great idea (it really wasn’t).

Astro saves the day

Actually… yes, because I don’t think I would have been able to get here without it. I found it by accident when trying to learn how to make Android UI (another project I think I will talk about, so stay tuned) and a video about Astro.js was recommended to me by YouTube’s algorithms.

For those of you who don’t know what Astro is, go look it up and read more about it. In short, it’s a JS framework that allows you to combine plain HTML with JS and basically every JS framework possible. It then builds as much of the page as possible as static HTML, because it’s the fastest, with these interactive things called ‘islands’. Those islands can be in whatever framework you like, even Next or React. Yes, most interactive things on my page are still in React, thanks to the fact that they are from the shadcn/ui library—really amazing stuff there. But everything that doesn’t need to be dynamic or interactive is just almost plain old HTML, simple yet effective. Also, I use Tailwind because I hate CSS.

It took me about four months to get here, but keep in mind that I am a student and it was during the school year. I started working on this version about four months ago. The first month, I just experimented with Astro by doing some silly things and testing different ideas. Then I started building this, piece by piece, from little components. First the main page, then the blog, then all the theming options. I added i18n (internationalisation, aka translations) and did a lot of bug fixing. I don’t claim it to be bug-free now, but at least it builds and doesn’t randomly crash when you make a typo in the URL or something like that.

And now I am here, for once not writing code but text in English about writing code. Isn’t that fun?

Conclusion

In the end, I am sure I’ve learned a lot over the past two or three years while building my server and this website. It has definitely been an interesting project, which I would recommend to anyone interested in computers and programming. It doesn’t matter if you are just starting out or are an expert in C or video game development; either way, it’s going to be interesting, and I bet you can learn something new.

I’d say that one of the best things about working with computers is the fact that they are constantly changing, forcing you to learn something new. Even just maintaining that server is some amount of work—all the updates and then checking what got broken during the updates and troubleshooting it. Fixing all the random errors that just appear for no apparent reason, like my Matrix Synapse server taking up 80 GB with a PostgreSQL database (I am sure I will write about that too).

So yeah, NetworkChuck was right—you need a website.