mithlond-public/OKF/ARCHITECTURE.md
Lukasz Boryn c12604ebb4 feat(template): publish the Mithlond self-hosted Gitea template
A spare-machine Gitea forge, hardened, backed up and with CI, as a template.
Personal values are placeholders listed in the README.
2026-10-16 15:04:18 +02:00

2.4 KiB

type, purpose, answers, cites
type purpose answers cites
Architecture Map the services, their seams, and how outside traffic reaches each one.
What are this project's modules and seams, and how does behaviour flow through them?
compose.yml
Caddyfile
runner/config.yaml
scripts/gitea-backup
systemd/gitea-backup.timer

Mithlond — architecture

Request path

Internet
   │
   ├─ :443 (HTTPS) ──► Router ──► :443 host ──► Caddy ──► git.example.com → gitea:3000
   │                                               └────► example.com     → portfolio:8000 (optional)
   ├─ :80  (ACME)  ──► Router ──► :80  host ──► Caddy
   ├─ :2222 (SSH)  ──► Router ──► :2222 host ──► Gitea container :22
   └─ :2234 (admin)──► LAN only (not forwarded) ──► sshd (Arch host)

DNS: git.example.com and example.com  A → home IP (Cloudflare, DNS-only)
DDNS: ddclient on the host updates both A records via the Cloudflare API

Services

  • gitea (compose.yml:gitea) — gitea/gitea:1.23, SQLite. State in the bind-mount ./gitea-data/ → /data. Web on 127.0.0.1:3000 only, so the web UI is reachable from outside only through Caddy; SSH on 0.0.0.0:2222. Hardening and registration lock are env vars, which win over app.ini on every start (compose.yml:GITEA__service__DISABLE_REGISTRATION).
  • caddy (compose.yml:caddy) — owns 80/443, TLS from Let's Encrypt, certificates in ./caddy-data/. One site block per name (Caddyfile).
  • runner (compose.yml:runner) — gitea/act_runner, polls Gitea over HTTPS and starts each job as a sibling container through the host Docker socket. One job at a time, label alpine (runner/config.yaml:capacity).

Seams

  • edge network (compose.yml:external: true) — shared with an optional apex-site stack (e.g. a portfolio), which joins it from its own compose file. That site ships no proxy; the example.com block in Caddyfile is the only thing in front of it.
  • Env over app.ini — Gitea config that must stay put lives in compose.yml; docker compose up -d re-applies it.
  • Backup boundary — gitea-data/ is the only state that matters. The nightly gitea-backup.timer runs scripts/gitea-backup, which stops Gitea, snapshots that directory into restic on the backup drive, and starts it again. Caddy keeps serving the apex while Gitea is stopped.