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

# Configuration

> Copy .env.template to .env and fill in the required values.

<Steps>
  <Step title="Copy the template">
    ```sh theme={"system"}
    cp .env.template .env
    ```
  </Step>

  <Step title="Fill in the required values">
    Open `.env` and set every variable marked `# Required` below. Everything
    else has a sensible default and can be left as-is to start.
  </Step>
</Steps>

<Warning>
  Never commit `.env`, and never paste real values from it into a shared
  document, ticket, or chat. It holds live secrets for your deployment.
</Warning>

## Required values

| Variable                                                        | What it is                                                                                                                                                                                                                                       |
| --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `RELAI_BACKEND_SERVICE_VERSION` / `RELAI_DASHBOARD_VERSION`     | The exact backend and dashboard image versions to deploy. RELAI will tell you which versions to use — don't guess, and don't use `latest`. See [Upgrading](/upgrading) for how to move to a new version later.                                   |
| `DB_PASSWORD`                                                   | Password for the MySQL user and root account. Choose a strong value.                                                                                                                                                                             |
| `OPENAI_API_KEY`                                                | Your OpenAI API key, used to power the continual learning engine. This is the default provider — see [Choosing an LLM provider](/llm-providers) if you'd rather use Azure OpenAI, AWS Bedrock, Anthropic, or another supported provider instead. |
| `SECRET_KEY`                                                    | Django's cryptographic signing key. Generate one: `openssl rand -hex 32`                                                                                                                                                                         |
| `SUPERUSER_EMAIL` / `SUPERUSER_USERNAME` / `SUPERUSER_PASSWORD` | Credentials for the admin account that's bootstrapped on first startup.                                                                                                                                                                          |
| `ADMIN_DASHBOARD_URL_HASH`                                      | A random path segment that obscures the Django Admin URL. Generate one: `openssl rand -hex 16`                                                                                                                                                   |
| `ON_PREM_ORGANIZATION_ID`                                       | A stable identifier for your organization. A UUID works well: `uuidgen`                                                                                                                                                                          |

## Other settings you can leave at their defaults

`.env.template` groups the rest of the variables by area — adjust them if
you need to, otherwise the defaults are fine for a first deployment:

* **Database / Redis** — connection details for the bundled `db` and
  `redis` containers (`DB_NAME`, `DB_USER`, `DB_HOST`, `DB_PORT`,
  `REDIS_HOST`, `REDIS_PORT`).
* **Backend local storage** — where uploaded media and chat data are stored
  inside the container (`LOCAL_STORAGE_ROOT`, `MEDIA_ROOT`,
  `CHATS_BACKEND`, `CHATS_LOCAL_DIR`).
* **On-prem organization bootstrap** — `ON_PREM_ORGANIZATION_NAME`, the
  organization name your users will see.
* **Usage ingestion / feature flags** — optional integrations
  (`RELAI_USAGE_INGEST_URL`, `RELAI_USAGE_INGEST_TOKEN`, `SEND_TO_RELAI`,
  `RELAI_ENABLE_TRACING`, `RELAI_STORE_SFT_SAMPLES`,
  `RELAI_ENABLE_FINETUNING`). Leave these off unless RELAI has instructed
  you to turn them on.
* **Backend server tuning** — `ONPREM_WEB_WORKERS` (Uvicorn worker count),
  `UVICORN_LOG_LEVEL`.
* **Dashboard** — `SERVER_BASE_URL`, the URL the dashboard uses to reach the
  backend. Update this if you put a reverse proxy or a different hostname
  in front of the backend.
* **Docker Hub credentials** — `DOCKER_HUB_USERNAME`, `DOCKER_HUB_TOKEN`,
  see [Pulling the images](/pulling-the-images).
