Skip to content

Initial Setup & Admin Bootstrap 🟑 BETA

Create the first administrator through the directory service and verify that no unverified database row can grant admin access.

Admin guide Β· bootstrap runbook

When to use Before you start Steps Verify Roll back
First boot of a new deployment, lost admin access Vault unsealed, directory service ready Watch bootstrap, sign in, check identity One admin, real password check, stable JWT secret Restore directory config from backup

When to use

Use this runbook on a fresh installation and after a suspected loss of administrator access. It describes what the server creates at boot; it does not invent a bootstrap API.

Before you start

  • The directory service (Zitadel) owns users and passwords. The server checks a password through the directory v2 session API (or the documented development fallback with a matching password); it never trusts a bare crm_contacts row.
  • saas_jwt_secret is persisted into conf/system/directory_config.json by resolve_saas_jwt_secret. Once set, cloud tokens survive restarts; do not let the file lose it.
  • On the desktop edition the first-run wizard creates the administrator record (admin-credentials.json in the stack) and the directory admin is synced to it. No plain-text ~/.gb-setup-credentials is written.
  • GB_BOOTSTRAP_SECRET gates the bootstrap helper route in botcoredirectory (resend_2fa.rs); an unset variable means the route refuses.
  • Only VAULT_* variables belong in .env; the unseal key and token files live in /tmp.

Steps

# 1. Confirm the directory and Vault containers are up.
sudo incus list --format csv
sudo incus exec vault -- pgrep -a vault

# 2. Read only the Vault connection from the env file, then unseal if needed.
source <(grep -E '^VAULT_' "${WORKSPACE}/.env")
export VAULT_ADDR="$VAULT_ADDR"
export VAULT_CACERT="${WORKSPACE}/botserver-stack/conf/system/certificates/ca/ca.crt"
export VAULT_TOKEN=$(cat /tmp/vault-token-gb 2>/dev/null || echo "$VAULT_TOKEN")

# 3. Watch bootstrap finish; do not assume readiness from a listening port.
grep -E "Bootstrap process completed|ERROR|WARN" botserver.log | tail -30

# 4. Check health and sign in through the login surface only.
curl -s -o /dev/null -w '%{http_code}\n' http://localhost:8080/health

# 5. Confirm the persisted JWT secret exists before restarting anything.
sudo incus exec <container> -- grep -c saas_jwt_secret /opt/gbo/conf/system/directory_config.json

Sign in at the login surface (login.generalbots.org, served on port 5000). Port 4000 is the cloud and does not serve sign-in: /login and /signup there redirect to 5000. Change the administrator password through POST /api/auth/password (Settings β†’ Account); never place a password in a file in the repository.

Verify

Check Command / surface Pass condition
Bootstrap grep on botserver.log Bootstrap process completed! present
Health curl on /health 200
Admin identity sign-in on the login surface directory user signed in, not a raw DB row
Password POST /api/auth/password old password rejected, new accepted
Token stability directory_config.json saas_jwt_secret present across a restart
Secrets .env only VAULT_* variables

Roll back

πŸ”΄ Restore directory_config.json from a pre-change snapshot and re-run the table. If the administrator record was created wrongly, use the directory service's own recovery path rather than editing users or crm_contacts directly; record the event in incident response.