From b31ea9fc82ad4d7aecaea44036439a25d3c5bb42 Mon Sep 17 00:00:00 2001 From: Wesley Ray Date: Wed, 15 Jul 2026 15:51:42 -0400 Subject: [PATCH] Production cutover: rename container to garden, add auto-rebuild timer - deploy/auto-build.sh: git pull + rebuild only when the repo HEAD or any vault file mtime changed (sha256 signature in .build_state); replaces the Quartz update_quartz_docker.sh loop - systemd user units (5-min cadence, matching the old Quartz timer) - compose service/container renamed garden-next -> garden Co-Authored-By: Claude Opus 4.8 --- .gitignore | 1 + README.md | 2 +- deploy/auto-build.sh | 24 ++++++++++++++++++++++++ deploy/docker-compose.yml | 4 ++-- deploy/garden-astro-build.service | 6 ++++++ deploy/garden-astro-build.timer | 9 +++++++++ 6 files changed, 43 insertions(+), 3 deletions(-) create mode 100755 deploy/auto-build.sh create mode 100644 deploy/garden-astro-build.service create mode 100644 deploy/garden-astro-build.timer diff --git a/.gitignore b/.gitignore index de0cb95..3d43d68 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules/ dist/ .astro/ public/assets/ +.build_state diff --git a/README.md b/README.md index b60c639..fba851c 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ GARDEN_CONTENT=/path/to/vault/Digital_Garden npm run build Defaults to the kotov vault copy. On cyrion use `deploy/build.sh` (containerized node:24, vault mounted read-only), then `docker compose -f deploy/docker-compose.yml up -d` serves `dist/` on -port 18100 (`garden-next.c0smere.net` while staging). +port 18100, proxied as `garden.c0smere.net` (NPM public + Caddy internal). ## Layout extras diff --git a/deploy/auto-build.sh b/deploy/auto-build.sh new file mode 100755 index 0000000..bae61f8 --- /dev/null +++ b/deploy/auto-build.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# Timer target: rebuild the garden only when the vault or repo changed. +# Successor to the Quartz update_quartz_docker.sh change-detection loop. +set -eu + +REPO=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +VAULT="${VAULT:-/home/nox/docker/obsidian/vaults/weeslahw_coppermind}" +STATE="$REPO/.build_state" + +cd "$REPO" +git pull -q + +sig=$({ + git rev-parse HEAD + find "$VAULT" -name .obsidian -prune -o -type f -printf '%T@ %p\n' | sort +} | sha256sum | cut -d' ' -f1) + +if [ -f "$STATE" ] && [ "$(cat "$STATE")" = "$sig" ]; then + exit 0 +fi + +sh "$REPO/deploy/build.sh" +printf %s "$sig" >"$STATE" +echo "garden rebuilt $(date -Is)" diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml index fcfd34b..6e0a9bc 100644 --- a/deploy/docker-compose.yml +++ b/deploy/docker-compose.yml @@ -1,8 +1,8 @@ # Serves the prebuilt dist/ — run deploy/build.sh first. services: - garden-next: + garden: image: nginx:alpine - container_name: garden-next + container_name: garden restart: unless-stopped ports: - "18100:80" diff --git a/deploy/garden-astro-build.service b/deploy/garden-astro-build.service new file mode 100644 index 0000000..0bbf85c --- /dev/null +++ b/deploy/garden-astro-build.service @@ -0,0 +1,6 @@ +[Unit] +Description=Rebuild Astro garden when the vault or repo changed + +[Service] +Type=oneshot +ExecStart=/home/nox/docker/garden-astro/deploy/auto-build.sh diff --git a/deploy/garden-astro-build.timer b/deploy/garden-astro-build.timer new file mode 100644 index 0000000..266f240 --- /dev/null +++ b/deploy/garden-astro-build.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Periodic garden rebuild check (every 5 min, matches old Quartz cadence) + +[Timer] +OnCalendar=*:0/5 +Persistent=true + +[Install] +WantedBy=timers.target