Files
bvandeusenandClaude Opus 5.5 e445c83e67
CI / lint (push) Successful in 2s
CI / integration (push) Successful in 1m28s
CI / unit (push) Successful in 1m37s
CI / publish (push) Successful in 1m17s
feat(backup): restore at first-run setup, restore --in-place, docs lead with the UI (#5818, #5819)
#5818 "First-run setup: Restore from a backup, by upload": beside creating
the first admin, setup offers "Or restore from a backup". Only while no
user exists; the upload is checked (a newer backup or one whose key can't
open its secrets is refused and not kept), then restored with no safety
backup (nothing to keep), and Steward restarts into the backup's users.

#5819 "Docs and CI": backups.md leads with restoring from Settings →
Backups and from setup; `steward restore --in-place` does the same-schema
restore from the shell, and CI's image check now uses it with a real
pg_restore: a changed setting comes back and the audit log stays.

Also exempts errors/restoring.html from the breadcrumb guard, as with
the other whole-app error pages: it replaces every page while a restore
runs, so there is nowhere to trail back to.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 11:05:39 -04:00

53 lines
2.8 KiB
HTML

{# auth/setup.html — first-run setup: create the first admin, or restore a
backup instead (#5818). Only shown while no user exists. #}
{% extends "base.html" %}
{% block title %}First-Run Setup — Steward{% endblock %}
{% block content %}
<div style="max-width:400px;margin:4rem auto;">
<div class="card">
<h2 class="page-title" style="margin-bottom:0.5rem;">First-Run Setup</h2>
<p style="margin-bottom:1.5rem;color:var(--text-muted);font-size:0.9rem;">Create the initial admin account.</p>
<form method="post" action="/setup">{{ csrf_field() }}
<div class="form-group">
<label>Username</label>
<input type="text" name="username" autofocus required>
</div>
<div class="form-group">
<label>Email</label>
<input type="email" name="email" required>
</div>
<div class="form-group">
<label>Password</label>
<input type="password" name="password" required>
</div>
<div class="form-group">
<label>Steward URL
<span style="color:var(--text-muted);font-weight:normal;font-size:0.78rem;">(how hosts & browsers reach this server)</span>
</label>
<input type="text" name="public_base_url" value="{{ default_url or '' }}"
placeholder="https://steward.example.com">
<span style="color:var(--text-muted);font-size:0.78rem;">
Used for agent installs, share links, and alert links. Pre-filled from your current
address — change it if hosts reach Steward by a different name. Editable later in Settings → General.
</span>
</div>
<button type="submit" class="btn">Create Admin Account</button>
</form>
</div>
{# Or come back from a backup (#5818): its users, settings and key. #}
<div class="card" style="margin-top:1.25rem;">
<h2 class="section-title" style="margin-bottom:0.5rem;">Or restore from a backup</h2>
<p class="field-hint" style="margin-bottom:1rem;">Moving Steward, or bringing it back? Upload a
<code>steward-&lt;time&gt;.tar</code> instead of creating an account: its users, settings, hosts,
monitors and key come back, and you sign in as one of its users.</p>
{% if restore_error %}<p class="tone-crit" style="margin-bottom:0.75rem;">{{ restore_error }}</p>{% endif %}
<form method="post" action="/setup/restore" enctype="multipart/form-data"
style="display:flex;gap:0.75rem;flex-wrap:wrap;align-items:center;">{{ csrf_field() }}
<input type="file" name="file" accept=".tar" required>
<button type="submit" class="btn btn-ghost">Restore</button>
</form>
</div>
</div>
{% endblock %}