Previews: one name per branch under forhandsvisning.tomtervel.no
dns / dns (push) Successful in 6s

The content repo now runs one preview per branch, for five days after its
last push, behind its own router on 127.0.0.1:3066
(tomtervel/questions, .gitea/preview/). This is kasse's side of it:

- dns: *.forhandsvisning beside the bare name, both unproxied to kasse.
- host-caddy: the bare name and *.forhandsvisning go to 3066 instead of
  the single preview on 3065. A branch's name gets its certificate on
  demand, and only after the router says the branch has a preview, so
  made-up names cannot use up Let's Encrypt's limits. That needs the
  on_demand_tls ask option in kasse's global Caddyfile, described in the
  file. Also brings the file back in line with what kasse runs.
- README: the Previews section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
blandClaude Opus 5.5 committed 2026-11-10 08:58:30 +01:00
1 parent 100002baa2
commit 69489e7e42
3 files changed
+59 -19

No files matched your search

+25 -11
View File
@@ -162,18 +162,32 @@ On a new host:
Rauthy's mail leaves through kasse's postfix like gdo's, and Rauthy Rauthy's mail leaves through kasse's postfix like gdo's, and Rauthy
stops if it cannot reach it. stops if it cannot reach it.
## Preview ## Previews
`forhandsvisning.tomtervel.no` shows the content branch last pushed to Every content branch pushed to tomtervel/questions gets its own preview
tomtervel/questions, before it is merged. The content repo's before it is merged, on `https://<branch>.forhandsvisning.tomtervel.no`,
`lint-and-reload` workflow runs it after the lint passes: a container for five days after its last push; `forhandsvisning.tomtervel.no` lists
`tomtervel-preview` from this site's own image the ones there are. The content repo runs them
(`localhost/tomtervel-portal:<PORTAL_RELEASE>`), beside a throwaway NATS (`.gitea/preview/preview.sh`, from `lint-and-reload` once the lint
(`tomtervel-preview-nats`), on 127.0.0.1:3065. It has no gdo, so nothing passes): a container `tomtervel-preview-<branch>` from this site's own
mails anyone, and no sign-in, so desks stay shut and the public pages image (`localhost/tomtervel-portal:<PORTAL_RELEASE>`), beside a throwaway
show. A form sent on it lands in the throwaway NATS and nowhere else. NATS (`tomtervel-preview-nats`) where each branch has a `SITE_NAME` of its
The commit gets a "forhåndsvisning" status with the link, which a PR own, and a small Caddy, `tomtervel-preview-router` on 127.0.0.1:3066, that
shows among its checks. Main is never previewed: it is the site. picks the container by the name asked for. At most five run at once; the
one that expires first goes when a sixth arrives. The content repo's
`preview-cleanup` workflow removes them when they expire (hourly) and when
their branch is deleted.
A preview has no gdo, so nothing mails anyone, and no sign-in, so desks
stay shut and the public pages show. A form sent on it lands in the
throwaway NATS and nowhere else. The commit gets a "forhåndsvisning"
status with the link, which a PR shows among its checks. Main is never
previewed: it is the site.
On kasse this needs the DNS records in `dns/dnsconfig.js` (the bare name
and `*.forhandsvisning`), the two blocks in `host-caddy/tomtervel.no`, and
the `on_demand_tls` global option described there, in
`/etc/caddy/Caddyfile`.
## Backups ## Backups
+5 -1
View File
@@ -36,8 +36,12 @@ D("tomtervel.no", REG_NONE, DnsProvider(DSP_CLOUDFLARE),
// id on to konto (the login) and chat on to samtaler. // id on to konto (the login) and chat on to samtaler.
A("id", KASSE, CF_PROXY_OFF), A("id", KASSE, CF_PROXY_OFF),
A("chat", KASSE, CF_PROXY_OFF), A("chat", KASSE, CF_PROXY_OFF),
// The content repo's preview: a branch before it is merged. // The content repo's previews: the list of them, and one name per
// branch before it is merged (<branch>.forhandsvisning). Caddy gets a
// certificate for a branch's name the first time it is asked for, and
// only for a branch that has a preview (host-caddy/tomtervel.no).
A("forhandsvisning", KASSE, CF_PROXY_OFF), A("forhandsvisning", KASSE, CF_PROXY_OFF),
A("*.forhandsvisning", KASSE, CF_PROXY_OFF),
// The old website, kept for now so the move can be undone: what the // The old website, kept for now so the move can be undone: what the
// apex and web. pointed at before (Netlify, through Cloudflare). The // apex and web. pointed at before (Netlify, through Cloudflare). The
+29 -7
View File
@@ -33,13 +33,35 @@ konto.tomtervel.no {
reverse_proxy 127.0.0.1:8090 reverse_proxy 127.0.0.1:8090
} }
# The content repo's preview: the branch last pushed, on a portal of its # The content repo's previews (tomtervel/questions, .gitea/preview/): one
# own with a throwaway NATS, no mail and no sign-in (tomtervel/questions, # portal per branch on <branch>.forhandsvisning.tomtervel.no, for five days
# lint-and-reload.yml). Kept out of search engines. # after its last push, and the list of them on the bare name. Every name
# Port 3065: 3060 is gullberg.klingenbergbygg.no's, and podman's own # goes to the previews' own router on 3066, which picks the branch's
# published ports (3050, 3070, 8090) do not show in `ss`, so a port is # container by name. Kept out of search engines.
# chosen against this directory's upstreams as well. #
# A branch's name has no certificate until someone opens it: Caddy gets one
# on demand, and first asks the router whether that name has a preview, so
# made-up names cannot use up Let's Encrypt's limits. That needs this in the
# global options of /etc/caddy/Caddyfile (kasse's, shared with the other
# sites there; nothing else on kasse uses on-demand TLS):
#
# on_demand_tls {
# ask http://127.0.0.1:3066/ask
# }
#
# Port 3066: 3060 is gullberg.klingenbergbygg.no's, 3065 was the single
# preview before, and podman's own published ports (3050, 3065, 3066, 3070,
# 8090) do not show in `ss`, so a port is chosen against this directory's
# upstreams as well.
forhandsvisning.tomtervel.no { forhandsvisning.tomtervel.no {
header X-Robots-Tag "noindex, nofollow" header X-Robots-Tag "noindex, nofollow"
reverse_proxy 127.0.0.1:3065 reverse_proxy 127.0.0.1:3066
}
*.forhandsvisning.tomtervel.no {
tls {
on_demand
}
header X-Robots-Tag "noindex, nofollow"
reverse_proxy 127.0.0.1:3066
} }