Skip to content

fix(selfhost): recover and self-serve instance admin access - #226

Merged
usehoplite[bot] merged 3 commits into
mainfrom
hoplite/aitna-cd371518
Sep 2, 2026
Merged

fix(selfhost): recover and self-serve instance admin access#226
usehoplite[bot] merged 3 commits into
mainfrom
hoplite/aitna-cd371518

Conversation

@usehoplite

@usehoplite usehoplite Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Two fixes for the self-hosted first-run experience reported in community feedback ("I'm not an admin on my own docker instance so I cannot add any media platform"):

  1. Recovery commandopenpost grant-admin --email <address> promotes one existing account to instance administrator. Operators who end up with no reachable admin (restored database volume whose first account predates the automatic first-admin bootstrap, lost first account, etc.) previously had no way back into instance settings short of raw SQL. It follows the existing rotate-encryption-key maintenance-command pattern, is idempotent, reports the resulting admin count, and errors clearly when no account matches the email.

  2. Admin-aware accounts page — on a fresh self-hosted instance every OAuth provider is unconfigured, and the accounts page showed "Ask admin" to the operator who is the administrator, which reads exactly like being locked out. When the viewer is the instance admin, gated providers now show a "Set up" action that routes to Settings → Instance configuration, and the "Admin setup required" section uses self-serve copy.

Investigation notes: the automatic first-admin bootstrap for every signup path (password, email verification, SSO JIT) has existed since 2026-05-03 and was verified working end-to-end on a fresh SQLite instance from current main; the published ghcr.io/getopenpost/openpost:latest (v4.17.1) contains it. The remaining experience gaps above are what this PR closes.

Changes

  • backend/cmd/openpost/admin_grant.go (new), main.go, process_role.go: grant-admin maintenance command and parsing.
  • backend/cmd/openpost/admin_grant_test.go, process_role_test.go: parsing and behavior tests.
  • frontend/src/lib/components/account-management.svelte: admin-aware provider setup actions and copy.
  • frontend/messages/*.json: two new messages across all ten locales.
  • docs-site/operations/troubleshooting.md: "No instance administrator" section with recovery steps.
  • changes/selfhost-admin-recovery.md: changelog fragment.

Verification

  • Backend: built from source and run end-to-end against SQLite — fresh instance promotes the first registrant to admin automatically (default, and with OPENPOST_DISABLE_REGISTRATIONS=true); second registrant is not admin; grant-admin promoted a non-admin account and reported admin_count correctly; unknown email fails with a clear message. go test -tags dev ./cmd/openpost passes; go vet clean.
  • Frontend: svelte-check 0 errors / 0 warnings; i18n catalogs match at 7843 messages per locale. The browser-mode vitest harness could not complete in this sandbox (vite optimizer hang, environmental); component tests should be judged by CI.

Screenshots

Not captured — no visual verification performed for this change (sandbox browser harness unavailable); the change is copy and action-routing behavior on the accounts page.

Open in Hoplite

usehoplite Bot added 2 commits September 2, 2026 08:14
Operators who end up with no instance administrator (for example after
restoring a database volume whose first account predated the automatic
first-admin bootstrap) had no way back into instance settings. Add a
bounded maintenance command that promotes one existing account and
document it in self-host troubleshooting.
On a fresh self-hosted instance every OAuth provider is unconfigured,
and the accounts page told the operator — who is the instance admin —
to ask their administrator. Use setup wording, keep the action
enabled, and route admins to instance configuration instead.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 2, 2026

Copy link
Copy Markdown

Deploying openpost-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 495b109
Status: ✅  Deploy successful!
Preview URL: https://401c5040.openpost-docs.pages.dev
Branch Preview URL: https://hoplite-aitna-cd371518.openpost-docs.pages.dev

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 2, 2026

Copy link
Copy Markdown

Deploying openpost-marketing with  Cloudflare Pages  Cloudflare Pages

Latest commit: 495b109
Status: ✅  Deploy successful!
Preview URL: https://3212dae4.openpost-marketing.pages.dev
Branch Preview URL: https://hoplite-aitna-cd371518.openpost-marketing.pages.dev

View logs

@usehoplite
usehoplite Bot merged commit 88887f5 into main Sep 2, 2026
22 checks passed
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.

0 participants