Skip to content

Infrastructure ​

What exists at Google Cloud and at the domain registrar, before Docker or Ansible even come into play.

Google Cloud resources ​

ResourceValue
Projecttrinity-devops-eh
Region / zoneeurope-west1 / europe-west1-b (Belgium)
Networkdefault VPC
VM service accounttrinity-nodes, with no role
VMTypeDiskRole
trinity-deve2-medium (2 vCPU, 4 GB)30 GB pd-balanceddev environment, CI runner, deploy-dev runner
trinity-prode2-small (2 vCPU, 2 GB)20 GB pd-balancedprod 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-nodes service 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-devtrinity-prod
Public IP (static)34.140.106.11734.22.116.236
Internal IP10.132.0.310.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 ​

RuleAllowsTarget
trinity-allow-webTCP 80 and 443 from anywhereVMs with the web tag (both)
default-allow-sshTCP 22 from anywhereall VMs
default-allow-internalall traffic inside the VPCall VMs
default-allow-icmppingall 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:

sh
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:

RecordTypeTarget
trinity.jostud.comAtrinity-prod
api.trinity.jostud.comAtrinity-prod
docs.trinity.jostud.comAtrinity-prod
dev.trinity.jostud.comAtrinity-dev
api.dev.trinity.jostud.comAtrinity-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.