fix(selfhost): recover and self-serve instance admin access - #226
Merged
Conversation
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.
Deploying openpost-docs with
|
| 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 |
Deploying openpost-marketing with
|
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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"):
Recovery command —
openpost 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 existingrotate-encryption-keymaintenance-command pattern, is idempotent, reports the resulting admin count, and errors clearly when no account matches the email.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
OPENPOST_DISABLE_REGISTRATIONS=true); second registrant is not admin;grant-adminpromoted a non-admin account and reportedadmin_countcorrectly; unknown email fails with a clear message.go test -tags dev ./cmd/openpostpasses;go vetclean.svelte-check0 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.