Skip to content
193 changes: 175 additions & 18 deletions docs/setup/environment-vars.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ title: Environment Variables
sidebarTitle: Environment Variables
---

Most of the MindsDB functionality can be modified by extending the default configuration, but some of the configuration options
Most of the MindsDB functionality can be modified by extending the default configuration, but some of the configuration options
can be added as environment variables on the server where MindsDB is deployed.
[Here is the list](/setup/full-list-environment-vars) of all the available environment variables.

## MindsDB Authentication

Expand All @@ -21,6 +22,7 @@ MindsDB does not require authentication by default. If you want to enable authen
export MINDSDB_USERNAME='mindsdb_user'
export MINDSDB_PASSWORD='mindsdb_password'
```

</CodeGroup>

## MindsDB Configuration File
Expand All @@ -37,18 +39,19 @@ In order to start MindsDB with a [custom configuration file](/setup/custom-confi
```bash Shell
export MINDSDB_CONFIG_PATH=/Users/username/path/config.json
```

</CodeGroup>

## MindsDB Storage
## MindsDB Storage

By default, MindsDB stores the configuration files by determining appropriate platform-specific directories, e.g. a "user data dir":
By default, MindsDB stores the configuration files by determining appropriate platform-specific directories, e.g. a "user data dir":

* On Linux `~/.local/share/mindsdb/var`
* On MacOS `~/Library/Application Support/mindsdb/var`
* On Windows `C:\Documents and Settings\<User>\Application Data\Local Settings\<AppAuthor>\mindsdb\var`
- On Linux `~/.local/share/mindsdb/var`
- On MacOS `~/Library/Application Support/mindsdb/var`
- On Windows `C:\Documents and Settings\<User>\Application Data\Local Settings\<AppAuthor>\mindsdb\var`

In the `MINDSDB_STORAGE_DIR` location, MindsDB stores users' data, models and uploaded data files, the static assets for the frontend application and the
`sqlite.db` file.
In the `MINDSDB_STORAGE_DIR` location, MindsDB stores users' data, models and uploaded data files, the static assets for the frontend application and the
`sqlite.db` file.
You can change the default storage location using `MINDSDB_STORAGE_DIR` variable.

### Example
Expand All @@ -61,26 +64,31 @@ You can change the default storage location using `MINDSDB_STORAGE_DIR` variable
```bash Shell
export MINDSDB_STORAGE_DIR='~/home/mindsdb/var'
```

</CodeGroup>

## MindsDB Configuration Storage
## MindsDB Configuration Storage

MindsDB uses `sqlite` database by default to store the required configuration as models, projects, files metadata etc.
The full list of the above schemas can be found [here](https://github.com/mindsdb/mindsdb/blob/main/mindsdb/interfaces/storage/db.py#L69). You can change the
MindsDB uses `sqlite` database by default to store the required configuration as models, projects, files metadata etc.
The full list of the above schemas can be found [here](https://github.com/mindsdb/mindsdb/blob/main/mindsdb/interfaces/storage/db.py#L69). You can change the
default storage option and use different database by adding the new connection string using `MINDSDB_DB_CON` variable.

### Example

<CodeGroup>
```bash Docker
docker run --name mindsdb_container -e MINDSDB_DB_CON='postgresql://user:secret@localhost' -e MINDSDB_APIS=http,mysql -p 47334:47334 -p 47335:47335 mindsdb/mindsdb
```

```bash Shell
export MINDSDB_DB_CON='postgresql://user:secret@localhost'
```
```bash Docker docker run --name mindsdb_container -e
MINDSDB_DB_CON='postgresql://user:secret@localhost' -e MINDSDB_APIS=http,mysql
-p 47334:47334 -p 47335:47335 mindsdb/mindsdb ``` ```bash Shell export
MINDSDB_DB_CON='postgresql://user:secret@localhost' ```
</CodeGroup>

#### `MINDSDB_STORAGE_BACKUP_DISABLED`

- **Type:** Boolean (`1`, `true`, `True`)
- **Description:** Disables permanent storage backup
- **Default:** `false`
- **Example:** `MINDSDB_STORAGE_BACKUP_DISABLED=1`

## MindsDB APIs

The `MINDSDB_APIS` environment variable lets users define which APIs to start. Learn more about the [available APIs here](/setup/mindsdb-apis).
Expand All @@ -95,6 +103,7 @@ The `MINDSDB_APIS` environment variable lets users define which APIs to start. L
```bash Shell
export MINDSDB_APIS='http,mysql'
```

</CodeGroup>

## MindsDB Logs
Expand All @@ -111,8 +120,23 @@ This environment variable defines the level of logging generated by MindsDB. You
```bash Shell
export MINDSDB_LOG_LEVEL='DEBUG'
```

</CodeGroup>

#### `MINDSDB_CONSOLE_LOG_LEVEL`

- **Type:** String (`DEBUG`, `INFO`, `WARNING`, `ERROR`)
- **Description:** Sets console log level
- **Default:** `INFO`
- **Example:** `MINDSDB_CONSOLE_LOG_LEVEL=DEBUG`

#### `MINDSDB_FILE_LOG_LEVEL`

- **Type:** String (`DEBUG`, `INFO`, `WARNING`, `ERROR`)
- **Description:** Sets file log level and enables file logging
- **Default:** `INFO` (disabled by default)
- **Example:** `MINDSDB_FILE_LOG_LEVEL=DEBUG`

## MindsDB Default Project

By default, MindsDB creates a project named `mindsdb` where all the models and other objects are stored. You can change the default project name by setting the `MINDSDB_DEFAULT_PROJECT` environment variable.
Expand All @@ -129,8 +153,30 @@ If this environment variable is set or modified after MindsDB has started, the d
```bash Shell
export MINDSDB_DEFAULT_PROJECT='my_project'
```

</CodeGroup>

#### `MINDSDB_DEFAULT_LLM_API_KEY`

- **Type:** String
- **Description:** API key for default LLM (Large Language Model)
- **Default:** None
- **Example:** `MINDSDB_DEFAULT_LLM_API_KEY=sk-...`

#### `MINDSDB_DEFAULT_EMBEDDING_MODEL_API_KEY`

- **Type:** String
- **Description:** API key for default embedding model
- **Default:** None
- **Example:** `MINDSDB_DEFAULT_EMBEDDING_MODEL_API_KEY=sk-...`

#### `MINDSDB_DEFAULT_RERANKING_MODEL_API_KEY`

- **Type:** String
- **Description:** API key for default reranking model
- **Default:** None
- **Example:** `MINDSDB_DEFAULT_RERANKING_MODEL_API_KEY=sk-...`

## MindsDB's PID File

When running MindsDB via [Docker](/setup/self-hosted/docker) or [Docker Extension](/setup/self-hosted/docker-desktop), the PID file is not used by default. Users can opt for enabling the PID file by defining the `USE_PIDFILE` environment variable.
Expand All @@ -147,6 +193,7 @@ If used, the PID file is stored in the temp directory (`$TMPDIR` on MacOS and Li
```bash Shell
export USE_PIDFILE=1
```

</CodeGroup>

## MindsDB GUI Updates
Expand All @@ -165,6 +212,7 @@ By default, the automatic GUI updates are enabled and the `MINDSDB_GUI_AUTOUPDAT
```bash Shell
export MINDSDB_GUI_AUTOUPDATE=false
```

