2024-12-10
How this page came to be and how it runs (1)
Long before I ever thought of making my own website I was confronted with having to choose a domain to go by, not for the web, but for Java package names.
I, at the time, did not even know how to register a domain. I saw that all the projects I was importing used their domains, (like net.minecraft
, com.mojang
, etc.) but some smaller stuff used me.funny_internet_name
. I thought, the me.
was just what you put there when you did not have a domain, unaware that it actually existed and so I started using me.blackfur
.
Over time I learned that me.
was actually a domain you could use on the internet, but I stuck with me.blackfur
just for convenience. Eventually though, I was approached by someone who had checked out my "personal website" blackfur.me
and had found themselves on a phishing scam. This reminded me that, now that I had sufficient funds, I could buy a domain.
First I checked if blackfur.me
was still available, unfortunately the domain was parked and could only be acquired for 100€+. An amount, which I simply did not want to pay. Looking for alternatives, I stumbled upon the .gay
TLD and on a whim, decided to buy blackfur.gay
for just 2€ a year. I quickly set up DNS and started thinking about how I would create the website to be hosted.
I did not want to go for anything fancy and if possible write the contents in Markdown, which I already used to write a bunch of my personal documents. I also did not want to ship any client-side JavaScript, so any such framework was out of the question. Looking at all the static site generators I got swamped with hundreds (literally) of options, many of them with little to no differences. Eventually, I settled for "Zola" a static site generator using the "Tera" templating engine.
I don't have a firm reasoning for this choice, but it seemed fairly capable and stable. More of how I set up Zola will be posted in part two. For now, we will focus on the build process and the web server used to host the generated pages. Since I have by far the most experience with NGINX, working with it in production, that is what I chose for my personal use as well.
The entire website is stored in a private repository on GitHub where I push to from my PC and pull from to my VPS. The repository includes a Dockerfile
and a docker-compose.yml
. The Dockerfile consists of two stages, build
and a run
. The build stage uses the image zola provides (ghcr.io/getzola/zola
) to build everything:
1 FROM ghcr.io/getzola/zola:v0.19.2 AS build
2 COPY . /app
3 WORKDIR /app
4 RUN ["zola", "build"]
The results of that are then used in the run stage, which uses an NGINX image. Personally, I prefer the Alpine versions of whatever I use, so nginx:alpine
1 FROM nginx:alpine AS run
2 WORKDIR /app
3 COPY nginx.conf /etc/nginx/nginx.conf
4 COPY --from=build /app/public /app/www
Lastly this Dockerfile is accompanied by a Compose-YAML, which invokes it. Eventually, this is supposed to orchestrate even more services, but for now, only one is set up.
1 services:
2 web-server:
3 build:
4 context: .
5 dockerfile: Dockerfile
6 target: run
7 ports:
8 - 443:443
9 - 80:80
10 volumes:
11 - /<path_to_full_chain>:/app/certs/fullchain.pem
12 - /<path_to_private_key:/app/certs/privkey.pem
So now I got a domain, a chosen tech-stack and a way to deploy everything, in the next posts we will take a look at configuration and the general content plan.