2026-11-07 15:36:14 +01:00
|
|
|
# tomtervel.no's DNS
|
|
|
|
|
|
|
|
|
|
The zone is `dnsconfig.js`, applied to Cloudflare with
|
|
|
|
|
[DNSControl](https://dnscontrol.org). No state file: every run compares
|
|
|
|
|
the file with the live zone, so it can be run by anyone with the token,
|
|
|
|
|
from any machine.
|
|
|
|
|
|
2026-11-07 16:29:56 +01:00
|
|
|
## From CI
|
|
|
|
|
|
|
|
|
|
`.gitea/workflows/dns.yml` runs on kasse's host runner. Every push that
|
|
|
|
|
touches `dns/`, on any branch, runs `check` and `preview`: the run's log
|
|
|
|
|
is the diff, and nothing changes. Applying it is a person pressing
|
|
|
|
|
**Actions -> dns -> Run workflow** on `main`, so merging is never the
|
|
|
|
|
cutover by accident. The token is the repo secret `CLOUDFLARE_API_TOKEN`.
|
|
|
|
|
|
|
|
|
|
## By hand
|
|
|
|
|
|
2026-11-07 15:36:14 +01:00
|
|
|
```sh
|
|
|
|
|
paru -S dnscontrol
|
|
|
|
|
cd dns
|
2026-11-07 16:00:30 +01:00
|
|
|
# The token in dns/cloudflare.env (gitignored, chmod 600), one line:
|
|
|
|
|
# CLOUDFLARE_API_TOKEN=...
|
|
|
|
|
set -a; . ./cloudflare.env; set +a # bash; in fish: export (cat cloudflare.env)
|
2026-11-07 15:36:14 +01:00
|
|
|
dnscontrol check # the file parses
|
|
|
|
|
dnscontrol preview # what would change, nothing changed
|
|
|
|
|
dnscontrol push # change it
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
`creds.json` names the token by its variable only, so it is in the repo.
|
2026-11-07 16:00:30 +01:00
|
|
|
The account ID is not needed (it is only for creating zones), and there
|
|
|
|
|
is no state to keep, so no S3 keys either.
|
2026-11-07 15:36:14 +01:00
|
|
|
|
|
|
|
|
## The token
|
|
|
|
|
|
|
|
|
|
tomtervel.no is in Bendik's father's Cloudflare account. He makes a token
|
|
|
|
|
for it (My Profile -> API Tokens -> Create Token -> "Edit zone DNS"),
|
|
|
|
|
with **Zone / DNS / Edit** for **tomtervel.no only**, and hands it over
|
|
|
|
|
outside of git. A token for one zone's DNS can do nothing else in the
|
|
|
|
|
account. Revoke it there when it is no longer needed.
|
|
|
|
|
|
|
|
|
|
## Before the first push
|
|
|
|
|
|
|
|
|
|
The file was written from what the zone publishes, which is not all of
|
|
|
|
|
it: a record Cloudflare holds that nobody looks up from outside would
|
|
|
|
|
not be in it, and `push` deletes what is not in the file. So once:
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
dnscontrol get-zones --format=js cloudflare - tomtervel.no > /tmp/tomtervel-live.js
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
and compare it with `dnsconfig.js`. Anything there that is still used
|
|
|
|
|
goes into the file. Then `preview`, and read every line of it: the
|
|
|
|
|
first push is meant to change the apex and `www` (from proxied to
|
|
|
|
|
kasse), add `id`, `chat` and `_dmarc`, and change the SPF record.
|
|
|
|
|
Nothing about Zoho's MX should appear.
|
|
|
|
|
|
|
|
|
|
## Order, when the vel moves here
|
|
|
|
|
|
|
|
|
|
1. On kasse, `kasse-dkim-tomtervel.sh` makes the vel's signing key and
|
|
|
|
|
prints its public half. Put it in `KASSE_DKIM`.
|
2026-11-07 16:29:56 +01:00
|
|
|
2. Actions -> dns -> Run workflow on main (or `dnscontrol push`). The apex
|
|
|
|
|
leaves the old website at this moment.
|
2026-11-08 13:32:28 +01:00
|
|
|
3. The Actions variables `PORTAL_HOST=tomtervel.no`, `RAUTHY_HOST=konto.tomtervel.no`,
|
|
|
|
|
`CHAT_HOST=samtaler.tomtervel.no`, the deploy workflow run, and the Caddy blocks in
|
|
|
|
|
`host-caddy/` on kasse. `RAUTHY_HOST` is chosen once: a passkey belongs
|
|
|
|
|
to the name it was made on.
|
2026-11-07 15:36:14 +01:00
|
|
|
4. Only then `mail.from: post@tomtervel.no` in the content repo's
|
|
|
|
|
`site.yaml`; before step 2 that mail fails every check.
|
|
|
|
|
|
2026-11-07 16:44:51 +01:00
|
|
|
The hosts in `dnsconfig.js` and the `*_HOST` variables are the same names
|
|
|
|
|
and have to stay so; DNSControl does not read the variables.
|