Alt i Actions-variabler og -hemmeligheter, og tomtervel.no sin DNS #1

Merged
bl merged 6 commits from rollout into main 2026-11-07 16:49:17 +01:00
2 changed files with 74 additions and 2 deletions
Showing only changes of commit e183510466 - Show all commits

No files matched your search

+61
View File
@@ -0,0 +1,61 @@
# tomtervel.no's DNS: dns/dnsconfig.js, applied to Cloudflare by
# DNSControl on kasse's host runner. A push that touches dns/, on any
# branch, shows what would change (`preview`) and changes nothing. The
# change itself is a person's: Actions -> dns -> Run workflow, on main.
# So merging is not the cutover; pressing the button is.
#
# Push only, never pull_request: the repo is public, and a stranger's pull
# request must not run on kasse with the token. The token is the repo
# secret CLOUDFLARE_API_TOKEN, DNS edit for tomtervel.no only
# (dns/README.md).
name: dns
on:
push:
paths:
- dns/**
- .gitea/workflows/dns.yml
workflow_dispatch:
jobs:
dns:
runs-on: fish
env:
DNSCONTROL_VERSION: 5.7.2
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
steps:
- name: checkout
run: |
rm -rf checkout
git clone --depth 1 --branch "${{ github.ref_name }}" "${{ github.server_url }}/${{ github.repository }}.git" checkout
# The release binary, checked against the release's own checksums,
# kept beside the portal lint so each version is fetched once.
- name: dnscontrol
run: |
bin="/var/local/cargo-target/dnscontrol-$DNSCONTROL_VERSION"
if [ ! -x "$bin" ]; then
tmp=$(mktemp -d)
base="https://github.com/StackExchange/dnscontrol/releases/download/v$DNSCONTROL_VERSION"
tar="dnscontrol_${DNSCONTROL_VERSION}_linux_amd64.tar.gz"
curl -sfL "$base/$tar" -o "$tmp/$tar"
curl -sfL "$base/checksums.txt" -o "$tmp/checksums.txt"
(cd "$tmp" && grep " $tar\$" checksums.txt | sha256sum -c -)
tar -xzf "$tmp/$tar" -C "$tmp" dnscontrol
install -m 0755 "$tmp/dnscontrol" "$bin"
rm -rf "$tmp"
fi
"$bin" version
echo "DNSCONTROL=$bin" >> "$GITHUB_ENV"
- name: check
working-directory: checkout/dns
run: $DNSCONTROL check
- name: preview
working-directory: checkout/dns
run: $DNSCONTROL preview
- name: push
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
working-directory: checkout/dns
run: $DNSCONTROL push
+13 -2
View File
@@ -5,6 +5,16 @@ The zone is `dnsconfig.js`, applied to Cloudflare with
the file with the live zone, so it can be run by anyone with the token, the file with the live zone, so it can be run by anyone with the token,
from any machine. from any machine.
## 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
```sh ```sh
paru -S dnscontrol paru -S dnscontrol
cd dns cd dns
@@ -48,8 +58,9 @@ Nothing about Zoho's MX should appear.
1. On kasse, `kasse-dkim-tomtervel.sh` makes the vel's signing key and 1. On kasse, `kasse-dkim-tomtervel.sh` makes the vel's signing key and
prints its public half. Put it in `KASSE_DKIM`. prints its public half. Put it in `KASSE_DKIM`.
2. `dnscontrol push`. The apex leaves the old website at this moment. 2. Actions -> dns -> Run workflow on main (or `dnscontrol push`). The apex
3. `.env` here: `PORTAL_HOST=tomtervel.no`, `ID_HOST=id.tomtervel.no`, leaves the old website at this moment.
3. A commit to `.env`: `PORTAL_HOST=tomtervel.no`, `ID_HOST=id.tomtervel.no`,
`CHAT_HOST=chat.tomtervel.no`, and the Caddy blocks in `CHAT_HOST=chat.tomtervel.no`, and the Caddy blocks in
`host-caddy/` on kasse; Kanidm's domain is renamed before anyone `host-caddy/` on kasse; Kanidm's domain is renamed before anyone
but the first person has a passkey. but the first person has a passkey.