[Feature] Allow declarative first-admin bootstrap via config/env (headless setup)

Open
#5,714 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python

Research direction

Start by grepping for DISABLE_SETUP_WIZARD to find where the setup-wizard flag is read and where the first admin is currently created, then look at the config.yml loader and the POST /api/users handler for the existing user-creation path. The issue names no files, so the first job is mapping env/config parsing to the admin-creation code and confirming how "no admin exists yet" can be checked. Done means the three proposed credentials (or a config.yml block) create an admin only on an empty database, fail closed on partial configuration, never log secrets, and are covered by tests for the idempotent and partial-config cases. Treat this as a design discussion first: comment on the issue to agree the config surface before writing code.

Written by the indexing model from the issue text.

Description

Is your feature request related to a problem? Please describe.

Automated/deployment-code RomM setups cannot create the first Admin without a UI click. On an empty database, RomM redirects every page to the Setup Wizard; the docs state the resulting account "is always an Admin, regardless of any env var". DISABLE_SETUP_WIZARD=true skips the wizard for automation, but the operator is then told to "create the first admin via the API or by injecting a database row at deploy time". The API route needs a running, reachable, authenticated-enough instance and a post-start orchestration step; the DB-row path is unsupported and brittle. There is no environment variable or config.yml key for the initial admin.

Describe the solution you'd like

An optional, idempotent declarative first-admin bootstrap, e.g.:

  • ROMM_INITIAL_ADMIN_USERNAME
  • ROMM_INITIAL_ADMIN_EMAIL
  • ROMM_INITIAL_ADMIN_PASSWORD_FILE (path to a file; never a literal secret in env/config/logs)

or an equivalent block in config.yml. Semantics: create the Admin only when no admin exists (no-op otherwise); fail closed on partial configuration; never log or echo values; remain compatible with OIDC-only setups. This would let GitOps/host-config workflows provision RomM fully from code, including the first login.

Describe alternatives you've considered

  1. POST /api/users after startup — works in principle (POST /api/users, body username, email, password, role: admin), but requires a post-start script, a reachable URL, and assumptions about auth/CSRF that are not documented.
  2. Injecting a row into MariaDB at deploy time — explicitly mentioned in the docs but unsupported and fragile.
  3. OIDC auto-provisioning — documented (OIDC_ALLOW_REGISTRATION, OIDC_ROLE_ADMIN), but still requires a login event and does not cover non-OIDC deployments.
  4. Keeping the Setup Wizard — fine interactively, blocks unattended provisioning.

Additional context

  • RomM 5.4.0 docs — Invitations & Registration: https://docs.romm.app/5.4.0/administration/invitations-and-registration/ ("The resulting account is always an Admin, regardless of any env var." / "To skip the wizard (e.g. when provisioning via automation and you'll create users through the API), set: DISABLE_SETUP_WIZARD=true" / "You'll then need to create the first admin via the API or by injecting a database row at deploy time, because the UI won't offer a setup flow.")
  • RomM 5.4.0 env vars: https://docs.romm.app/5.4.0/reference/environment-variables/ — no initial-admin credential key exists.
  • OpenAPI (public spec): GET /openapi.json, POST /api/users requires username, email, password, role; Role enum user|admin.
  • PR https://github.com/rommapp/romm/pull/2495 added DISABLE_SETUP_WIZARD (merged; intended mainly for OIDC setups).
  • Issue https://github.com/rommapp/romm/issues/2346 discusses initial-admin creation under OIDC.
  • Duplicate search performed 2026-11-20 for "initial admin bootstrap config file", "DISABLE_SETUP_WIZARD", "first admin env variable", "headless setup", "initial admin creation": no open duplicate found (search results: #5465 closed bug, #2673 closed OIDC scope, #2346 closed OIDC RBAC).
Dominant language
Python
Stars
13.3k
Forks
747
Avg merge
20h 58m
Merged PRs (30d)
207

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rommapp/romm

All issues in rommapp/romm

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.