Skip to content

Adding export, Adding hooks for automated installation#36

Open
jeremyd wants to merge 2 commits into
fiatjaf:masterfrom
relaytools:master
Open

Adding export, Adding hooks for automated installation#36
jeremyd wants to merge 2 commits into
fiatjaf:masterfrom
relaytools:master

Conversation

@jeremyd

@jeremyd jeremyd commented Jul 5, 2026

Copy link
Copy Markdown

It ain't much, but it's honest work

jeremyd added 2 commits July 4, 2026 21:20
loadUserSettings returns early when settings.json doesn't exist yet and
never built the KindIsAllowed function, so the first event to arrive
before setup completed segfaulted the relay in basicRejectionLogic.
Non-interactive first-run setup for container/orchestrator deploys,
driven by environment variables instead of the /setup/domain and
/setup/root web pages. bootstrapFromEnv only acts when
PYRAMID_ROOT_PUBKEY is set and the relay has no root users yet, so it is
a no-op for interactively-configured relays and for anyone not using the
env vars; it seeds domain, root and service members. applyPlatformEnvOverrides
re-applies operator settings on every boot: the per-IP filter cost, and the
host domain from PYRAMID_DOMAIN (so a restored settings.json can never leave
the relay on the wrong domain and break login). The Dockerfile takes a
VERSION build-arg for builds from trees without .git and installs curl.

Full relay backup: GET /export streams a .tar.gz of every event layer as
<name>.jsonl (excluding the re-derivable sdk cache and the legacy groups
layer, whose events already live in main) plus settings.json, the
membership log, grasp git repositories and (unless ?blossom=0) blossom
media. Gated by an operator token (X-Export-Token, a 0600 file next to the
data) or a logged-in root session; the token is generated at startup. A
"download backup" button in the settings UI exposes it.

Relay restore: the relay BECOMES the backup. POST /restore (or the settings
UI button) validates and stages the upload at <data>/.restore.tar.gz — it is
NOT applied until a real, full process restart (the in-app restart button
does an in-process soft restart and will not apply it; docs and the response
say so). On that clean boot the relay adopts the backup wholesale — settings
incl. the internal signing key (so nip-29 groups keep their identity),
membership, events, media, repos — only the host domain still follows the
deployment. The import is synchronous: the relay is "down, restoring" until
it completes (mmm fsyncs per event; progress logged), idempotent so an
interrupted restore resumes, and a corrupt archive is quarantined to
.restore.failed so it can never brick the relay. docs/backup-restore.md
covers the whole thing incl. running behind a reverse proxy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant