Move the notes editor and job tracker to stppriv
Test and deploy / test (push) Successful in 31s
Test and deploy / deploy (push) Successful in 27s

The SilverBullet editor and the job tracker now run on their own LXC
(adamf/stppriv) at priv.<DOMAIN>, behind Cloudflare Access. Here:

- silverbullet and jobs services removed; /sb/, /jobs/ and the old
  /cv/jobs, /cv/leads and userscript URLs 301 to priv.<DOMAIN>
- silverbullet-git runs with SYNC_MODE=pull: stppriv is the vault's only
  writer. The backend's vault mount is read-only.
- jobs env vars, dev overrides and docs removed; edge_test.sh checks
  the new redirects

Merge only after stppriv serves /sb/ and /jobs/ and the jobs data has
been moved.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-26 13:53:48 +00:00
co-authored by Claude Opus 5.5
parent 65f2408ad4
commit 94a6abba97
12 changed files with 97 additions and 252 deletions
+21 -6
View File
@@ -1,17 +1,28 @@
#!/bin/sh
# Commits and syncs the vault. The "Sync notes" button (the vault's Sync.md)
# touches TRIGGER_FILE for an immediate sync; only its mtime matters, and it
# must never be deleted here or SilverBullet re-uploads it in a loop.
# Syncs the vault with the notes repo.
# SYNC_MODE=push (default): commit local edits, pull --rebase, push. Use on
# the ONE host that edits the vault (stppriv).
# SYNC_MODE=pull: fast-forward only, never commits or pushes. Use on every
# read-only consumer (stpweb's /notes/ and backend).
# The "Sync notes" button (the vault's Sync.md) touches TRIGGER_FILE for an
# immediate sync; only its mtime matters, and it must never be deleted here or
# SilverBullet re-uploads it in a loop.
set -u
SPACE=/space
MODE="${SYNC_MODE:-push}"
INTERVAL="${SYNC_INTERVAL:-300}"
TRIGGER_FILE="$SPACE/${SYNC_TRIGGER_FILE:-sync-request.md}"
POLL=2
log() { echo "[git-sync] $(date -Iseconds) $*"; }
case "$MODE" in
push|pull) ;;
*) log "ERROR: SYNC_MODE must be push or pull, got '$MODE'"; while true; do sleep 3600; done ;;
esac
git config --global --add safe.directory "$SPACE"
if [ ! -d "$SPACE/.git" ]; then
@@ -27,7 +38,7 @@ trigger_mtime() {
[ -f "$TRIGGER_FILE" ] && stat -c %Y "$TRIGGER_FILE" 2>/dev/null || echo ""
}
sync_once() {
sync_push() {
git add -A
if ! git diff --cached --quiet; then
if git commit -q -m "notes: $(date -Iseconds)"; then
@@ -43,11 +54,15 @@ sync_once() {
fi
}
sync_pull() {
git pull --ff-only -q || log "WARN: pull failed (diverged, auth or network)"
}
last_trigger=$(trigger_mtime)
log "watching $SPACE every ${INTERVAL}s (on-demand via ${TRIGGER_FILE#$SPACE/})"
log "mode=$MODE, watching $SPACE every ${INTERVAL}s (on-demand via ${TRIGGER_FILE#$SPACE/})"
while true; do
sync_once
if [ "$MODE" = push ]; then sync_push; else sync_pull; fi
# Sleep in short slices so an on-demand request is picked up quickly.
waited=0