> ## Documentation Index
> Fetch the complete documentation index at: https://aivision.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Read the relevant procedure and prerequisites before suggesting commands. Cite the section and give an observable check. Treat sample data as illustrative. Report product actions and results only when verified in the user's environment.

# Docker Compose deployment

> Choose one of four database combinations, then use the accompanying entry point for installation, retries, image updates and data-preserving stops.

This page is for operators choosing optional Docker Compose on one machine. Default Docker keeps the Go CLI Docker runtime; see [Docker deployment](https://aivision.mintlify.site/en/deployment/docker.md). Compose is also controlled by the Go CLI: `aiv ... --target compose` invokes native Compose and performs the necessary checks before changing a deployment. It needs no host Python or additional control script. Use `aiv` for routine deployment, status, logs, rebuilding and stopping. Native Compose remains a read-only configuration and troubleshooting entry point below.

First complete [CLI installation](https://aivision.mintlify.site/en/guides/install-cli.md), persistent PATH and verification in a new terminal, retaining the fixed installation. This example uses the default state root; existing deployments must keep their original namespace, workdir and blueprint.

## Optional: create a Compose project through aiv

This is a current-source capability. Use a CLI confirmed to contain `--target compose` with matching images. If no release is confirmed to include it, follow the [source build steps](https://aivision.mintlify.site/en/guides/install-cli.md#build-seekdb-cli) for the matching revision, then inspect `aiv cast --help`. A `dev` tag, version string or `OB_BACKEND` support does not establish this target.

For a new installation, use the [Docker configuration steps](https://aivision.mintlify.site/en/deployment/docker.md#deployment-configuration) to prepare private vars, the database choice, fixed UTC history start and images, then explicitly select Compose:

```bash theme={null}
aiv cast --target compose --namespace aivision \
  --workdir "$HOME/.aivision/forge" --vars-file ./aivision.vars.yaml
aiv status --target compose --namespace aivision \
  --workdir "$HOME/.aivision/forge"
aiv logs --target compose --namespace aivision \
  --workdir "$HOME/.aivision/forge" -n 100 frontend
```

In the CLI bundle mode above, keep `--target compose`, the original namespace and customized `--workdir` / `--file` on every Compose CLI operation. Omitting the target selects default Docker. Existing Docker installations remain supported by their original default method and are not converted automatically. Do not mix ownership, change labels or delete records to adopt resources.

The CLI displays the actual immutable private bundle path under `<namespace-state>/compose/bundles/<hash>/`. Retain that directory and CLI state. Change configuration/images through the original vars file or `--var` and cast, not generated-file edits. Status, logs and destroy use the saved bundle rather than retargeting from new defaults or ambient variables.

Rebuilding and stopping this CLI bundle project also retain the same selectors:

```bash theme={null}
aiv redeploy --target compose --namespace aivision \
  --workdir "$HOME/.aivision/forge" \
  --vars-file "$HOME/aivision-deploy/aivision.vars.yaml"
```

To stop and retain data:

```bash theme={null}
aiv destroy --target compose --namespace aivision \
  --workdir "$HOME/.aivision/forge"
```

`redeploy` requires a maintenance window. Resume a stopped deployment with the complete original `cast`. The standalone Compose-file mode below uses different selectors; do not mix the modes.

## Inspect the same project with native Compose

Use `aiv status` and `aiv logs` above for routine checks. Use this section when native Compose configuration inspection or troubleshooting is needed.

Replace the placeholder with the actual complete directory displayed by the CLI, and set the project name to its original namespace. CLI bundles contain resolved private values and use `--env-file /dev/null`:

```bash theme={null}
AIV_COMPOSE_BUNDLE=/absolute/path/reported/by/aiv
AIV_COMPOSE_PROJECT=aivision
docker compose --project-name "$AIV_COMPOSE_PROJECT" --file "$AIV_COMPOSE_BUNDLE/compose.yaml" \
  --env-file /dev/null config --quiet
docker compose --project-name "$AIV_COMPOSE_PROJECT" --file "$AIV_COMPOSE_BUNDLE/compose.yaml" \
  --env-file /dev/null ps --all
docker compose --project-name "$AIV_COMPOSE_PROJECT" --file "$AIV_COMPOSE_BUNDLE/compose.yaml" \
  --env-file /dev/null logs --tail 100 frontend
```

`config --quiet` validates without printing resolved private values. Explicitly select the original project name so ambient `COMPOSE_PROJECT_NAME` cannot change the target. Standalone parameterized templates must use their **original actual `.env`**, not `/dev/null`.

## Retain Go lifecycle checks for installation and stopping

The currently reviewed mutation workflow uses `aiv --target compose`. The Go CLI invokes native Compose while retaining storage identity/ownership, the shared lock, isolated seekdb initialization, initialization-task reruns and exit/OOM checks before deletion. Successful native inspection does not establish bare `docker compose up` / `down` as an equivalent full workflow.

An existing parameterized Compose file can use the same Go lifecycle through `--compose-file` below. It is not automatically imported into default CLI vars; file/state identity comes from resolved YAML. This mode cannot be mixed with `--namespace`, `--workdir`, `--vars-file`, `--var` or blueprint options.

## 1. Prepare matching deployment material and images

You need Linux / macOS, a reachable Docker daemon, Docker Compose **2.27+**, an `aiv` containing the current Compose target, and resources for the selected database plus five application services. Host Python is not required; bootstrap Python runs inside the applicable application images. Database defaults are not whole-platform capacity guarantees.

Use the complete selected-version Compose/bootstrap material and matching images; do not copy out a single YAML. Pin current source to the selected commit, updating an existing checkout instead of cloning again.

```bash theme={null}
git clone --depth 1 --branch main --single-branch https://github.com/ob-labs/ai-vision-ob.git
cd ai-vision-ob
```

**Run the remaining commands from the product repository root.** Use an absolute `--compose-file` and the original actual private `.env`. `--compose-env-file` defaults to `.env` when omitted; these examples always specify it. [Install a matching aiv](https://aivision.mintlify.site/en/guides/install-cli.md), then check:

```bash theme={null}
docker compose version
docker info
aiv cast --help
```

Use images confirmed to include SQL readiness, native `--ready`, organization-file support and shutdown fixes. Choose release artifacts or build them according to [version matching](https://aivision.mintlify.site/en/deployment/overview.md#use-matching-deployment-material-and-images). Here, `main` is a source entry point; it does not guarantee that rolling `dev` images have been updated. For GHCR permission errors, follow [image access](https://aivision.mintlify.site/en/deployment/docker.md#3-prepare-image-access-when-needed).

## 2. Select one database combination explicitly

| File used from the repository root | Database mode | What to prepare |
| - | - | - |
| `deploy/docker/compose.yaml` | Managed OceanBase CE | Dedicated database and configuration volumes; tenant and application database initialization |
| `deploy/docker/compose.seekdb.yaml` | Managed seekdb | Offline credential initialization for an empty volume; original-password verification for an existing volume |
| `deploy/docker/compose.external-oceanbase.yaml` | External OceanBase CE | Container-reachable MySQL-mode tenant account authorized to create and migrate three application databases |
| `deploy/docker/compose.external-seekdb.yaml` | External seekdb | Reachable authorized account; no tenant is created |

**The file selects the database mode.** Changing `OB_BACKEND` in `.env` does not select another file or migrate data. Use a separate deployment and migrate data when changing engines. External databases remain under their operators' management; the platform still initializes its application databases.

## 3. Save separate private configuration

The following is for a new installation only. Reuse existing configuration directly. This command refuses to overwrite a file with the same name:

```bash theme={null}
install -d -m 700 "$HOME/aivision-compose"
(umask 077; set -C
  cat deploy/docker/.env.example > "$HOME/aivision-compose/compose.env"
)
```

Fill in the file in an editor and keep it outside version control. This example uses a separate deployment identity. Adjust directories before the first installation, then keep using the same values:

```dotenv theme={null}
NAMESPACE=aivision-compose
AIV_STATE_DIR=${HOME}/aivision-compose/state
AIV_LOG_DIR=${HOME}/aivision-compose/logs
DOCKER_NETWORK=aivision-compose-net
```

| Setting | How to fill it in |
| - | - |
| Five image references | Set full, matching image references with `FRONTEND_IMAGE`, `BACKEND_IMAGE`, `DIAGNOSIS_IMAGE`, `INGEST_GATEWAY_IMAGE` and `DATA_BACKEND_IMAGE` |
| Private credentials | Fill all required credential fields, including database passwords, platform secrets, internal ingestion and diagnosis tokens, and the data-backend administrator password; do not deploy placeholders |
| `AIVISION_NATIVE_TRACE_HISTORY_START` | Fixed UTC start covering every retained Trace; for confirmed empty storage, choose the first installation day's UTC start once and do not recalculate it for retries or updates |
| `BIND_ADDR` / `PUBLIC_HOST` | Loopback by default; for remote use, set reachable addresses and follow [remote access requirements](https://aivision.mintlify.site/en/deployment/docker.md#remote-access) |
| `AIVISION_RELEASE_MANIFEST_BASE64` | Obtain only from verified material for the selected release; source candidates can leave it empty, in which case About may show the installed product version as unknown |

Role-based image keys take precedence over legacy `FE_IMAGE`, `BE_IMAGE`, `AGENTLENS_IMAGE`, `GATEWAY_IMAGE` and `SIGNOZ_IMAGE` in the same file. Do not change only `IMAGE_TAG` while retaining old individual image references.

Use letters, digits, `_` and `-` for database passwords. Single-quote other dotenv secrets containing `$` to preserve literal values. Do not paste `.env` or the complete resolved Compose configuration into public logs.

External databases also need `OB_HOST`, `OB_HOST_PORT`, `OB_USER` and `OB_USER_URL`. The host must be reachable from the container network; `127.0.0.1` means the container itself. SQL and URL username forms must agree, for example CE's `root@aivision` / `root%40aivision`, or seekdb's `root` / `root`.

## 4. Install and inspect status

This example uses managed CE. For another combination, change every command's `--compose-file` to the matching file above and keep the same private configuration:

```bash theme={null}
aiv cast --target compose --compose-file "$(pwd)/deploy/docker/compose.yaml" \
  --compose-env-file "$HOME/aivision-compose/compose.env"
```

The Go CLI checks identity/ownership, stops services and checks exit results, removes completed one-time tasks, initializes managed seekdb on an isolated network when needed, then invokes native Compose to run initialization dependencies and wait for readiness. An incorrect password on an existing volume fails without resetting credentials.

```bash theme={null}
aiv status --target compose --compose-file "$(pwd)/deploy/docker/compose.yaml" \
  --compose-env-file "$HOME/aivision-compose/compose.env"
aiv logs --target compose --compose-file "$(pwd)/deploy/docker/compose.yaml" \
  --compose-env-file "$HOME/aivision-compose/compose.env" backend
```

Confirm that all five applications are running and healthy, required initialization tasks succeeded, and the managed database is healthy. With an external database, verify the actual SQL connection. The default Web URL is `http://127.0.0.1:5174`. Register or sign in with your own platform account; internal database and SigNoz passwords do not sign in to AI Vision.

Then [connect an Agent](https://aivision.mintlify.site/en/web-quickstart.md) or [send an SDK record](https://aivision.mintlify.site/en/integrations/langfuse.md), report a new Trace with valid credentials and read it back with authentication. Healthy status establishes only the [corresponding probe conditions](https://aivision.mintlify.site/en/deployment/overview.md#health-readiness); it does not replace product readback.

## Retry and update images

After fixing configuration, networking or capacity, repeat **the complete original `aiv cast --target compose --compose-file ... --compose-env-file ...` command**. For parameterized templates, change images in the original `.env`; for resolved exports, regenerate from the original private vars and use `--compose-env-file /dev/null`. Another `.env` cannot override baked values. Updates stop and recreate single-instance applications; schedule a maintenance window and back up beforehand.

Keep the namespace, state and log directories, network, credentials, metastore, volume bindings, organization identity and fixed history start. After an update, compare actual image IDs and organization identity, then read one Trace from before and one from after the update. Recasting the same image or changing a tag without changing the image ID does not establish a cross-release upgrade.

Failed shutdown, a nonzero exit or OOM blocks subsequent removal and purge. Failed container IDs remain in the private `.compose-stop-pending.json` and are checked again on retry. Read logs, fix the cause, then restart the affected container and let it stop successfully. If manual removal is necessary, remove only the diagnosed failed container and retain its data. Do not delete stop records to bypass the check.

## Native query maintenance

Matching versions default to `BACKEND_QUERY_MODE=auto` and `DATA_BACKEND_PROJECTION_MAINTENANCE_ENABLED=true`. Edit the existing role entries in the original private `.env`, then run `aiv cast --target compose` with the original `--compose-file` and `--compose-env-file`; role entries take precedence over legacy application aliases in the same file. `raw` preserves filters while bypassing projections; `false` durably suspends derived maintenance and serving. Returning to `true` does not clear shared suspension. Repair the cause, explicitly resume, and verify complete results. See [Docker query maintenance and recovery](https://aivision.mintlify.site/en/deployment/docker.md#native-query-maintenance) for the boundaries and how to supply the key only to the recovery process.

## Stop and retain data

```bash theme={null}
aiv destroy --target compose --compose-file "$(pwd)/deploy/docker/compose.yaml" \
  --compose-env-file "$HOME/aivision-compose/compose.env"
```

This stops and removes containers while retaining named volumes and bind-mounted metadata. Resume with the original cast. Compose `destroy --purge` **removes named volumes only and retains the bind-mounted metastore, deployment identity and configuration; it is not a complete reset**. A failed stop check prevents purge too. External databases are not deleted.

Before rebuilding from empty storage, arrange backups and explicitly handle this deployment's metadata and identity. Do not combine an old retained metastore with an empty database and call it a fresh installation. Default Docker Go `destroy --purge` removes managed database volumes and namespace state, including the default metastore. Its retention differs from Compose. Compose rejects `redeploy --purge` and `--purge-repos`; do not transfer cleanup semantics from another target.

## Common problems

| Symptom | Check and next step |
| - | - |
| Startup rejects containers or volumes owned by another tool | Keep using the original management entry point; stopped containers still have ownership and cannot be forcibly adopted |
| An old image starts but readiness fails or returns 404 | Check for the new SQL readiness endpoints and native `--ready`; do not replace readiness with liveness |
| A stop check blocks `up` | Inspect the failed container's exit code, OOM state and logs, fix it, and stop it successfully before retrying |
| External database authentication fails | Check container-reachable addresses, permissions, the original password and matching `OB_USER` / `OB_USER_URL` |
| Resolved YAML does not change with `.env` | `aiv generate --target compose` may have embedded private values; keep the export private and regenerate it from the source configuration rather than overriding baked values through env |

`aiv generate --target compose` exports resolved private configuration and bootstrap material without a host Python control program. Operate such exports with the original absolute YAML path and `--compose-env-file /dev/null`; parameterized repository templates use the original actual `.env`. See the [product Compose contract](https://github.com/ob-labs/ai-vision-ob/blob/main/deploy/docker/README.md) for complete details.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.