> For the complete documentation index, see [llms.txt](https://docs.envector.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.envector.io/1.5.x/operations-and-management/server-environment.md).

# Server System Config

## Table of Contents

1. [System Architecture Overview](#1-system-architecture-overview)
2. [Common Environment Variables](#2-common-environment-variables)
3. [Service-Specific Environment Variables](#3-service-specific-environment-variables)
4. [Advanced Tuning Parameters](#4-advanced-tuning-parameters)
5. [Production Setup Guide](#5-production-setup-guide)

## 1. System Architecture Overview

### MSA Service Composition

enVector is composed of five core service roles (Endpoint, Backend, Orchestrator, Shaper, and Compute). Compute can be scaled out to multiple instances as needed.

```
                        SDK (pyenvector) - client-side HE encrypt/decrypt
                               |
                               | gRPC :50050
                               v
                         +-----------+
                         | Endpoint  |
                         +-----------+
                               |
                               | gRPC :50051
                               v
  +----------+           +-----------+           +--------------+
  |  Shaper  | <-------> |  Backend  | --------> | Orchestrator |
  +----------+  :50056   +-----------+  :25121   +--------------+
       |                       |                        |
       |                +------+-----+             gRPC | :25123
       |                | :5432      | :59000           v
       |         +------------+ +-----------+     +-----------+
       |         | PostgreSQL | |  MinIO/S3 |     |  Compute  | (1..N)
       |         +------------+ +-----------+     +-----------+
       |                |           |                   |
       +----------------+-----------+              EVI Library
               (shared storage)                    (C++ / CGO)
```

| Service      | Role                                                         | Default Port                |
| ------------ | ------------------------------------------------------------ | --------------------------- |
| Endpoint     | Receives client requests, authentication, routing            | 50050 (gRPC), 8080 (Health) |
| Backend      | Metadata management, vector indexing, DB/Storage integration | 50051                       |
| Orchestrator | Coordinates Compute nodes, schedules jobs                    | 25121                       |
| Shaper       | Handles data partitioning/merging (Split/Merge)              | 50056                       |
| Compute      | Performs vector operations and search (CPU/GPU)              | 25123                       |

Optional operational/security components (enabled via overlays):

| Service  | Role                                               | Default Port               |
| -------- | -------------------------------------------------- | -------------------------- |
| Keycloak | OIDC authentication (local mode)                   | 8082 (HTTP)                |
| Audit    | Audit log pipeline (Vector + Redpanda + audit svc) | 50052 (gRPC)               |
| Console  | Operational web UI                                 | 18000                      |
| KMS      | Key Management Service (separate compose project)  | 50090 (gRPC), 50091 (HTTP) |

### Docker Compose File Structure

| Category            | File                          | Purpose                              |
| ------------------- | ----------------------------- | ------------------------------------ |
| Core MSA            | `docker-compose.envector.yml` | Five core services                   |
| Core infrastructure | `docker-compose.infra.yml`    | PostgreSQL, MinIO                    |
| Compute override    | `docker-compose.gpu.yml`      | GPU Compute override                 |
| CA                  | `docker-compose.ca.yml`       | Local Step-CA for TLS/mTLS           |
| Auth                | `docker-compose.keycloak.yml` | Local Keycloak (OIDC) — `--keycloak` |
| Audit               | `docker-compose.audit.yml`    | Audit pipeline — `--audit`           |
| KMS                 | `docker-compose.kms.yml`      | Key Management Service — `--kms`     |
| Console             | `docker-compose.console.yml`  | Operational web UI — `--console`     |

> Enable overlays with the helper script, e.g. `./scripts/start_envector.sh --kms --keycloak --audit --console`.

***

## 2. Common Environment Variables

Configured in the `.env` file and shared across all Docker Compose files.

| Variable                     | Default         | Description                                                               |
| ---------------------------- | --------------- | ------------------------------------------------------------------------- |
| `COMPOSE_PROJECT_NAME`       | `my_project`    | Docker Compose project name. Used as a prefix for containers and networks |
| `VERSION_TAG`                | `latest`        | Docker image tag                                                          |
| `IMAGE_DIR`                  | `cryptolabinc/` | Docker registry path                                                      |
| `PULL_POLICY`                | `always`        | Image pull policy. Use `never` or `if_not_present` for local images       |
| `ENVECTOR_LOG_LEVEL`         | `INFO`          | Log level: `DEBUG`, `INFO`, `WARN`, `ERROR`                               |
| `DOCKER_VOLUME_DIRECTORY`    | `.`             | Default host volume mount directory                                       |
| `START_ENVECTOR_COMPOSE_DIR` | `.`             | Source directory for configuration files (e.g., license)                  |

***

## 3. Service-Specific Environment Variables

### Endpoint

| Variable                         | Default                  | Description                                         |
| -------------------------------- | ------------------------ | --------------------------------------------------- |
| `ENVECTOR_ENDPOINT_HOST_PORT`    | `50050`                  | Host-exposed gRPC port                              |
| `ENVECTOR_ENDPOINT_PORT`         | `50050`                  | gRPC listen port                                    |
| `ENVECTOR_HTTP_HEALTH_HOST_PORT` | `18080`                  | Host-exposed Health port                            |
| `ENVECTOR_HTTP_HEALTH_PORT`      | `8080`                   | Health check HTTP port (`/health`, `/health/ready`) |
| `ENVECTOR_BACKEND_ADDRESS`       | `envector-backend:50051` | Backend service address                             |
| `ENVECTOR_ADMIN_API_ENABLED`     | `true`                   | Whether the Admin API is enabled                    |

### Backend

**Service connections:**

| Variable                        | Default                       | Description          |
| ------------------------------- | ----------------------------- | -------------------- |
| `ENVECTOR_BACKEND_PORT`         | `50051`                       | gRPC listen port     |
| `ENVECTOR_ORCHESTRATOR_ADDRESS` | `envector-orchestrator:25121` | Orchestrator address |
| `ENVECTOR_SHAPER_ADDRESS`       | `envector-shaper:50056`       | Shaper address       |

**Database connection:**

Either set `ENVECTOR_DB_URL`, or compose the connection from individual parameters.

| Variable               | Default      | Description                                                                                   |
| ---------------------- | ------------ | --------------------------------------------------------------------------------------------- |
| `ENVECTOR_DB_URL`      | (composed)   | PostgreSQL connection URL (recommended). Takes precedence over individual parameters when set |
| `ENVECTOR_DB_HOST`     | `metadatadb` | DB hostname                                                                                   |
| `ENVECTOR_DB_PORT`     | `5432`       | DB port                                                                                       |
| `ENVECTOR_DB_USER`     | `postgres`   | DB user                                                                                       |
| `ENVECTOR_DB_PASSWORD` | -            | DB password                                                                                   |
| `ENVECTOR_DB_NAME`     | `mydatabase` | Database name                                                                                 |
| `ENVECTOR_DB_SCHEMA`   | `public`     | Schema name                                                                                   |
| `ENVECTOR_DB_SSL`      | `disable`    | SSL mode. `require` recommended in production                                                 |
| `ENVECTOR_DB_ADDRESS`  | -            | External DB endpoint (e.g., AWS RDS). Replaces `DB_HOST:DB_PORT` when set                     |

> DB URL format: `postgresql://{DB_USER}:{DB_PASSWORD}@{DB_ADDRESS or DB_HOST:DB_PORT}/{DB_NAME}?sslmode={DB_SSL}`

**Storage connection:**

| Variable                                    | Default         | Description                                                                         |
| ------------------------------------------- | --------------- | ----------------------------------------------------------------------------------- |
| `ENVECTOR_STORAGE_PROVIDER`                 | `s3`            | Storage provider: `s3`, `minio`, or `gcs`                                           |
| `ENVECTOR_STORAGE_ADDRESS`                  | `storage:59000` | Storage address                                                                     |
| `ENVECTOR_STORAGE_USER`                     | `minioadmin`    | Access key                                                                          |
| `ENVECTOR_STORAGE_PASSWORD`                 | -               | Secret key                                                                          |
| `ENVECTOR_STORAGE_SECURE`                   | `false`         | Whether to use HTTPS. Recommend to use TLS certificate configuration in production. |
| `ENVECTOR_STORAGE_REGION`                   | `us-east-1`     | S3 region                                                                           |
| `ENVECTOR_STORAGE_BUCKET_NAME`              | `envector`      | Bucket name                                                                         |
| `ENVECTOR_STORAGE_CREATE_BUCKET`            | `true`          | Whether to create the bucket automatically                                          |
| `ENVECTOR_STORAGE_HAS_HEALTHCHECK_ENDPOINT` | `true`          | Whether to use the storage health check                                             |

### Orchestrator

| Variable                     | Default | Description      |
| ---------------------------- | ------- | ---------------- |
| `ENVECTOR_ORCHESTRATOR_PORT` | `25121` | gRPC listen port |

DB and Storage connection variables are the same as Backend.

### Shaper

| Variable               | Default | Description      |
| ---------------------- | ------- | ---------------- |
| `ENVECTOR_SHAPER_PORT` | `50056` | gRPC listen port |

Storage connection variables are the same as Backend.

### Compute

| Variable                          | Default                       | Description                                                                               |
| --------------------------------- | ----------------------------- | ----------------------------------------------------------------------------------------- |
| `ENVECTOR_COMPUTE_PORT`           | `25123`                       | gRPC listen port                                                                          |
| `ENVECTOR_ORCHESTRATOR_ADDRESS`   | `envector-orchestrator:25121` | Orchestrator address                                                                      |
| `USE_GPU`                         | `false`                       | Whether to enable GPU. Set to `true` in GPU mode                                          |
| `ENVECTOR_COMPUTE_ADVERTISE_HOST` | (auto)                        | Override for the externally advertised address. Falls back to POD\_IP/hostname when unset |

**GPU settings (when using `docker-compose.gpu.yml`):**

| Variable                   | Default | Description     |
| -------------------------- | ------- | --------------- |
| `ENVECTOR_COMPUTE_GPU0_ID` | `0`     | GPU 0 device ID |

In GPU mode, image tags receive a `-gpu` suffix and NVIDIA driver resource reservations are applied.

### DB (PostgreSQL)

| Variable            | Default                         | Description                                                               |
| ------------------- | ------------------------------- | ------------------------------------------------------------------------- |
| `POSTGRES_USER`     | inherits `ENVECTOR_DB_USER`     | DB username                                                               |
| `POSTGRES_PASSWORD` | inherits `ENVECTOR_DB_PASSWORD` | DB password. Recommend to set credentials to strong values in production. |
| `POSTGRES_DB`       | inherits `ENVECTOR_DB_NAME`     | Database name                                                             |
| `POSTGRES_SCHEMA`   | inherits `ENVECTOR_DB_SCHEMA`   | Schema name                                                               |
| `ENVECTOR_DB_SSL`   | disable                         | DB SSL. Recommend to set as `require` in production.                      |

**Server startup parameters:**

```
max_wal_size=8GB
checkpoint_timeout=10min
max_connections=1000
```

### Storage (MinIO/S3)

| Variable                        | Default                              | Description                                                                   |
| ------------------------------- | ------------------------------------ | ----------------------------------------------------------------------------- |
| `MINIO_ROOT_USER`               | inherits `ENVECTOR_STORAGE_USER`     | Root access key                                                               |
| `MINIO_ROOT_PASSWORD`           | inherits `ENVECTOR_STORAGE_PASSWORD` | Root secret key. Recommend to set credentials to strong values in production. |
| `ENVECTOR_STORAGE_PORT`         | `59000`                              | S3 API port                                                                   |
| `ENVECTOR_STORAGE_CONSOLE_PORT` | `59001`                              | MinIO console port                                                            |

Health check: `http://localhost:{ENVECTOR_STORAGE_PORT}/minio/health/live`

### License

| Variable                 | Default                       | Description             |
| ------------------------ | ----------------------------- | ----------------------- |
| `ENVECTOR_LICENSE_TOKEN` | `/envector/license/token.jwt` | License token file path |

Placing `token.jwt` in the Docker Compose execution directory or, set the environment variable `ENVECTOR_LICENSE_TOKEN`.

### KMS

Enabled with the `--kms` overlay. See [Key Management Service (KMS)](/1.5.x/key-management/managed-kms/kms.md) for operations.

| Variable                         | Default         | Description                                               |
| -------------------------------- | --------------- | --------------------------------------------------------- |
| `ENVECTOR_KMS_GRPC_HOST_PORT`    | `50090`         | KMS gRPC host-exposed port                                |
| `ENVECTOR_KMS_HTTP_HOST_PORT`    | `50091`         | KMS HTTP/API host-exposed port                            |
| `ENVECTOR_KMS_SEAL_MODE`         | `vault-transit` | Seal/unseal operating mode (e.g. `vault-transit`, `none`) |
| `ENVECTOR_KMS_DECRYPT_TOPK_JOBS` | `1`             | Top-k decryption job concurrency                          |

> The KMS API is exposed over TLS by default. The Secret Manager (Vault/OpenBao) data volume (`kms-vault-data`) holds the sealed keys — include it in your backup policy; if lost, unsealing is impossible.

### Auth (Keycloak)

Enabled with the `--keycloak` overlay. See [Keycloak / OIDC](/1.5.x/operations-and-management/authentication/keycloak.md) and [Authentication](/1.5.x/operations-and-management/authentication.md).

| Variable                            | Default    | Description                                                          |
| ----------------------------------- | ---------- | -------------------------------------------------------------------- |
| `KEYCLOAK_HOST_PORT`                | `8082`     | Keycloak host-exposed HTTP port                                      |
| `KEYCLOAK_REALM`                    | `envector` | Realm used for enVector users and roles                              |
| `KEYCLOAK_BOOTSTRAP_ADMIN_USERNAME` | `kcadmin`  | Bootstrap admin (master realm) username                              |
| `KEYCLOAK_BOOTSTRAP_ADMIN_PASSWORD` | -          | Bootstrap admin password (set to a strong value)                     |
| `KEYCLOAK_LOCAL_USER_PASSWORD`      | -          | Shared password for seeded operational users (set to a strong value) |
| `KEYCLOAK_LOCAL_TENANT_ID`          | -          | Tenant ID written into seeded users' `tenant_id` claim               |

Endpoint-side auth claims (must match the IdP's token claims):

| Variable                          | Default                     | Description                            |
| --------------------------------- | --------------------------- | -------------------------------------- |
| `ENVECTOR_AUTH_ALLOWED_AUDIENCES` | `envector-cli,envector-api` | Audiences trusted by the Endpoint      |
| `ENVECTOR_AUTH_ROLE_CLAIM`        | `envector_roles`            | JWT claim carrying realm roles         |
| `ENVECTOR_AUTH_PRINCIPAL_CLAIM`   | `principal_id`              | JWT claim carrying the caller identity |

### Audit

Enabled with the `--audit` overlay. See [Audit](/1.5.x/operations-and-management/audit.md).

| Variable                        | Default | Description                                                                      |
| ------------------------------- | ------- | -------------------------------------------------------------------------------- |
| `ENVECTOR_AUDIT_HOST_PORT`      | `50052` | Audit service gRPC host-exposed port                                             |
| `ENVECTOR_AUDIT_RETENTION_DAYS` | -       | Retention period for audit records. Production recommendation ≈ `2190` (6 years) |

> In production, store audit logs with S3 Object Lock (WORM) in `COMPLIANCE` mode.

***

## 4. Advanced Tuning Parameters

| Service | Variable                                     | Default                         | Description                                                                                              |
| ------- | -------------------------------------------- | ------------------------------- | -------------------------------------------------------------------------------------------------------- |
| Backend | `ENVECTOR_MAX_NUM_VECTORS_PER_SHARD`         | `4096`                          | Maximum number of vectors per shard                                                                      |
| Backend | `CTXTMAP_BATCH_SIZE`                         | `256` (code) / `1024` (Compose) | Context map batch size. Code default is `256`; the bundled Docker Compose deployment overrides to `1024` |
| Backend | `CTXTMAP_UPDATE_BATCH_SIZE`                  | `1024`                          | Context map update batch size                                                                            |
| Backend | `ENVECTOR_CLEANUP_GRACE_PERIOD`              | `5m`                            | Cleanup grace period                                                                                     |
| Backend | `VCT_CAPACITY`                               | `4096`                          | Virtual centroid tree capacity                                                                           |
| Shaper  | `ENVECTOR_SHAPER_MAX_WORKERS`                | `16`                            | Maximum concurrent workers                                                                               |
| Shaper  | `ENVECTOR_SHAPER_SPLIT_UPLOAD_CONCURRENCY`   | `1`                             | Split upload concurrency                                                                                 |
| Shaper  | `ENVECTOR_SHAPER_MERGE_DOWNLOAD_CONCURRENCY` | `1`                             | Merge download concurrency                                                                               |
| Shaper  | `ENVECTOR_SHAPER_CLEANUP_PERIOD`             | `1h`                            | Cleanup interval                                                                                         |
| Shaper  | `ENVECTOR_SHAPER_JOB_TTL`                    | `24h`                           | Job TTL                                                                                                  |
| Shaper  | `MALLOC_ARENA_MAX`                           | `2`                             | glibc malloc arena limit (prevents excessive memory retention)                                           |
| Compute | `NUM_SEARCH_WORKERS`                         | `30` (CPU), `1` (GPU)           | Number of search worker threads                                                                          |

***

## 5. Production Setup Guide

Items to verify before deploying to production.

### Security Hardening

* [ ] **Enable DB SSL:** `ENVECTOR_DB_SSL=require`
* [ ] **Storage HTTPS:** `ENVECTOR_STORAGE_SECURE=true` (requires TLS certificate configuration)
* [ ] **Change passwords:** Set `ENVECTOR_DB_PASSWORD`, `ENVECTOR_STORAGE_PASSWORD`, `KEYCLOAK_BOOTSTRAP_ADMIN_PASSWORD`, `KEYCLOAK_LOCAL_USER_PASSWORD`, and other credentials to strong values
* [ ] **KMS TLS:** keep the KMS API on TLS (no plain HTTP); isolate the SSS (unseal shares) in air-gapped storage or an HSM
* [ ] **Audit retention:** set `ENVECTOR_AUDIT_RETENTION_DAYS` and enable S3 Object Lock (WORM, `COMPLIANCE` mode)
* [ ] **Restrict operational artifacts:** `chmod 600` on token/key/audit-export files, `chmod 700` on their directories

### License

* [ ] **Place the license token:** Put the `token.jwt` file in the Docker Compose execution directory
* [ ] Verify that the `ENVECTOR_LICENSE_TOKEN` path is correct


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.envector.io/1.5.x/operations-and-management/server-environment.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