</CodeGroup>

## MindsDB GUI Startup and Updates
Expand All @@ -185,4 +233,113 @@ Note that the `MINDSDB_NO_STUDIO` is not recommended for the MindsDB instance ru
```bash Shell
export MINDSDB_NO_STUDIO=true
```

</CodeGroup>

### ML Task Queue

#### `MINDSDB_ML_QUEUE_TYPE`

- **Type:** String (`local`, `redis`)
- **Description:** Type of ML task queue to use
- **Default:** `local`
- **Example:** `MINDSDB_ML_QUEUE_TYPE=redis`

#### `MINDSDB_ML_QUEUE_HOST`

- **Type:** String (hostname)
- **Description:** Redis host for ML task queue (only when `MINDSDB_ML_QUEUE_TYPE=redis`)
- **Default:** `localhost`
- **Example:** `MINDSDB_ML_QUEUE_HOST=redis.example.com`

#### `MINDSDB_ML_QUEUE_PORT`

- **Type:** Integer
- **Description:** Redis port for ML task queue
- **Default:** `6379`
- **Example:** `MINDSDB_ML_QUEUE_PORT=6380`

#### `MINDSDB_ML_QUEUE_DB`

- **Type:** Integer
- **Description:** Redis database number for ML task queue
- **Default:** `0`
- **Example:** `MINDSDB_ML_QUEUE_DB=1`

#### `MINDSDB_ML_QUEUE_USERNAME`

- **Type:** String
- **Description:** Redis username for ML task queue
- **Default:** None
- **Example:** `MINDSDB_ML_QUEUE_USERNAME=redis_user`

#### `MINDSDB_ML_QUEUE_PASSWORD`

- **Type:** String
- **Description:** Redis password for ML task queue
- **Default:** None
- **Example:** `MINDSDB_ML_QUEUE_PASSWORD=redis_pass`

## Reranker Configuration

#### `MINDSDB_RERANKER_N`

- **Type:** Integer
- **Description:** Number of results to rerank
- **Default:** None
- **Example:** `MINDSDB_RERANKER_N=10`

#### `MINDSDB_RERANKER_LOGPROBS`

- **Type:** Boolean (`true`, `false`, `1`, `0`, `yes`, `no`)
- **Description:** Enable log probabilities in reranker
- **Default:** None
- **Example:** `MINDSDB_RERANKER_LOGPROBS=true`

#### `MINDSDB_RERANKER_TOP_LOGPROBS`

- **Type:** Integer
- **Description:** Number of top log probabilities to return
- **Default:** None
- **Example:** `MINDSDB_RERANKER_TOP_LOGPROBS=5`

#### `MINDSDB_RERANKER_MAX_TOKENS`

- **Type:** Integer
- **Description:** Maximum tokens for reranker
- **Default:** None
- **Example:** `MINDSDB_RERANKER_MAX_TOKENS=512`

#### `MINDSDB_RERANKER_VALID_CLASS_TOKENS`

- **Type:** String (comma-separated list)
- **Description:** Valid class tokens for reranker
- **Default:** None
- **Example:** `MINDSDB_RERANKER_VALID_CLASS_TOKENS=token1,token2,token3`

## Features

#### `MINDSDB_DATA_CATALOG_ENABLED`

- **Type:** Boolean (`1`, `true`)
- **Description:** Enables the data catalog feature
- **Default:** `false`
- **Example:** `MINDSDB_DATA_CATALOG_ENABLED=1`

## Runtime

#### `MINDSDB_DOCKER_ENV`

- **Type:** Any value (presence check)
- **Description:** Indicates MindsDB is running in Docker environment (changes default API host to `0.0.0.0`)
- **Default:** Not set
- **Example:** `MINDSDB_DOCKER_ENV=1`

#### `MINDSDB_RUNTIME`

- **Type:** String (`1`)
- **Description:** Indicates MindsDB runtime environment
- **Default:** Not set
- **Example:** `MINDSDB_RUNTIME=1`

---
Loading