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 <noreply@anthropic.com>
This commit is contained in:
Executable
+24
@@ -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)"
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user