Files
Bently c27bf0b975 docs: add deployment environment variables guide (#12122)
## Summary
Documents all environment variables that must be configured when
deploying AutoGPT to a new server or environment.

## Changes
- Added `docs/platform/deployment-environment-variables.md`: what to
change to run the Docker Compose stack on a server that people reach
from other machines, and why.
- Listed it in `docs/platform/SUMMARY.md`.
- Brought up to date with `dev` (merged, not rebased):
- Dropped the step that made Web Push (VAPID) keys by hand. `make
init-env` generates the pair since #16416, and the frontend fetches the
public key from the backend. Only `VAPID_CLAIM_EMAIL` is left to set.
The steps after it are renumbered.
- Added `TRUSTED_PROXIES` (#16522) to the proxy section and the
checklist, for a chain of proxies or one that adds to `X-Forwarded-For`.
- `TRUST_X_FORWARDED_FOR` also feeds the per-IP sign-in and
password-reset attempt limits, and the guide now says so.
- Added `BETTER_AUTH_INTERNAL_URL=http://localhost:3000`, found by
deploying the guide for real (see Testing). Without it, the frontend's
server fetches a signed-in visitor's token through the public hostname.
Sign-up then fails without an error whenever the container can't resolve
that name or trust its certificate.
- Said which lines have to be added because they aren't in the `.env`
files yet (`BACKEND_CORS_ALLOW_ORIGINS`, `BETTER_AUTH_INTERNAL_URL`).
- Gave the no-proxy API example its `/api` path
(`NEXT_PUBLIC_AGPT_SERVER_URL=http://<server>:8006/api`).

## What's Documented
- Which `.env` file each setting lives in, and which values the compose
files override
- What `make init-env` generates, and what breaks without each secret
- The public URLs to set, with `BETTER_AUTH_INTERNAL_URL` for the
frontend's calls to itself
- A TLS reverse proxy (Caddy example), the ports to close,
`TRUSTED_PROXY_COUNT`, `TRUST_X_FORWARDED_FOR` and `TRUSTED_PROXIES`
- Limiting sign-ups, and the mailer that email verification and password
reset need
- OAuth callback URLs for integrations and for social sign-in
- Using your own database or Redis
- A checklist

## Closes
- Closes #10961
- Closes OPEN-2715

## Testing
Documentation only, no code changes.
- Followed the guide from the top on a clean checkout on a LAN test
machine. Set only what it says, behind Caddy with TLS on two hostnames,
and used a browser on another machine.
- Sign-up, log-in, a server-rendered page while logged in, the builder,
and an agent run (completed, output shown) all work. Live updates
connect over `wss://`.
- The sign-in history records the visitor's real address, and a spoofed
`X-Forwarded-For` is dropped.
- Before `BETTER_AUTH_INTERNAL_URL` was added, sign-up failed
(`ENOTFOUND` on the public hostname inside the frontend container).
- `python -m unittest discover -s .github/workflows/scripts`: 101 tests
OK, including `test_docs_layout.py` (8).

<!-- greptile_comment -->

<details><summary><h3>Greptile Summary</h3></summary>

Adds comprehensive deployment environment variables guide documenting
all configuration settings required for deploying AutoGPT to new
environments. The guide includes a quick reference table of critical
URLs, security key generation commands, service configuration details,
OAuth provider setup, and a complete deployment checklist. Documentation
is well-organized with clear sections for URL configuration, security
keys, database setup, service dependencies, default ports, OAuth
callbacks, optional services, and Docker vs external services guidance.
</details>


<details><summary><h3>Confidence Score: 5/5</h3></summary>

- This PR is safe to merge with minimal risk
- Documentation-only PR with comprehensive and accurate environment
variable reference. Cross-verified all variables against actual
`.env.default` files, confirmed file structure matches codebase, and
validated all internal documentation links. Only one minor default value
discrepancy found.
- No files require special attention
</details>


<sub>Last reviewed commit: 8d557d3</sub>

<!-- greptile_other_comments_section -->

<!-- /greptile_comment -->
2026-11-09 12:14:42 +00:00
..