Infrastructure

How the infrastructure runs

Two machines and one public address. A 1 vCPU edge server holds the certificates and answers the internet; a private machine with no public address runs every container. Every value on this page is the real one.

Two machines, one public IP

Only one host is reachable from the internet, and it is deliberately the least interesting one. It runs nginx and a WireGuard tunnel and nothing else — no Docker, no application, no database, no state worth stealing. Everything an attacker would actually want sits on the far side of the tunnel, on a machine with no public address at all.

Public edgePrivate VM
Hostnameclinovm-rnd-ardi
SSHssh clino (a local alias; key-only)reachable over the tunnel / LAN
Public addressone public IPv4 on eth0 — whatever the DNS A records resolve tonone
Tunnel address10.10.0.1/24 on wg010.10.0.2/24 on wg1
Other interfaces—two LAN interfaces (eth0, eth1)
CPU / RAM / disk1 vCPU · 957 MiB · 58 GB8 vCPU · 23 GiB
Runsnginx + wg-quick@wg0. Nothing else.Docker 29.6.1 — every container, every product

The interface names are asymmetric on purpose

The tunnel is wg0 on the edge but wg1 on the private VM, because that machine already had a wg0 from an earlier site-to-site VPN. Any firewall or routing rule written against “wg0” is therefore correct on one host and silently wrong on the other. Always name the interface for the machine you are on.

The trade is stated rather than hidden: one edge is one failure domain. If the edge goes down, every product behind it goes down together. That is accepted in exchange for a single place to patch, a single certificate story, and a machine holding the real data that is simply not addressable from the internet.

The tunnel

WireGuard carries everything between the two machines. The edge listens; the private VM dials out, which is what lets it live behind consumer NAT with no port forwarding and no static address of its own.

SettingValue
Subnet10.10.0.0/24
Edge (listener)10.10.0.1, interface wg0, the UDP port in ListenPort of /etc/wireguard/wg0.conf
Private VM (dialer)10.10.0.2, interface wg1, service wg-quick@wg1
Peer allowed IPs, seen from the edge10.10.0.2/32 — one peer, one address
Spare addresses10.10.0.3+ — reserved for a second compute host

The edge firewall is four rules and no more. Note that the WireGuard UDP port must stay open or the tunnel never re-establishes after a restart:

ufw status · clino
OpenSSH      ALLOW  Anywhere
<wg-port>/udp ALLOW Anywhere   # WireGuard — the tunnel itself (ListenPort)
80/tcp       ALLOW  Anywhere      # http
443/tcp      ALLOW  Anywhere      # https

Check the tunnel is alive with sudo wg show on either end — a latest handshake older than about three minutes means it is down, and every product is unreachable regardless of how healthy the containers look.

The system, in one picture

Three layers, and the boundary that matters is the third one: which containers may join a shared database network, and which simply cannot reach one.

Browser
→
clino · nginx
terminates TLS
→
WireGuard
plain HTTP
→
Traefik
per product
→
landing · dashboard
docs

Who may reach a database

A container reaches only what sits on a network it has joined. In GAOS's stacks that is one service out of four — the rest cannot resolve a database name at all, not GAOS's and not a neighbouring product's.

ContainerOwn stack networkShared database network
dashboardyesyes — this is the point of it
traefikyesno
landingyesno
docsyesno

Least privilege as topology, not as policy

The shared network also carries MySQL, Redis, Qdrant and RabbitMQ belonging to other projects. Because the proxy, the landing page and the docs never join it, they cannot reach any of that even by accident — there is no rule to remember and nothing to enforce at runtime. deploy/check-stacks.sh asserts the membership so a future edit cannot quietly widen it.

The path of one request

A request crosses three hops, and the load-bearing detail is that TLS ends at the first one. Inside the tunnel everything is plain HTTP — WireGuard is already the encryption, so a second TLS layer within it would buy nothing and cost a second set of certificates to manage.

BrowserHTTPS :443
gaos.mfardiansyah.id
→
nginx · clinoterminates TLS
the one public IP
→
WireGuardplain HTTP
10.10.0.1 → 10.10.0.2
→
TraefikGAOS's own
:18301 → :80
→
Containerlanding · dashboard
docs

