Self-hosted Web Server

Project Overview
How my self-hosted setup evolved: from a single hand-managed machine to an infrastructure fully described as code, producing the same result on every run.
Key Features
Three layers
Provision, configure, reconcile: each layer has its own repository and stops where the next one begins
Continuous deployment
A new image triggers the production release, and each merge request can get its own ephemeral demo
VPN-based administration
As a security choice, infrastructure administration goes through a VPN
Backups and isolation
Automated backups, and critical services isolated in dedicated virtual machines
Technical Skills
Infrastructure as code
Moving from hand-noted commands to an infrastructure described as text, versioned and reproducible on every run
Idempotence
Writing configurations that can be safely rerun: the desired state is reached or kept, never degraded
Knowing what runs
Applying a reviewed plan as-is and dry-running a configuration to see every difference before it happens
Pull-based deployment
Understanding the GitOps model: the cluster reconciles itself with the repository, and deploying means changing git
Detailed Description
It all started on a single machine, with Ubuntu installed straight on the hardware and no virtualization. I had to write down every command so I wouldn't forget it, and nothing was reproducible. Backups came down to a Bash script copying Docker volumes to my laptop: unreliable, and I didn't always run it.
I wanted three things. To write my whole infrastructure as text and get the same result every time I ran it, with no manual steps. To be able to set up large building blocks cleanly, such as SSO or a better-secured GitLab in its own virtual machine. And to put real backups in place, something I had never truly had.
The infrastructure now rests on three layers, each in its own repository. Provision: Terraform creates the virtual machines and their resources. Configure: Ansible installs and sets up everything that lives inside those machines, then bootstraps the Kubernetes cluster. Reconcile: with GitOps, the cluster continuously compares its state with the repository and aligns itself to it. Each layer stops where the next one begins: Terraform never configures a machine's system, Ansible hands over once the cluster is bootstrapped, and no pipeline pushes production into the cluster; the cluster pulls whatever the repository describes.
Critical services are isolated in dedicated virtual machines and, as a security choice, administration goes through a VPN. Automated backups are in place, and monitoring brings metrics, logs and alerts together. On the application side, a production deployment is triggered as soon as a new image is published, without ever editing a version by hand, and each merge request can be deployed to an ephemeral demo environment. This portfolio is itself deployed through that pipeline.
A few rules frame it all. Everything lives in git, and no secret is ever stored there in plain text. Every change goes through the repository and GitLab CI; the only exceptions are a few first-run settings that some software only accepts through its own interface. Each merge request covers a single topic, and I am the one who merges.
This project taught me what infrastructure as code really brings. I know exactly what I am about to run: a Terraform plan is generated, then applied as-is once approved, and I can dry-run an Ansible configuration to see every difference before it happens. Idempotence changed the way I work: running things again never degrades the desired state, and I no longer chain commands that lose track of where I started.