Skip to main content
Available only for:
  • Self-hosted Bytebase version 3.22.0 and later
  • Shell access to the host, or kubectl access to the cluster, that runs Bytebase
When nobody can sign in, bytebase recovery restores password sign-in from the command line. It opens an interactive menu with two actions, Enable password sign-in and Reset user password, and changes the metadata database directly, so it works while the console is unreachable. Recovery requires downtime. If any Workspace Admin can still sign in, reset passwords, roles, and 2FA from the console instead.

Recovery actions and limits

Recovery can’t do the following:
  • Create or reactivate a user: the target must be an existing, active user. Service accounts and workload identities are rejected.
  • Change the role of a user who already has one: the command offers a role only when the user has no workspace role, whether direct, through a group, or through allUsers. If no active Workspace Admin is left and every user already has a role, recovery can’t restore administrator access.
  • Reset two-factor authentication: only another Workspace Admin can reset a user’s 2FA.
  • Bypass the workspace domain: when Members restriction is on, the user’s email must belong to an allowed workspace domain.
If none of the actions fits, contact us.

Run recovery

Stop every Bytebase server that uses the metadata database before you run recovery, and keep them stopped until the session exits. Running servers cache the settings, users, and roles that recovery changes.
Run bytebase recovery from an interactive terminal, with the same Bytebase version and the same metadata configuration as the stopped server. Recovery doesn’t migrate the metadata schema, so the version must match exactly: never use a floating image tag such as latest.
The commands assume the container is named bytebase. Substitute your own container name. Because the server container is stopped, recovery runs in a one-off container. Keep -it, because recovery only accepts input from a terminal.
  1. Check the version and the image before you stop the server:
    If the version is older than 3.22.0, stop here and upgrade first. Use the printed image ID as <image> in the next steps, so recovery and the restart run the exact image the server ran.
  2. Stop Bytebase:
  3. Back up the metadata: the data directory for embedded PostgreSQL, or the metadata database for external PostgreSQL.
  4. Run recovery with the same flags the server uses to reach its metadata. For embedded PostgreSQL, that is the data volume:
    If the server passes --data, mount that path instead and pass the same --data after recovery. For external PostgreSQL, that is PG_URL:
    Add every other flag the server needs to reach PostgreSQL: --network or --add-host, the --volume of a connection-string file or TLS certificate, and the credential variables for IAM authentication. If PG_URL is a file path, mount that file.
  5. After you exit the session, start Bytebase again on the same image. If your docker run command uses a floating tag or --pull always, replace the image name with <image> and drop --pull always, so the restart doesn’t upgrade Bytebase.

Use the recovery session

The session shows a menu until you enter q, so you can run several actions in a row. The example resets a password:
Each action applies immediately and changes only what it names: the sign-in setting, one user’s password, or one role. Exiting at the menu leaves nothing half-done.
  • Enable password sign-in: switches off Disallow signin with email & password. The menu lists it first, but when no administrator knows a password, reset one first.
  • Reset user password: enforces the workspace password restriction and clears the lockout from failed password attempts. It doesn’t change the user’s 2FA or SSO sign-in.

After recovery

  1. Open Bytebase and sign in with the email and password, then verify the account’s access.
  2. Repair and test the identity provider.
  3. Switch Disallow signin with email & password back on in Settings > General > Account if it was on before the outage.
  4. Review the recovery events in the audit log. Each action records a warning-level event whose method starts with /bytebase.cli.Recovery/.

Troubleshooting

Terminal required

Password entry must stay hidden, so recovery refuses piped or scripted input. In a container, add -it to docker run, kubectl run, or kubectl exec. On a host, run the command from an interactive shell, with ssh -t when you connect over SSH.

Data directory not accessible

The --data path doesn’t exist where recovery runs. With a binary, pass the same --data as the server, as an absolute path. With Docker, mount the data volume at that path.

Embedded metadata database not initialized

This error appears only when PG_URL isn’t set. The data directory exists, but it isn’t the one the server uses. With Docker, the volume isn’t mounted or the host path is wrong. With a binary, --data is missing or wrong. If the server uses external PostgreSQL, pass PG_URL instead.

Embedded metadata database not readable

Recovery runs as a different OS user than the server. Run it as the user that owns the data directory.

External metadata database not connected

This error appears only when PG_URL is set, and the text after the last colon names the cause. Recovery needs everything the server uses to reach PostgreSQL: the network (--network or --add-host with Docker), a mounted connection-string file when the cause is failed to read database URL from file, TLS files, or IAM credentials.

Unknown command

The image or binary is older than 3.22.0. Upgrade to 3.22.0 or later, start the server once so it migrates the metadata, then run recovery with the new version.

No usable workspace administrator

Enable password sign-in requires an active Workspace Admin user with a password, so that someone can sign in afterward. Run Reset user password for an administrator, then retry. If no active administrator is left, reset a user who has no workspace role and add that user as Workspace Admin. If every user already has a role, recovery can’t restore administrator access.