nginx picks the backend from a map keyed on hostname, forwarding to a port that belongs to exactly one product and one environment. It also sets the headers the application can no longer work out for itself:

nginx · clino
map $host $backend {
    hostnames;
    .dev.gaos.mfardiansyah.id   10.10.0.2:19301;   # longer pattern wins
    .gaos.mfardiansyah.id       10.10.0.2:18301;
    .dev.clino.id                10.10.0.2:19101;
    .clino.id                    10.10.0.2:18101;
    default                      "";
}
server {
    listen 443 ssl;
    http2 on;
    ssl_certificate     /etc/letsencrypt/live/mfardiansyah/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mfardiansyah/privkey.pem;
    if ($backend = "") { return 444; }   # unknown host: answer nothing at all
    location / {
        proxy_pass       http://$backend;             # http, not https — see above
        proxy_set_header Host              $host;
        proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header Upgrade           $http_upgrade;
        proxy_set_header Connection        $connection_upgrade;
        proxy_read_timeout 3600s;
    }
}

Who owns TLS

Certificates live on clino and nowhere else, issued by certbot over HTTP-01 for two exact hostnames. Nothing behind the tunnel holds a certificate, and no wildcard is involved.

The design said DNS-01 wildcards; reality said otherwise

The infrastructure spec called for wildcard certificates via certbot --dns-cloudflare. These domains are not on Cloudflare — both mfardiansyah.id and clino.id delegate to ns1/ns2.dns-parking.com, so there is no Cloudflare API to authenticate against. GAOS needs only two exact names, never a wildcard, and an exact name validates over HTTP-01 with no DNS credentials at all. The problem disappeared rather than moving somewhere else.

certbot · clino
# no --dns-* plugin: HTTP-01 answers from the webroot nginx already serves
certbot certonly --webroot -w /var/www/acme \
  -d gaos.mfardiansyah.id -d dev.gaos.mfardiansyah.id \
  --cert-name gaos --agree-tos -m <email> --non-interactive

# renew hook: validate first, then RELOAD -- never restart
nginx -t && systemctl reload nginx

A wildcard would still need DNS-01, so a product that wants many subdomains has to solve the provider question first. GAOS sidesteps it by serving one origin per environment.

No proxy behind the tunnel has ACME

Every product's Traefik runs a single web entrypoint on port 80, with no websecure entrypoint and no certificatesResolvers block. That is not an oversight waiting to be tidied up. Adding one would create a second, unmanaged certificate story competing with the real one — on a machine that cannot answer a challenge from the internet in the first place.

The real client IP

Because the edge terminates TLS it is an ordinary reverse proxy, not a transparent one: every connection arriving at a product's Traefik comes from 10.10.0.1, not from the user. The user's real address travels in X-Forwarded-For, and each proxy must be told which peers are allowed to assert it.

Get that wrong and nothing looks broken. Traefik discards a header it does not trust and substitutes the peer's own address, so every visitor on earth collapses into one value — and any per-IP rate limit behind it silently becomes a single global bucket. It stays invisible until the first abuse incident.

deploy/stacks/traefik.yml
entryPoints:
  web:
    address: ":80"
    forwardedHeaders:
      trustedIPs:
        - "10.10.0.0/24"     # the tunnel — the edge is 10.10.0.1
        - "172.30.10.1/32"   # gaos-prod-int gateway
        - "172.30.11.1/32"   # gaos-dev-int  gateway

The two /32 entries exist because this daemon runs with EnableUserlandProxy: true. Ingress to a published port is normally DNAT'd with the source address preserved, in which case Traefik sees 10.10.0.1 and the first line is the one that matters — but where docker-proxy relays instead, the connection is re-opened from the bridge gateway and Traefik sees 172.30.10.1. Each stack pins its own subnet precisely so that gateway address is stable enough to name here.

Verify it, do not assume it

Send a request through the tunnel carrying a recognisable header, then read the first field of the access log:

bash
ssh clino "curl -sS -H 'Host: gaos.mfardiansyah.id' \
  -H 'X-Forwarded-For: 203.0.113.9' http://10.10.0.2:18301/api/healthz > /dev/null"

docker compose -f deploy/stacks/compose.prod.yaml logs --tail 1 traefik
# first field (ClientHost) must read 203.0.113.9 — not 10.10.0.1, not 172.30.10.1

