Bootstrap
Complete the initial setup session to configure the license, identity provider, and first administrator after the first installation.
After ./install.sh install finishes, open the bootstrap URL in a browser and
work through the seven-screen wizard. This page covers everything you need to
complete that session successfully.
For the package download and installer flags, see Getting Started.
For .env and secret handling, see Secrets and .env.
Prerequisites
Section titled “Prerequisites”Collect the following before you begin.
| Item | Where to find it |
|---|---|
| Bootstrap token | AIG_BOOTSTRAP_TOKEN in aig/current/.env. Run grep AIG_BOOTSTRAP_TOKEN .env from aig/current. |
| License file | The AI Gateway license file (a PEM certificate starting with -----BEGIN CERTIFICATE-----). Issuing a license requires this installation’s Installation ID, which the wizard shows at step 2. If you do not have the license yet, enter the token and find the Installation ID at step 2. For details, contact QueryPie support (ab@querypie.com). The Installation ID does not change when the session ends. |
| IdP application values | Okta: issuer URL, client ID, client secret, client authentication method. Google Workspace: client ID, client secret. Keycloak: issuer URL, client ID, client secret. See the provider pages under IdP app registration below. |
| First administrator email | The email address of an account in the IdP. The first login must be made with this account. |
| Organization name | 1–128 characters. |
If you do not finish within 30 minutes of entering the token, or make no input for 15 minutes, the wizard returns to step 1.
IdP app registration
Section titled “IdP app registration”For Google Workspace, Okta, and Keycloak, AI Gateway uses the OIDC Authorization Code flow with a client secret. PKCE and refresh tokens are not used. Register a web application in your identity provider before starting the wizard.
For Active Directory or OpenLDAP password sign-in, follow LDAP integration. LDAP uses directory settings instead of an OIDC application; the redirect URI and scopes below apply only to OIDC.
The redirect URI and login start URL depend on your hostname:
| Setting | Value |
|---|---|
| Redirect URI | https://<hostname>/api/auth/oidc/callback. If the load-balancer HTTPS port is not 443, use https://<hostname>:<port>/api/auth/oidc/callback. For a localhost installation, use http://localhost/api/auth/oidc/callback (or http://localhost:<port>/api/auth/oidc/callback if AIG_HTTP_PORT is not 80). The installer prints this value as IdP redirect URI at the end of installation. |
| Scopes | openid email profile |
| Login start URL | https://<hostname>/api/auth/oidc/login (used when launching the application from the IdP portal). For a localhost installation: http://localhost/api/auth/oidc/login, plus :<AIG_HTTP_PORT> when the port is not 80 |
Two important network constraints apply:
- AI Gateway connects directly to the IdP without using any HTTP proxy environment variables. The host must have direct outbound HTTPS access to the IdP endpoint.
- AI Gateway also connects to an IdP on a private IP address, but never to cloud
metadata addresses (
169.254.0.0/16,fd00:ec2::254). It trusts only certificates issued by CAs in the system trust store, so for a Keycloak that uses an internal CA, see Internal CA certificate for Keycloak.
Follow the page for your provider to register the application.
- Google Workspace integration
- Okta integration
- Keycloak integration
- LDAP integration (Active Directory / OpenLDAP)
Bootstrap flow
Section titled “Bootstrap flow”Open the bootstrap URL that install.sh printed (the root of your hostname,
for example https://aig.example.com/). The browser redirects to the login
screen at /login.
| Step | Screen | Action |
|---|---|---|
| 1 | Sign in | Enter the value of AIG_BOOTSTRAP_TOKEN in Bootstrap token and click Next. |
| 2 | License | The screen shows this installation’s Installation ID at the top. Paste the full certificate including the -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- lines, or use Load file to load the .pem file. Click Validate license to see the license ID, owner, type, seat count, and validity period. Confirm the details and click Next. |
| 3 | Identity provider | Select Google Workspace, Okta, Keycloak, or LDAP. For OIDC, enter the application values and confirm the Callback URL matches the registered redirect URI. For LDAP, enter the directory settings. Add CA certificate (PEM) for an internal CA, then click Next. |
| 4 | Administrator email | Enter the first administrator email address. |
| 5 | Organization name | Enter the organization name (1–128 characters). |
| 6 | Review your settings | Review all values. Click Create organization to commit. |
| 7 | First administrator login | Sign in through SSO, or enter the directory login ID and password for LDAP. A successful first administrator login opens /admin and completes installation. |
Behaviour differences between providers
Section titled “Behaviour differences between providers”-
LDAP validates settings without contacting the directory at step 3. Connection, service credentials, user password, and access-group membership are checked at step 7. See LDAP troubleshooting.
-
Okta and Keycloak validate the OIDC discovery document (
<issuer>/.well-known/openid-configuration) at step 3. If the issuer URL is malformed, or if the document’sissuerfield does not match the value you entered, the wizard shows an error immediately. If the IdP is merely unreachable, the wizard stores the value and continues; the connectivity problem only appears when SSO login is attempted at step 7. -
Google Workspace stores the values without validating them at step 3. Any misconfiguration (wrong client ID, wrong client secret) is only discovered when the SSO login is attempted at step 7.
Other things to know
Section titled “Other things to know”- Every setup step shows the installed version (for example Version 2026.10.15.2) below the form. It is the
VERSIONin.env, hotfix number included; quote it when you contact support. - The license is re-validated at step 6 when you click Create organization. If the license has expired or is otherwise invalid, nothing is saved.
- Before step 6, clicking End setup session or letting the session time out discards every value you entered. Restart from step 1.
- No user account is created until step 7 completes. Step 6 commits the organization and IdP settings, so if you close the browser or the session ends after it, the first administrator can still complete step 7 later by signing in at
/login. From then on the bootstrap token no longer opens the wizard.
Troubleshooting
Section titled “Troubleshooting”Error table
Section titled “Error table”| Symptom | Cause and action |
|---|---|
| “The token could not be verified” at step 1 | Copy AIG_BOOTSTRAP_TOKEN from .env without leading or trailing whitespace. Run grep AIG_BOOTSTRAP_TOKEN aig/current/.env to print the exact value. |
| “Your setup session expired” | A session ends 30 minutes after it starts, or after 15 minutes without input. Enter the token again and re-enter every value from step 1. |
License: malformed (malformed) | The pasted text is not a valid PEM certificate. Check for truncation or extra whitespace, then paste again. |
License: untrusted key or signature invalid (untrusted_key, signature_invalid) | The certificate was not issued for AI Gateway, or the content has been altered. Request a new license from QueryPie support. |
License: unsupported format or missing fields (unsupported_schema, invalid_claims) | The license format is not compatible with this version of AI Gateway. Report your version to QueryPie support and request a new license. |
License: not yet valid or expired (not_yet_valid, expired) | Check the validity period shown on the verify screen. Request a new license if the current one cannot cover the installation date. |
License: belongs to another installation (installation_binding_mismatch) | The license was issued for another installation’s ID. Send the Installation ID shown at step 2 to QueryPie support and request a reissued license. |
| Issuer URL rejected at step 3 | Confirm the URL starts with https://. Confirm the OIDC discovery document at <issuer>/.well-known/openid-configuration has an issuer field equal to the URL you entered. |
| “The CA certificate is not valid PEM” at step 3 | Put only certificate blocks that start with -----BEGIN CERTIFICATE----- into CA certificate (PEM). A private key or any other text is rejected. |
| Step 7 sign-in fails with an internal Keycloak | If the Keycloak certificate comes from an internal CA or is self-signed, check that CA certificate (PEM) contains that CA (or the certificate) and that the certificate’s host name matches the issuer URL. You can correct the CA certificate in recovery mode. |
| “Your account is not authorized to access AI Gateway” at step 7 | You signed in with a different account than the one entered at step 4, or the IdP configuration is wrong. Run the command below to read the failure_reason field from the server log. email_mismatch means the signed-in email does not match the first administrator email from step 4; sign in again with the correct account. |
| “No AI Gateway role is assigned to your account” at step 7 | Keycloak only. The first administrator has no role of the AI Gateway client, and the server log shows failure_reason client_role_missing. Grant the role as described in Keycloak integration, then sign in again. |
| Login blocked on the Okta sign-in screen | The account is not assigned to the AI Gateway application, or the application’s sign-in policy requires an authenticator the account cannot satisfy. Find the specific reason in Reports → System Log (Okta: System Log). |
To inspect the first administrator finalization log:
cd aig/currentdocker compose logs server | grep first_admin_finalizationChanging the bootstrap token
Section titled “Changing the bootstrap token”Edit AIG_BOOTSTRAP_TOKEN in .env, then recreate the server container.
A plain restart does not re-read .env:
cd aig/currentdocker compose up -dThe new token takes effect immediately. Any in-progress setup session and all values entered in it are discarded.
Forced recovery after organization creation
Section titled “Forced recovery after organization creation”Once step 6 completes, the bootstrap wizard is closed. If the IdP values are wrong and nobody can sign in, use recovery mode to reopen it.
Recovery mode prevents all logins, including administrator logins, and keeps the first administrator login at step 7 from completing. Disable it as soon as you finish correcting the values.
-
Start recovery mode from
aig/current:Terminal window cd aig/current./install.sh recover -
Open
https://<hostname>/loginin a signed-out browser and enter the bootstrap token. The changes you can make depend on your current state:State What can be changed Before the first administrator login (step 7 not yet completed) IdP settings and the first administrator email. The license and organization name are fixed. After the first administrator login Only the client ID, client secret, (for Okta) the client authentication method, and (for Keycloak) the CA certificate. The provider type and issuer cannot be changed. This recovery session does not grant access to any other administration screen. If you enter the token in a browser that is signed in as an administrator, no recovery session is created and you are directed to the Auth providers screen of the administration console instead. If you can sign in, make the correction there without using recovery mode.
-
After correcting the values, disable recovery mode:
Terminal window ./install.sh recover --doneIf you completed recovery before the first administrator login, proceed to step 7 in the bootstrap wizard after running
--done.Forgetting to run
--doneis safe: the nextdocker compose up -dor./install.sh upgraderestarts the server in normal mode automatically. Do not addAIG_FORCE_ENABLE_BOOTSTRAPdirectly to.env; doing so keeps recovery mode permanently on.
If the provider type or issuer is wrong and the first administrator has already signed in, the values cannot be changed from any screen. Contact support.
Starting over
Section titled “Starting over”If the installation is fresh and there is no data to preserve, you can reset completely. This destroys all database and Redis data.
cd aig/currentdocker compose down -v./install.sh install --hostname <hostname>If you use an external PostgreSQL or Redis, docker compose down -v does not
delete that data. Re-create the external database as an empty database and flush
the external Redis before running ./install.sh install. The .env file is
preserved, so the bootstrap token and connection settings remain unchanged.
After installation
Section titled “After installation”Changes to the authentication provider and license are made from the
Organization menu in the administration console at /admin.
| Menu | What can be changed |
|---|---|
| Auth providers | Open Replace provider credentials and re-enter the client ID and client secret. For Okta, you can also change the client authentication method. For Keycloak, you can change the CA certificate (PEM) (re-enter the client secret even when you change only this). The provider type and issuer cannot be changed after setup. |
| License | Install a new license to renew or increase seats. Paste the certificate, preview the details, and confirm. A license with fewer seats, fewer features, or an earlier expiration date than a license already installed for the same term is rejected. A license issued under a new term is not subject to this check. |
AI Gateway does not connect to Keycloak when you save the CA certificate. If you saved a wrong CA certificate and no one can sign in, fix it with Forced recovery after organization creation.
Any user who signs in through the IdP is added automatically as a member with no permissions. An administrator must assign roles after the account is created.
After sign-in, the installed version (for example Version 2026.10.15.2) is the
last line of the Account menu under your name at the top right of every screen.
It is the VERSION in .env, hotfix number included.
License grace period
Section titled “License grace period”- Commercial license — a 30-day grace period applies after expiration. Install the new license before it expires to avoid service interruption.
- PoC license — no grace period. Restrictions apply immediately on expiration.
Install the replacement license before expiration in both cases.