July 20, 2025, 1:39 p.m.
This Website
Audio
I wrote this short text to record the motivation and the experiences behind building this website. I hope it's of interest to those who want to know what the learning and building process was like, or who plan to do something similar.
Motivation
As a data analyst, I'm quite familiar with tasks such as collecting data from the internet, running regressions and inference, or programming data processing with machine learning using R and Python (with a pinch of C++). All of these activities can be done locally on my own computer, often completely offline.
These are undoubtedly important skills to have for what I like to do. However, the world is changing, and the growing trend for some time now has been to move any computing activity to the cloud, that is, a non-local computer we only access remotely. Along with the world, we too must change!
While I actively study algorithms, statistics and data processing, there was still a rather bothersome gap in my knowledge: how to harness the power of the internet both to process data and to export and publish my results? How to run and publish inference and data visualizations automatically without having to leave my personal computer on? These were the questions that motivated me to learn how to deal with the web.
The most obvious way to start doing that is to learn how to build a website, I reasoned. Beyond the learning itself, I would have a platform to serve as a springboard for exploring new technologies, for showcasing projects and, in the open-source spirit of the internet and the programming world, for sharing my personal studies, whether in programming, economics or history, my main areas of interest (with the added benefit of encouraging me to read the books and articles I choose more actively). It would be possible to do this simply using Blogspot, a well-known blogging portal, or GitHub, the main platform for sharing code and projects, but I also wanted to communicate with people outside the programming world, and in a more personalized way.
Choices
The question remains, then: how to build a website? Trying to solve this problem, I soon discovered the interesting and diverse world of web development and quickly learned how simple and cheap it is, using shared hosting services and freely available ready-made designs, to create a page accessible to anyone in the world. In 5 minutes a user with very little experience can do it from scratch. The first version of this personal website, from late 2020, was made this way. However, there's no challenge in that, and pages built with these tools have limited flexibility, which motivated me to go further.
Very briefly, a website has three parts: the back-end, which handles the logic and performs a website's operations and data processing; the front-end, responsible for the elements that mediate between the user and the back-end; and the server, which stores the files and makes them available for anyone with internet access to view.
In Python, the language I usually program in, there are a number of extremely useful libraries for data analysis. I soon learned to work with Numpy, Pandas, SciKitLearn and so many other essential ones, but one was still unknown to me: Django.
Django is one of Python's great and celebrated tools, used as a framework for building web applications, a great option for the back-end. It's quite robust and sophisticated, present in products like Spotify and Instagram. Although it isn't the only package for this purpose, it seemed like the natural choice to expand my Python repertoire, learn the fundamentals of web development in practice, and have a personal website.
This is a simple, low-traffic site, so there would be no need to use such a powerful tool, but I couldn't resist the opportunity to learn such an important and popular framework, besides the fact that it makes interacting with the database quite simple.
As for the front-end, I considered using the much-appreciated React.js or Vue.js, which can be adapted for use with Django. A good part of the community does that, but since I prefer to focus on studying data analysis tools proper, I found no good reason to choose anything beyond Django templates, which are already part of the chosen framework, plus CSS with Bootstrap, which are simple, effective and perfectly up to what I wanted to create.
.accordion-body, though the transition does limit overflow.
.accordion-body, though the transition does limit overflow.
Finally, only the choice of server remains. While all the other decisions were made on technical criteria, here another variable comes in: cost.
The huge, heavy servers in the corner of the office always made a strong impression on me, but since I don't have very large or confidential data or processing, nor do I need a new heater for my home, there would be no reason to have a physical server, not even a small one. Choosing a cloud server is much cheaper, more convenient and more obvious.
However, the cloud is not one but many. The cloud computing market is growing fast, and with it the number of companies offering this kind of service. Google and Microsoft have introduced some innovations in this segment and their market shares have been rising - Microsoft Azure is quite popular in machine-learning communities.
Still, the main cloud platform used worldwide is Amazon's AWS, and it seemed advantageous to choose it so I could later integrate and learn other of the countless services AWS offers, such as AWS Lambda and Sagemaker. No less important, in my research AWS had more competitive and predictable pricing – cost is usually calculated based on usage – than its competitors; I can sleep soundly without worrying about a surprise US$ 90 bill.
With all the gears properly chosen, I had a plan! All that was left was to put it into practice.
Execution
My first obstacle was discovering that the web world runs on Linux, an open-source operating system quite different from Windows. If I wanted to set up a server for my website, I would need to relearn how to interact with the most basic functions of a computer.
Luckily for me, in 2021 this is easier than ever! Until recently I would have had to install a virtual machine or set up a second operating system alongside Windows, which is quite laborious; today, having a computer with Linux is as simple as installing WhatsApp. Technological progress doesn't just mean creating new things, but also making old ones easier.
After playing around and following various guides for many hours in this local, no-strings-attached playground, I felt ready to deal with my real cloud server.
Before doing that, however, it was even more important to create the Django project itself, the website, on my own computer, and then put it on the server. Fortunately this tool has excellent documentation and plenty of learning material. Although it isn't among the simplest things in Python, I soon got used to working with templates, views, models and the other elements to make everything work as planned.
As for the design itself, I turned to one of the many templates freely available online, which I completely modified to suit my taste. With a brief introduction and countless rounds of trial and error to deal with HTML and CSS (this is the most laborious part, requiring the most fine-tuning), aided by Bootstrap's ready-made elements, I finally managed to create a webpage with all the necessary parts.
With a site working perfectly on my machine, one pleasant Saturday morning I managed to learn the basics of performance and security for the server software, Nginx, which I judged more suitable and robust than the also popular Apache.
The last step, finally, was to put it all together. Rigorously following guides, I installed the NginX server on the Linux server rented in the cloud, which serves my Django project (connected to a PostgreSQL database) to the internet, using the Gunicorn software as an intermediary, and it's through these technologies that I make this content available.
Carrying out all these operations undoubtedly added a lot of knowledge to my repertoire, and I already feel much more comfortable dealing with servers, APIs and the internet in general. With a well-structured, functional, good-looking and pleasant-to-browse site (I hope you agree!), I now have all the structure needed to easily add more of my future projects, texts and notebooks exactly the way I designed, and to focus on my interests in data analysis and related fields.
This Website
*AI-generated content, based on my own information and instructions.
This website was born in 2020, when all I wanted was to learn how to publish something — anything — online. It looks quite different today: it went from a ready-made site builder to a custom Django application, and from a single AWS VM to a Kubernetes cluster running locally, with automated deployment and resilience layers that didn't exist in the first version.
What you'll find here
- Technical Architecture — how the site works today: network infrastructure, Kubernetes, CI/CD, and the stack choices behind it.
- Repository Structure — the source code's directory tree, fetched live.
- Original version (2021) — the motivation-and-learning account I wrote when I first built the site, preserved exactly as it was published back then — images and beginner's voice included.
As a data analyst, most of my work could always be done locally and offline — scraping data, running regressions, training models. But the world kept moving toward the cloud, and I was missing a piece: knowing how to publish and automate all of that without leaving my personal computer running. This site was how I chose to fill that gap — and it's still where I experiment with new technologies and share projects and studies.
Below is the current architecture; at the end of the post, the original 2021 text tells the story of how it all started.
Technical Architecture
This document describes, at a high level, how caiodonalisio.com works today — from network infrastructure to the CI/CD pipeline.
Overview
1. Network Infrastructure
The site runs on a single-node Kubernetes cluster, hosted on a local mini-PC:
inter-VLAN routing and firewall
VLAN isolation — the server sits on a dedicated VLAN, isolated from the rest of the home network. The router ensures the server VLAN has no access to the home network, that only specific devices can reach management SSH, and that outbound internet access is limited to what the Cloudflare Tunnel needs. This segmentation means that even if the server were compromised, there would be no lateral access to home devices.
Internet exposure — there is no port forwarding on the router. All inbound traffic goes through the Cloudflare Tunnel, which keeps a persistent outbound connection to Cloudflare's edge. That removes the need for a static public IP, open firewall ports, or manual TLS certificate management.
2. Kubernetes (K3s)
Single-node K3s with the following resources in the caiodonalisio namespace:
| Resource | Replicas | Role |
|---|---|---|
| Django / Gunicorn | 2 | Web application |
| NGINX | 1 | Reverse proxy + static files |
| PostgreSQL | 1 | Database |
| Redis | 1 | Cache + session store |
| Cloudflared | 1 | Tunnel daemon |
Storage — provisioned via K3s's local-path: staticfiles-pvc (2Gi) for collected static files, media-pvc (2Gi) for uploads and media, postgres-pvc (10Gi) for PostgreSQL data.
Health checks and resilience — the Django deployment exposes a /health/ endpoint, checked by readiness and liveness probes:
readinessProbe → /health/ (60s delay, every 15s, 3 failures)
livenessProbe → /health/ (90s delay, every 30s, 5 failures)
Combined with a PodDisruptionBudget (minimum 1 replica available) and zero-downtime rolling updates (maxUnavailable: 0, maxSurge: 1), this guarantees no downtime during deploys. A pre-stop hook waits 15 seconds before SIGTERM, letting in-flight connections drain.
3. Cloudflare Tunnel
The cloudflared daemon runs as a deployment in the cluster, routing public hostnames to the internal NGINX service. Three configuration details matter in practice:
hostNetwork: true— avoids intermittent 502s on single-node clustersdnsPolicy: ClusterFirstWithHostNet— keeps internal service resolution workingprotocol: http2— multiplexed connection to Cloudflare's edge
4. Application Stack
| Component | Version | Notes |
|---|---|---|
| Python | 3.12 | — |
| Django | 5.1 | Modular settings (dev / prod / test) |
| Gunicorn | — | 4 workers, port 3334 |
| Celery | 5.4 | Configured, workers disabled |
| PostgreSQL | 16.4 | Primary persistence |
| Redis | 7.4.1 | Sessions, cache, Celery broker |
Simplified Django project structure:
website/ # Project settings
├── settings/ # base / production / development
├── urls.py # Routes + /health/ endpoint
└── celery.py
blog/ # Main app
├── models.py # Post, PostFile, PostBook
├── views.py # Markdown rendering
└── storage.py # Custom OverwriteStorage
accounts/ # Authentication (CustomUser)
pages/ # Static pages
Serving — NGINX acts as reverse proxy and serves /static/ and /media/ directly; WhiteNoise is the fallback for static files; Gunicorn handles dynamic requests over WSGI.
5. CI/CD
The GitHub Actions workflow triggers on every push to main. Versions are generated automatically by python-semantic-release from the commit message: fix: bumps PATCH, feat: bumps MINOR, BREAKING CHANGE: bumps MAJOR.
Argo CD watches the repository's k8s/ directory and applies changes automatically (prune and self-heal enabled, with progressive retries). The pipeline itself updates the image tag in the manifest, which triggers the sync.
6. Containerization
Multi-stage build, using uv (a Rust-based package manager) to speed up dependency resolution:
# Stage 1: builder — resolves and installs dependencies with uv
FROM python:3.12-slim AS builder
...
# Stage 2: runtime — copies only what's needed
FROM python:3.12-slim
COPY --from=builder /.venv /.venv
COPY . /usr/src/
EXPOSE 3334
CMD ["./entrypoint.sh"]
entrypoint.sh runs on container startup: waits for PostgreSQL to be reachable, runs collectstatic and migrate, syncs media files, and finally starts Gunicorn.
7. Full Request Flow
8. Security Considerations
| Layer | Measure |
|---|---|
| Network | VLAN isolation, no port forwarding |
| Edge | Cloudflare DDoS protection and WAF |
| Transport | TLS managed by Cloudflare |
| Cluster | Network policies, secrets for credentials |
| Application | CSRF, secure cookies, ALLOWED_HOSTS |
| CI/CD | Image vulnerability scanning (Trivy) |
Last updated: August 2026.
Repository Structure
Below is the directory tree of this site's repository, fetched and rendered live.
Transparency note AI was used in this post for: generating the written content from the site's repository · creating the English version