mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 08:47:02 +01:00
The product, its assistant, the repo, the host and every unit on the box now share one name. 638 files, ~3,000 mentions: UI copy, config, env keys (FLEETCROWN_* -> LOKI_*), systemd units (fleetcrown-* -> loki-*), docs, articles, the deploy workflow other repos reuse, and nine file names. - Three article slugs carried the old name and had been shared; permanent redirects keep those links alive (next.config.ts). - test-no-retired-name.sh now also forbids the old product name across the whole repo, so the rename cannot creep back through templates and examples. - ASSISTANT_STACK collapses the product and the assistant into one entry, because they are now the same name. Infra was cut over ahead of this merge: /opt/loki, loki-* units, the `loki` database and role, loki.orangecat.ch (old host 308s to it; /api, /widget, /embed keep proxying), GitHub repos bitbaum/loki and bitbaum/loki-releases. The Resend sending domain stays fleetcrown.orangecat.ch until the new domain is verified in DNS. Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
56 lines
2.5 KiB
Bash
Executable File
56 lines
2.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# record-build-ref.sh — stamp the built artifact with the commit it was built from.
|
|
#
|
|
# WHY: until this existed, production could not say what it was running. The box
|
|
# keeps no deploy marker and /api/health reported `npm_package_version`, which is
|
|
# null under systemd. The only way to answer "is prod on main?" was to ssh in and
|
|
# grep the compiled bundle for a symbol you knew was in the new source.
|
|
#
|
|
# That gap is not cosmetic. A hand-run deploy ships whatever branch the worktree
|
|
# is on, and it has now rolled prod back three times (2026-08-14 being the third,
|
|
# with the off-main gate already in place — an ancestor of main passes it). Each
|
|
# time the symptom presented as an application bug, because nothing anywhere
|
|
# claimed a commit. See docs + `scripts/ci/check-deploy-ref.sh`.
|
|
#
|
|
# ONE writer, deliberately: this runs at BUILD time and writes into the build
|
|
# output, so the marker rides both deploy paths (local deploy-hetzner.sh and the
|
|
# GitHub Deploy workflow, which builds the same way then ships with --no-build).
|
|
# Writing it at deploy time instead would mean two writers of one fact.
|
|
#
|
|
# Best-effort by construction: an unknown commit must not fail a build. A missing
|
|
# marker degrades to `commit: null`, exactly the behaviour we had before.
|
|
|
|
set -uo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
OUT="$ROOT/.next/standalone/.build-ref"
|
|
|
|
# Precedence: the pinned ref a deploy asked for, then the CHECKED-OUT commit,
|
|
# and only then CI's env.
|
|
#
|
|
# LOKI_DEPLOY_REF first because deploy-hetzner.sh pins it and HEAD can
|
|
# drift mid-build. Git HEAD before GITHUB_SHA because HEAD is literally what was
|
|
# compiled: on the `workflow_run` path deploy.yml checks out
|
|
# `workflow_run.head_sha`, which is NOT always the `GITHUB_SHA` of the run.
|
|
# Trusting the env there would stamp a commit that was never built — a marker
|
|
# that lies is worse than no marker, since the deploy compares against it.
|
|
# GITHUB_SHA stays as the last resort for checkouts with no .git.
|
|
SHA="${LOKI_DEPLOY_REF:-}"
|
|
[ -z "$SHA" ] && SHA="$(git -C "$ROOT" rev-parse HEAD 2>/dev/null || echo "")"
|
|
[ -z "$SHA" ] && SHA="${GITHUB_SHA:-}"
|
|
|
|
if [ -z "$SHA" ]; then
|
|
echo " ⚠ build-ref not recorded — no LOKI_DEPLOY_REF, GITHUB_SHA, or git HEAD"
|
|
exit 0
|
|
fi
|
|
|
|
if [ ! -d "$ROOT/.next/standalone" ]; then
|
|
# Not a standalone build (e.g. a dev/analyze build). Nothing to stamp.
|
|
exit 0
|
|
fi
|
|
|
|
printf '%s\n' "$SHA" > "$OUT" 2>/dev/null \
|
|
|| { echo " ⚠ build-ref not written to $OUT"; exit 0; }
|
|
|
|
echo " ✓ build-ref ${SHA:0:12} recorded"
|