Files
loki/scripts/db/dump.sh
CatoandClaude Fable 5.1 95c40a9cd8 refactor: rename the product from FleetCrown to Loki (#695)
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>
2026-09-13 16:13:10 -07:00

31 lines
837 B
Bash
Executable File

#!/usr/bin/env bash
# Logical backup of the Loki database (portable across Postgres hosts).
#
# Usage:
# DATABASE_URL=postgresql://... ./scripts/db/dump.sh [output.sql.gz]
#
# Defaults DATABASE_URL from .env.local when unset (direct URL preferred).
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
if [ -z "${DATABASE_URL:-}" ] && [ -f "$ROOT/.env.local" ]; then
set -a
# shellcheck source=/dev/null
source "$ROOT/.env.local"
set +a
fi
URL="${DATABASE_URL:-}"
if [ -z "$URL" ]; then
echo "ERROR: set DATABASE_URL (direct connection) before running." >&2
exit 2
fi
OUT="${1:-$ROOT/backups/cockpit-$(date +%Y%m%d-%H%M%S).sql.gz}"
mkdir -p "$(dirname "$OUT")"
echo "Dumping to $OUT ..."
pg_dump "$URL" --no-owner --no-acl --format=plain | gzip > "$OUT"
echo "Done ($(du -h "$OUT" | cut -f1))"