Infrastructure
What exists at Google Cloud and at the domain registrar, before Docker or Ansible even come into play.
Google Cloud resources
| Resource | Value |
|---|---|
| Project | trinity-devops-eh |
| Region / zone | europe-west1 / europe-west1-b (Belgium) |
| Network | default VPC |
| VM service account | trinity-nodes, with no role |
| VM | Type | Disk | Role |
|---|---|---|---|
trinity-dev | e2-medium (2 vCPU, 4 GB) | 30 GB pd-balanced | dev environment, CI runner, deploy-dev runner |
trinity-prod | e2-small (2 vCPU, 2 GB) | 20 GB pd-balanced | prod environment, deploy-prod runner |
Both VMs run Ubuntu 24.04 LTS and were created with:
- Shielded VM: secure boot, vTPM and integrity monitoring;
- the
trinity-nodesservice account with no IAM role, instead of the default Compute account, which has the Editor role on the whole project; - a static external IP, which survives a VM stop.
Dev is the bigger of the two: it builds every image (CI runner) and runs the front end in dev mode.
Addresses
trinity-dev | trinity-prod | |
|---|---|---|
| Public IP (static) | 34.140.106.117 | 34.22.116.236 |
| Internal IP | 10.132.0.3 | 10.132.0.4 |
In the repository, the public IPs are only written in infra/ansible/inventory.ini.
The firewall
Two layers filter, one after the other: Google Cloud's in front of the VMs, then UFW on each VM.
The Google Cloud firewall
| Rule | Allows | Target |
|---|---|---|
trinity-allow-web | TCP 80 and 443 from anywhere | VMs with the web tag (both) |
default-allow-ssh | TCP 22 from anywhere | all VMs |
default-allow-internal | all traffic inside the VPC | all VMs |
default-allow-icmp | ping | all VMs |
The default default-allow-rdp rule was deleted: the VMs run Linux and do not need Windows remote desktop.
UFW
The ufw Ansible role denies all incoming traffic except ports 22, 80 and 443, on both VMs.
Docker bypasses UFW
Docker publishes its ports by writing its own iptables rules, which bypass UFW. That is why only Traefik publishes ports (80 and 443). The API, the web, the docs and the database publish none: they are only reachable through the Docker networks.
SSH
Key-only login: the Google Cloud Ubuntu image already disables passwords, and root has no key. To check it on a VM:
sudo sshd -T | grep -E "permitrootlogin|passwordauthentication"DNS
The records are managed at the Hostinger registrar. Each name points to its VM's static IP, where Traefik routes the request:
| Record | Type | Target |
|---|---|---|
trinity.jostud.com | A | trinity-prod |
api.trinity.jostud.com | A | trinity-prod |
docs.trinity.jostud.com | A | trinity-prod |
dev.trinity.jostud.com | A | trinity-dev |
api.dev.trinity.jostud.com | A | trinity-dev |
A new domain
Create the DNS record before deploying the Traefik route. Otherwise, Let's Encrypt fails (NXDOMAIN) and Traefik does not retry on its own: you then have to remove the route file from /opt/trinity/traefik/dynamic/ for a few seconds, then put it back.