the static git browser that builds this site
git clone https://git.lucas.co/gitsite.git
Version the systemd units that run the hourly publish
8a1dd9e added autodeploy.sh and the hourly auto-publish, but the two units
that actually run it stayed hand-written in ~/.config/systemd/user and were
tracked nowhere — so the repo held the script and not the thing that invokes
it. A fresh clone got no timer, silently: build.sh and deploy.sh still work by
hand, so nothing looks broken.
That matters more here than for a normal service. The repos this mirrors have
no push remotes, so committing locally is only "publishing" for as long as
gitsite.timer keeps firing. If it stops, local commits look published and
aren't.
Both files are byte-identical to the copies currently installed and running,
so this changes what is versioned, not what runs. readme.txt gains the install
step, since nothing here installs them — verified against the live state: the
recipe reproduces exactly what is on disk, and the timer is enabled with its
next run due on the hour.
Co-Authored-By: Claude Opus 5 <[email protected]>
gitsite.service | 8 ++++++++
gitsite.timer | 10 ++++++++++
readme.txt | 23 +++++++++++++++++++++++
3 files changed, 41 insertions(+)
diff --git a/gitsite.service b/gitsite.service
new file mode 100644
index 0000000..36e613c
--- /dev/null
+++ b/gitsite.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Publish git.lucas.co if repos changed
+
+[Service]
+Type=oneshot
+ExecStart=%h/Dropbox/src/gitsite/autodeploy.sh
+StandardOutput=append:%h/.cache/gitsite/autodeploy.log
+StandardError=append:%h/.cache/gitsite/autodeploy.log
diff --git a/gitsite.timer b/gitsite.timer
new file mode 100644
index 0000000..31b31d3
--- /dev/null
+++ b/gitsite.timer
@@ -0,0 +1,10 @@
+[Unit]
+Description=Hourly git.lucas.co publish
+
+[Timer]
+OnCalendar=hourly
+RandomizedDelaySec=5m
+Persistent=true
+
+[Install]
+WantedBy=timers.target
diff --git a/readme.txt b/readme.txt
index 0863fa3..ed99bad 100644
--- a/readme.txt
+++ b/readme.txt
@@ -13,6 +13,11 @@ repos.conf which repos to publish: name|path|description|mode
generate.py the HTML generator
build.sh syncs mirrors, runs generate.py, adds clone files
deploy.sh pushes the built site to Cloudflare Pages
+autodeploy.sh
+ build + deploy, but only when a listed repo's HEAD moved
+gitsite.service, gitsite.timer
+ systemd user units that run autodeploy.sh hourly — see
+ "Automatic publishing" below; nothing here installs them
style.css matches lucas.co (black, white, blue links, Circe)
Workflow
@@ -23,6 +28,24 @@ Workflow
Preview locally:
python3 -m http.server -d ~/.cache/gitsite/out 8931
+Automatic publishing
+--------------------
+gitsite.timer runs autodeploy.sh hourly (randomized up to 5m; Persistent
+so a run missed while the machine was off catches up), and autodeploy.sh
+rebuilds + deploys only when a repo in repos.conf has a new HEAD. That
+timer is what makes "committing locally IS publishing" true — the repos
+it mirrors have no push remotes, so if it stops running, nothing reaches
+git.lucas.co and the local commits look published but aren't.
+
+The units are NOT installed by any script here. On a new machine:
+
+ cp gitsite.service gitsite.timer ~/.config/systemd/user/
+ systemctl --user daemon-reload
+ systemctl --user enable --now gitsite.timer
+
+Check: systemctl --user list-timers gitsite.timer
+Log: ~/.cache/gitsite/autodeploy.log
+
One-time Cloudflare setup
-------------------------
1. npx wrangler login