Drop the nightly rebuild timer.
The timer was load-bearing while the mint list was a build-time snapshot: a
rebuild was the only way a new mint, a new review count or a changed status ever
reached /mints. The list hydrates now, so all three arrive within a second of
load, in every language, and rebuilding 2,000 pages at 03:30 to refresh numbers
that refresh themselves is twenty minutes of CPU for nothing.
cashumints-web.service stays exactly as it is — it is the deploy-time publish
step, and now the only thing that starts it is a deploy. A build still produces
what only a build can: the prerendered HTML a crawler reads, a social card per
mint, the sitemap and hreflang set, and a /mint/{host} page for every mint known
at build time.
The one thing that gets staler is that last item. A mint indexed since the last
deploy has no prerendered page: /mint/newhost is a 404, whose resolver looks the
address up against the live API and renders it — readable, reviewable, noindex
until a deploy gives it a real page. That was already true between nightly
builds; this only lengthens the window.
README documents the one-time host commands to remove the installed timer, and
gains a "Live lists" section describing what replaced it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
14548179a0
commit
24fe2003b6
@@ -6,12 +6,23 @@
|
||||
# a social card per mint and prerenders every page from the live API. The daemon that
|
||||
# hands the result out is cashumints-site.service.
|
||||
#
|
||||
# Run it after a deploy:
|
||||
# Run it after a deploy, and only after a deploy:
|
||||
# sudo systemctl start cashumints-web
|
||||
#
|
||||
# Mint pages are prerendered, so new mints and new review counts only appear at the
|
||||
# next build; pair this with a .timer for the nightly rebuild. There is deliberately no
|
||||
# [Install] section — a rebuild should be scheduled, not fired on every boot.
|
||||
# There used to be a cashumints-web.timer firing this at 03:30 every night, because the
|
||||
# mint list was a snapshot of whatever the API held when the build ran and a nightly
|
||||
# rebuild was the only way it ever changed. The list hydrates from the API after paint
|
||||
# now, so a new mint, a new review count and a changed status all reach the page within
|
||||
# a second of load, and rebuilding 2,000 pages at 03:30 to refresh numbers that refresh
|
||||
# themselves is 20 minutes of CPU for nothing.
|
||||
#
|
||||
# What a build still produces, and therefore what a deploy is still for: the prerendered
|
||||
# HTML a crawler reads, the social card per mint, the sitemap, and a `/mint/{host}` page
|
||||
# for every mint known at build time. A mint indexed since the last deploy has no page of
|
||||
# its own until the next one; the 404 fallback resolves it against the live API, so it is
|
||||
# readable and reviewable in the meantime. That was already true between nightly builds.
|
||||
#
|
||||
# There is deliberately no [Install] section — this belongs to a deploy, not to a boot.
|
||||
|
||||
[Unit]
|
||||
Description=Rebuild the cashumints.space static site
|
||||
@@ -93,10 +104,11 @@ ExecStart=/usr/bin/pnpm build
|
||||
# Publish, as a separate step from building.
|
||||
#
|
||||
# `astro build` empties dist before it writes, so the site server cannot read dist
|
||||
# directly — a nightly rebuild would be a nightly minute of 404s. It serves this copy
|
||||
# instead, and the copy is only touched once a build has succeeded: a failed build
|
||||
# leaves the previous site up rather than replacing it with a half-written one, which is
|
||||
# the same reason Requires=cashumints.service is above.
|
||||
# directly — a rebuild would be a minute of 404s. It serves this copy instead, and the
|
||||
# copy is only touched once a build has succeeded: a failed build leaves the previous
|
||||
# site up rather than replacing it with a half-written one, which is the same reason
|
||||
# Requires=cashumints.service is above and the same reason the mint-count gate is an
|
||||
# ExecStartPre rather than a check after the fact.
|
||||
#
|
||||
# --delay-updates stages the changed files and renames them in at the end, so the window
|
||||
# where the tree is a mix of two builds is a rename rather than a whole transfer, and
|
||||
@@ -107,7 +119,7 @@ ExecStartPost=/usr/bin/rsync -a --delete-after --delay-updates web/dist/ /var/li
|
||||
# ~200 prerendered pages plus a card per mint. Minutes, not seconds, on a small VPS, and
|
||||
# TimeoutStartSec is what bounds a Type=oneshot.
|
||||
TimeoutStartSec=1800
|
||||
# A nightly rebuild should not starve the API it is reading from.
|
||||
# A build should not starve the API it is reading from.
|
||||
Nice=10
|
||||
|
||||
# The site server runs as cashumints and reads its own files, so this no longer has to
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# /etc/systemd/system/cashumints-web.timer
|
||||
#
|
||||
# The nightly rebuild. Mint pages are prerendered, so a new mint or a new review count
|
||||
# appears at the next build; between builds the site stays correct because the islands
|
||||
# refresh status and reviews at runtime, and a mint indexed since the last build still
|
||||
# resolves through the client-side fallback on the 404 page.
|
||||
#
|
||||
# sudo systemctl enable --now cashumints-web.timer
|
||||
#
|
||||
# The service it starts builds first and publishes second, so a failed build leaves the
|
||||
# running site untouched rather than replacing it with a half-written one.
|
||||
|
||||
[Unit]
|
||||
Description=Nightly cashumints.space rebuild
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*-*-* 03:30:00
|
||||
# Run it on the next boot if the machine was off at 03:30, rather than skipping a day.
|
||||
Persistent=true
|
||||
# Without this every host rebuilds on the same second. Harmless with one VPS; free
|
||||
# insurance if there is ever a second.
|
||||
RandomizedDelaySec=15m
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
Reference in New Issue
Block a user