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

# Configuration

> Configure Celery Root components, storage, metrics, and the UI.

## Configuration model

Celery Root is configured with Pydantic models. Components are enabled when their config is provided (set to `None` to disable).

```python theme={null}
from pathlib import Path

from celery_root import (
    BeatConfig,
    CeleryRootConfig,
    DatabaseConfigSqlite,
    FrontendConfig,
    LoggingConfigFile,
    OpenTelemetryConfig,
    PrometheusConfig,
)

config = CeleryRootConfig(
    logging=LoggingConfigFile(log_dir=Path("./logs")),
    database=DatabaseConfigSqlite(db_path=Path("./celery_root.db")),
    beat=BeatConfig(),
    prometheus=PrometheusConfig(port=8001, prometheus_path="/metrics"),
    open_telemetry=OpenTelemetryConfig(endpoint="http://localhost:4317"),
    frontend=FrontendConfig(host="127.0.0.1", port=8000),
)
```

### Worker import paths

Celery Root needs import paths to your Celery apps:

```bash theme={null}
export CELERY_ROOT_WORKERS="your_app.celery:app,another_app.celery:app"
```

Worker import paths are resolved in this order:

* `config.worker_import_paths`
* `CELERY_ROOT_WORKERS`
* Paths derived from the Celery apps you pass in

### Database settings (SQLite)

`DatabaseConfigSqlite` controls the local store:

* `db_path`: SQLite file path.
* `retention_days`: Record retention window (cleanup runs periodically).
* `batch_size`: Max events per flush.
* `flush_interval`: Seconds between flushes.
* `purge_db`: Delete the file on startup.

### Logging settings

`LoggingConfigFile` controls log output:

* `log_dir`: Directory for log files.
* `log_rotation_hours`: File rotation interval.
* `log_level`: Log level string.
* `delete_on_boot`: Delete logs on startup.

### Frontend settings

`FrontendConfig` controls the UI server:

* `host`, `port`, `debug`, `poll_interval`.
* `secret_key`: Django secret key.
* `basic_auth`: Basic auth users (see Auth guide).
* OAuth fields: `auth_provider`, `auth`, `oauth2_key`, `oauth2_secret`, `oauth2_redirect_uri`.
* GitLab/Okta fields: `oauth2_okta_base_url`, `gitlab_allowed_groups`, `gitlab_min_access_level`, `gitlab_oauth_domain`.

### Metrics settings

* `PrometheusConfig`: port, path, and Flower metric naming compatibility.
* `OpenTelemetryConfig`: OTLP endpoint and service name.

### MCP settings

`McpConfig` enables the MCP server. See the MCP guide for details.

### Beat settings

`BeatConfig` enables the DB-backed beat scheduler. It reuses the Celery Root database and sets `beat_db_refresh_seconds` on your Celery apps when provided. One beat process runs per worker import path.

## Overriding settings early

If you need settings applied before Django loads:

```python theme={null}
from celery_root.config import set_settings

set_settings(config)
```
