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

# Environment variables and migrate-on-boot

> Set the required Backtale environment variables, let one replica migrate on boot, and keep the encryption key backed up outside the host.

Backtale reads its settings from the environment. Compose, Helm, and the three Terraform packs set the same names. A release image is built with license enforcement on. You cannot turn that off at run time.

On a single replica, leave `BACKTALE_SKIP_MIGRATE` unset. The container entrypoint runs database migrations (`prisma migrate deploy`) before the server listens. Use one replica for the first install so that step is the only writer. Add replicas only after migrations have been applied once.

## Required at first boot

| Variable | What to set |
| - | - |
| `DATABASE_URL` | Postgres 15, 16, or 17 with `sslmode=require` when the database is not on the Compose network. URL-encode the password. |
| `DIRECT_URL` | The same URL, or the direct (non-pooled) host when `DATABASE_URL` goes through a transaction-mode pooler. Migrations need a non-pooled connection. |
| `TOKEN_ENCRYPTION_KEY` | `openssl rand -base64 32`. Back it up outside the host. |
| `APP_BASE_URL` | Public `https://` address people use, with no trailing slash. Required for Backtale accounts. |
| `AUTH_TRUSTED_PROXY_HOPS` | How many proxies sit in front. Use `1` behind Container Apps, App Service, App Runner, Cloud Run, or one TLS proxy. Count every hop if you add another front door. |
| `AUTH_SETUP_TOKEN` | At least 32 characters. Only while no admin exists. Remove it after setup. |
| `AUTH_MODE` | `profile` for the usual generated install. |
| `AUTH_PROFILE` | `local` for Backtale accounts. Or configure OIDC (`OIDC_ISSUER`, `OIDC_CLIENT_ID`, `OIDC_CLIENT_SECRET`) instead. |
| `NODE_ENV` | `production`. The image default is production. Do not set `development`. |

Compose builds `DATABASE_URL` from `POSTGRES_USER`, `POSTGRES_PASSWORD`, and `POSTGRES_DB` unless you point at an external database. The bundled database image is Postgres 17 with pgvector. Create the extension on Azure, AWS, and Google Cloud yourself (`CREATE EXTENSION IF NOT EXISTS vector;`). The Azure pack allow-lists `azure.extensions=VECTOR` for you.

## License and EULA

| Name | Notes |
| - | - |
| `backtale-license.json` | Load it in the product. Release images always enforce the license (`BACKTALE_LICENSE_REQUIRED=1` at build). |
| `LICENSE_ENFORCE` | Ignored on a customer release image. Enforcement stays on. |
| `EULA_FEED_URL` | Optional. Default `https://license.backtale.app/api/eula/current`. |
| `EULA_FEED_DISABLED` | Do not set `1` on a real install. That forces the copy baked into the image. |

## Do not set these on a customer install

| Variable | Why |
| - | - |
| `SEED_DEMO=true` | Demo fixtures only. |
| `BACKTALE_SKIP_MIGRATE=true` | Only after you run `backtale db migrate` as its own step, then on every long-running replica. |
| `AUTH_ALLOW_INSECURE_HTTP=true` | Evaluation only. |

Never put a cosign private key or a license signing key in the app environment.

## More than one replica

1. Run `backtale db migrate` once (a one-off container or the Helm migration job) with the same `DATABASE_URL` and `DIRECT_URL`.
2. Set `BACKTALE_SKIP_MIGRATE=true` on every app replica. If migrations are behind, the server refuses to start.
3. Every replica must share one `TOKEN_ENCRYPTION_KEY`.

## Health

| Probe | Path | Use |
| - | - | - |
| Liveness | `GET /api/health` | Restart a process that is not alive. |
| Readiness | `GET /api/health/ready` | Take a replica out of rotation. Do not restart because this fails. |

After a clean start, open [First run](https://docs.backtale.app/install/first-run.md).


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