AIOps Database (Soybean) #
The AIOps stack (tofu-aiops-hub) uses its own PostgreSQL database called soybean,
separate from the main BonsAI database. It stores extraction flags, issues, labels, and
other AIOps bookkeeping.
Because it runs as a standalone container, it is not the connection CloudBeaver is
pre-configured with, and it is not reachable through tofu-mcp (which targets the main
bonsai database only). To inspect or query it in a Coder workspace / preview environment,
go through Portainer.
Connection Details #
| Setting | Value |
|---|---|
| Container / hostname | aiops-database |
| Database | soybean |
| Username | postgres |
| Password | postgres |
| Port (in-network) | 5432 |
| Port (host) | 15432 |
| Docker network | bonsai-network |
Other containers on
bonsai-network(CloudBeaver, BonsAPI, etc.) reach it at hostaiops-databaseon port5432. From the Docker host itself it is published onlocalhost:15432.
Connect via Portainer (recommended) #
Portainer is the Docker management UI available in your Coder workspace (port 9443).
Use it to open a shell directly inside the database container.
-
Open Portainer from the workspace apps section.
-
Go to Containers and click the
aiops-databasecontainer. -
Click
>_ Console(Exec / Attach). -
Set the command to
/bin/bash(or/bin/sh) and the user toroot, then Connect. -
From the container shell, open a
psqlsession:psql -U postgres -d soybean -
Run queries as needed:
-- Confirm the connection SELECT 1; -- Inspect the extraction-flag tables \dt SELECT id, name FROM label ORDER BY name; SELECT extraction_id, reason FROM extraction_issue ORDER BY created_at DESC LIMIT 20; -
Exit with
\q, then close the console.
Inspecting logs #
The same container page in Portainer has a Logs tab — useful for watching the
aiops-migration container apply schema changes or debugging connection issues.
Connect via CloudBeaver (optional) #
If you prefer a visual UI, add a second connection in CloudBeaver alongside the main
bonsai one (see CloudBeaver):
- Database → New Connection (+ icon) → PostgreSQL.
- Enter:
- Host:
aiops-database - Port:
5432 - Database:
soybean - Username:
postgres - Password:
postgres
- Host:
- ✓ Save credentials → Test Connection → Create.
Applying Migrations #
The soybean schema is managed by Atlas, with migrations in
tools/aiops-database/migrations/. The aiops-migration container applies pending
migrations automatically on mise run dev. To apply them manually:
mise run aiops-db-migrate-apply
Note:
atlas.hcl’slocalenv targets port5433, but the container publishes on the host at15432. If the mise task fails withconnection refused, apply against the published port directly:cd tools/aiops-database atlas migrate apply --dir "file://migrations" \ --url "postgres://postgres:postgres@localhost:15432/soybean?sslmode=disable"
Troubleshooting #
Cannot Connect #
- Confirm the container is running and healthy in Portainer (Containers →
aiops-databaseshould show healthy). - From other containers use host
aiops-database(notlocalhost); from the host uselocalhost:15432. - Check the Logs tab for the
aiops-databaseandaiops-migrationcontainers.
Migrations Not Applied #
- Verify the
aiops-migrationcontainer ran successfully (it exits after applying). - Re-run
mise run aiops-db-migrate-apply(see note above on the port).
Resources #
- CloudBeaver - Web-based database management
- Database Migration - Atlas migration workflow
- Compose definition:
tools/aiops-database/docker-compose.yml - Migrations:
tools/aiops-database/migrations/