pip install at startup.
Before you start
- The App owner must be a Domino admin. The gateway reads organization memberships and role assignments with the owner’s credentials. With a non-admin owner, organization grants never match and admin detection fails.
- Use a dedicated Project, and restrict its Dataset to the admin owner. The Dataset holds the gateway database, the key that encrypts provider credentials, and any backups. Anyone with Dataset access can read them.
- Use a hardware tier with at least 2 CPU cores and 8 GB of RAM.
- Use a Compute Environment based on Ubuntu 22.04 or later. The binary needs glibc 2.35.
Deploy the App
1
Get and verify the release
Get the
llm-gateway-X.Y.Z-linux-x86_64.tar.gz release from your Domino field representative. Verify it against its .sha256 file with sha256sum -c.2
Unpack the release in the Project
Upload the tarball to the Project’s Files, then unpack it from a Workspace terminal:This creates
./llm-gateway-X.Y.Z/. Don’t rename the folder: app.sh finds it by name.3
Configure the App
In the Project’s App tab, configure the App:
4
Publish the App
Click Publish. The first line in the App log reads
[app.sh] launching binary: ./llm-gateway-X.Y.Z/llm-gateway.5
Complete first boot
Open the App URL as the owner. On first boot, the gateway creates its database and encryption key in the Project Dataset and adds the Domino Platform provider.
6
Add providers and aliases
Add providers and aliases from the UI, then grant access to them.
Upgrade
Unpack the new release next to the old folder, then restart the App.app.sh starts the newest version it finds. After you confirm the upgrade, delete the old folder. The database, encryption key, and scheduled Jobs live in the Dataset, so they carry over.
The first start after an upgrade can take longer than usual. The gateway applies schema changes before it serves requests, and some changes build indexes over the usage log. An index build takes about 3 seconds per million usage log rows on local disk, and longer on the Dataset mount. The App is unavailable until the changes finish, so if the usage log is large, restart during a quiet period.
Troubleshoot
Operate the gateway
The gateway Settings page holds 3 opt-in features that keep the gateway database small and recoverable: backups, log purge, and warehouse mirroring. Each runs as a Domino scheduled Job that calls back into the App.Use Postgres
By default the gateway keeps its store in a SQLite file in the Project Dataset. To keep it in a Postgres database instead, setLLM_GATEWAY_DATABASE_URL on the App. The gateway creates and migrates the schema on startup.
Switching starts an empty store. Providers, aliases, grants, guardrails, settings, and usage history stay in the SQLite file until you copy them. To move an existing deployment:
1
Stop the App
Stop the gateway App so nothing writes to the SQLite file during the copy.
2
Copy the store
Run
copy_to_postgres.sh from the release folder as a Domino Job, with LLM_GATEWAY_DATABASE_URL set to the new, empty database. The Job creates the schema, copies every table in one transaction, and checks the row counts. It refuses a database that already has rows. Pass --replace to delete them first.3
Point the App at Postgres
Set
LLM_GATEWAY_DATABASE_URL on the App and start it. Keep the same encryption key (.gateway_key or LLM_GATEWAY_ENCRYPTION_KEY), because the Job copies credentials encrypted.LLM_GATEWAY_DATABASE_URL. Anything written to Postgres since the switch stays in Postgres.
Run one gateway instance per store.
Back up the database
Schedule daily, weekly, monthly, or quarterly backups, or click Run now. Backups go to<dataset>/llm_gateway/backups/ by default and are standard SQLite files. The gateway prunes older backups according to the retention setting.
With Postgres, the scheduled backup writes a pg_dump custom-format archive, llm_gateway-<stamp>.dump, to the same backup directory. Restore it with pg_restore. The backup needs the PostgreSQL client tools on the App’s PATH, at the server’s version or later, and fails with a message when they’re missing. Retention counts only the dumps, so SQLite backups from before the switch stay until you delete them. You can also back up a managed Postgres database with its own tooling.
To restore, stop the App, replace llm_gateway.db in the Dataset with a backup, and restart. Provider credentials in the backup stay encrypted, and the .gateway_key file next to the database decrypts them.
Purge old logs
Delete usage and audit logs older than a set horizon. 6 months is a good default. Purge works the same on SQLite and Postgres. The gateway won’t purge inside your longest active budget period, and can refuse to purge without a backup from the last 7 days. Use Dry run to see row counts first.Mirror logs to a warehouse
Mirror usage logs, audit logs, or both to a Domino Data Source: Snowflake, Postgres, Redshift, BigQuery, MySQL, ClickHouse, or MariaDB.1
Pick the Data Source and tables
In Settings, pick the Data Source and table names, then click Test connection.
2
Create the table
Click Create table.
3
Turn on mirroring
Set each log type to
mirror. Rows arrive 5 to 15 seconds after the request.4
Copy history
Click Backfill now to copy existing logs. It’s safe to rerun.
Monitor health
GET /health returns {"status": "ok"}. GET /health?verbose=1 adds database, backup age, and mirror status, plus the usage log writer’s queue depth, write counts, and last error under log_writer. When db_writable is false, db_writable_error gives the reason. The write check runs off the request path and gives up after LLM_GATEWAY_HEALTH_DB_TIMEOUT_S, so the gateway keeps serving requests. When the mirror queue backs up or the last backup is older than twice its interval, the gateway writes a warning to the audit log.
GET /metrics returns metrics in Prometheus text format. Like /health, it needs no authentication, so a Prometheus scraper can reach it. It reports request counts and latency by endpoint, including time to first byte for streamed responses, plus preflight time and rate-limit denials by limit kind and model alias. It also reports gauges for the usage log writer, the database connection pool, and the worker thread pool. Metric labels never include user IDs, token names, or tag values.
Both GET /health?verbose=1 and /metrics report the usage log writer’s shed count: the denial rows the writer skipped because its queue was at least half full. Denial rows are skipped first so they never delay or crowd out rows that carry cost.
Environment variables
Set these under App Configuration > Environment. A standard deployment needs none of them.Related
- LLM Gateway 2.0: what the gateway routes, its endpoints, and how callers make their first request.
- Control access, spend, and usage: grant callers access to aliases, set budgets, and track cost.
- Configure guardrails and fallback routing: screen requests and route around failures.