Files
railiance-cluster/bin/railiance
tegwick 4381a079a2 feat: backup + preflight commands, decisions log, gitignore update
- tools/cmd/railiance-backup: pg_dump + config snapshot, age-encrypted,
  uploaded to Nextcloud file drop via curl PUT. Daily cron target.
- tools/cmd/railiance-preflight: pre-migration safety gate — checks backup
  freshness, all repos clean/pushed, age key present.
- bin/railiance: added backup and preflight subcommands.
- DECISIONS.md: decision log (D1 ingress Nginx+Traefik, D2 Nextcloud backup).
- .gitignore: exclude *backup-dropoff-link* files (contain upload tokens).
- CLAUDE.md: state hub session protocol update.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-25 23:59:28 +01:00

63 lines
2.1 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# bin/railiance — thin dispatcher; subcommands live in tools/cmd/*
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
PATH="${ROOT}/tools/cmd:${PATH}"
usage() {
cat <<'EOF'
Usage: bin/railiance <command> [args]
Commands:
doctor Check workstation & provisioning toolchains
next Show canonical first-time sequence
plan-host Provider-neutral host specs & checklist
gen-ssh-key Generate SSH key and show public part
cloudinit Emit minimal cloud-init user-data
init-repo Idempotently furnish repo housekeeping
build-spore Build a distributable "Spore" bundle
seed-local Run the seed script on this machine
checklist Pre-VM checklist
backup Backup postgres + config to Nextcloud (age-encrypted)
preflight Pre-migration safety gate (must pass before cluster work)
help Show this help
EOF
}
cmd="${1:-help}"; shift || true
case "$cmd" in
help) usage ;;
doctor) exec railiance-doctor "$@" ;;
plan-host) exec railiance-plan-host "$@" ;;
gen-ssh-key)
if ! command -v ssh-keygen >/dev/null 2>&1; then echo "Missing: ssh-keygen" >&2; exit 1; fi
key="${HOME}/.ssh/id_ed25519"
[[ -f "$key" ]] || ssh-keygen -t ed25519 -N "" -f "$key"
echo "Public key:"; cat "${key}.pub"
;;
cloudinit) cat "$ROOT/cloudinit/user-data.yaml" ;;
init-repo) bash "$ROOT/tools/furnish_railiance_repo.sh" ;;
build-spore) bash "$ROOT/tools/build_spore.sh" ;;
seed-local) bash "$ROOT/tools/seed_node.sh" ;;
checklist)
cat <<'CK'
Rent-a-VM Checklist
-------------------
[ ] Provider account ready (billing set)
[ ] Region chosen (low latency to you/users)
[ ] Image: Ubuntu 24.04 LTS
[ ] Size: 2 vCPU / 48 GB RAM / 60+ GB SSD
[ ] SSH key uploaded (see gen-ssh-key)
[ ] Cloud-init pasted (see: bin/railiance cloudinit)
[ ] Hostname set (e.g., railiance-seed-1)
[ ] Record public IP / DNS
CK
;;
next) cat "$ROOT/QUICKSTART.md" ;;
backup) exec railiance-backup "$@" ;;
preflight) exec railiance-preflight "$@" ;;
*) echo "Unknown command: $cmd" >&2; usage; exit 2 ;;
esac