Rules that keep it standing

Four constraints hold the design together. Each fails quietly when broken, which is why they are written down rather than left to judgement.

Nothing runs on clino

No Docker, no application, no state. It has 1 vCPU and 957 MiB and is shared by every product — anything consuming memory there risks taking down the front door for all of them, not just for itself.

Nothing binds a public interface

Published ports name 10.10.0.2 explicitly. Without that prefix a port also listens on both LAN interfaces too, works perfectly, and is quietly reachable from the office LAN.

TLS belongs to the edge

One certificate story, one renewal process, one place to look. A stack that terminates its own TLS has to be discovered before it can be debugged.

Headers, not PROXY protocol

The edge speaks HTTP and sets forwarded headers. Sending a PROXY protocol preamble to a proxy not expecting one returns HTTP 400 on every request — the two settings are a contract and have to change together.

How TLS was set up, step by step

Done on 2026-08-04. Recorded because the ordering is not obvious: nginx needs a certificate to open a :443 block, and the certificate needs nginx to answer :80. The way out is to serve :80 first, issue, then add :443.

  1. DNS first. Two A records to the edge’s public IP. Wait for real propagation — HTTP-01 fails on a name that does not resolve, and Let's Encrypt rate-limits failures.
  2. Back up /etc/nginx before touching anything.
  3. Install certbot — no DNS plugin needed.
  4. Move :80 from the stream block to an HTTP block serving the ACME webroot plus a redirect. Both cannot bind :80, so they change together.
  5. Issue with --dry-run first, then for real.
  6. Add the :443 block and remove :443 from the stream block — again, together.
  7. Add the renewal hook. Without it nginx keeps serving the expired certificate after a successful renewal, which surfaces roughly 60 days later as a total outage.
bash · clino
# 3 — no --dns-* plugin: HTTP-01 needs no DNS credentials
apt install certbot

# 5 — rehearse against staging before spending a real attempt
certbot certonly --webroot -w /var/www/acme \
  -d gaos.mfardiansyah.id -d dev.gaos.mfardiansyah.id \
  --cert-name gaos --agree-tos -m <email> --non-interactive --dry-run
# then again without --dry-run

# 7 — /etc/letsencrypt/renewal-hooks/deploy/reload-nginx.sh
#     validate, then RELOAD. A restart drops live connections, and a
#     broken config that gets restarted takes the edge down completely.
nginx -t && systemctl reload nginx

Two traps, both caught by nginx -t or worth knowing

http2 on; (nginx 1.25.1+) goes inside each TLS server block; this box runs nginx.org stable 1.30, so the deprecated listen 443 ssl http2; parameter is not used. Always nginx -t before reload — a rejected config never reaches the running process. And the certificate covers only the two GAOS names: any other host reaching :443 falls to default "" and gets 444, a closed connection that says nothing.

Verifying it end to end

The one check nothing else will make for you is whether the real client address survived the hop. Everything can look healthy while every visitor on earth shares one rate-limit bucket.

bash
curl -sS https://gaos.mfardiansyah.id/api/healthz      # {"ok":true,"database":"gaos"}
curl -sS https://dev.gaos.mfardiansyah.id/api/healthz

# certificate: issuer, dates, and BOTH names in the SAN
EDGE_IP=$(dig +short A gaos.mfardiansyah.id | grep -E '^[0-9.]+$' | head -1)
echo | openssl s_client -connect "$EDGE_IP:443" \
  -servername gaos.mfardiansyah.id 2>/dev/null \
  | openssl x509 -noout -subject -dates -ext subjectAltName

# THE ONE THAT MATTERS: compare your own public IP with what Traefik logged
curl -s https://api.ipify.org; echo
docker compose -f deploy/stacks/compose.prod.yaml logs --tail 1 traefik
# first field must be YOUR address — not 10.10.0.1, not 172.30.x

Measured on 2026-08-04 the logged ClientHost matched the caller's real public address exactly, so the X-Forwarded-For chain is intact from nginx through Traefik to the application.

Where GAOS's own two environments sit inside this, and how to bring either up, is in Development and production. How the machine is shared with unrelated products is in Living beside other products.