Skip to content

Environment Variables Reference

Environment variables configure your Frappe Docker setup. They can be set directly in the container or defined in a .env file referenced by Docker Compose.

Getting Started:

bash
cp example.env .env

Then edit .env and set variables according to your needs.


Required Variables

VariablePurposeExampleNotes
FRAPPE_PATHFrappe framework pathhttps://github.com/frappe/frappe
FRAPPE_BRANCHFrappe Branchversion-15See Frappe releases
ERPNEXT_VERSIONERPNext release versionv15.67.0Required although its never used
DB_PASSWORDPassword for database root (MariaDB or Postgres)secure_password_123Not needed if using DB_PASSWORD_SECRETS_FILE

Database Configuration

VariablePurposeDefaultWhen to Set
DB_PASSWORDDatabase root user password123Always (unless using secrets file)
DB_PASSWORD_SECRETS_FILEPath to file containing database passwordSetup mariadb-secrets overrider
DB_HOSTDatabase hostname or IPdb (service name)Only if using external database
DB_PORTDatabase port3306 (MariaDB) / 5432 (Postgres)Only if using external database

Redis Configuration

VariablePurposeDefaultWhen to Set
REDIS_CACHERedis hostname for cachingredis-cache (service name)Only if using external Redis instance
REDIS_QUEUERedis hostname for job queues and real-time updatesredis-queue (service name)Only if using external Redis instance

Reverse Proxy and SSL (HTTPS) Configuration

Traefik (compose.proxy.yaml / compose.https.yaml)

VariablePurposeDefaultWhen to Set
LETSENCRYPT_EMAILEmail for Let's Encrypt certificate registration-Required for compose.https.yaml
SITES_RULEDomains for routing (Traefik rule expression)-Required for Traefik routing/HTTPS overrides

Format for SITES_RULE:

bash
# Single site
SITES_RULE=Host(`mysite.example.com`)

# Multiple sites
SITES_RULE=Host(`a.example.com`) || Host(`b.example.com`)

Note: The Traefik v3 migration is complete. Use SITES_RULE as a full v3 rule expression; SITES is deprecated. Rule syntax now defaults to v3, so no core.defaultRuleSyntax or per-router ruleSyntax settings are required.

nginx-proxy + acme-companion (compose.nginxproxy*.yaml)

VariablePurposeDefaultWhen to Set
LETSENCRYPT_EMAILEmail for Let's Encrypt certificate-Required for compose.nginxproxy-ssl.yaml
NGINX_PROXY_HOSTSComma-separated hostnames for nginx-proxy-Required for compose.nginxproxy*.yaml

Example:

bash
NGINX_PROXY_HOSTS=example.com,www.example.com

Note: Automatic certificates require port 80 to be reachable (HTTP-01).

Published Ports (Traefik and nginx-proxy)

VariablePurposeDefaultWhen to Set
HTTP_PUBLISH_PORTPublished HTTP port80 (proxy) / 8080 (noproxy)Change if port is in use
HTTPS_PUBLISH_PORTPublished HTTPS port443Change if port 443 is in use

Site Configuration

VariablePurposeDefaultWhen to Set
FRAPPE_SITE_NAME_HEADERSite name for multi-tenant setup$host (resolved from request hostname)When accessing by IP or need explicit site name

Examples:

If your site is named mysite but you want to access it via 127.0.0.1:

bash
FRAPPE_SITE_NAME_HEADER=mysite

If your site is named example.com and you access it via that domain, no need to set this (defaults to hostname).


Image Configuration

VariablePurposeDefaultNotes
CUSTOM_IMAGECustom Docker image repositoryFrappe official imageLeave empty to use default
CUSTOM_TAGCustom Docker image tagLatest stableCorresponds to FRAPPE_VERSION
PULL_POLICYImage pull behavioralwaysOptions: always, never, if-not-present
RESTART_POLICYContainer restart behaviorunless-stoppedOptions: no, always, unless-stopped, on-failure

Frontend Nginx Configuration (inside the frontend container)

VariablePurposeDefaultAllowed Values
BACKENDBackend service address and port0.0.0.0:8000{host}:{port}
SOCKETIOSocket.IO service address and port0.0.0.0:9000{host}:{port}
PROXY_READ_TIMEOUTUpstream request timeout120sAny nginx timeout value (e.g., 300s, 5m)
CLIENT_MAX_BODY_SIZEMaximum upload file size50mAny nginx size value (e.g., 100m, 1g)

Real IP Configuration (Behind Proxy)

Use these variables when running behind a reverse proxy or load balancer:

VariablePurposeDefault
UPSTREAM_REAL_IP_ADDRESSTrusted upstream IP address for real IP detection127.0.0.1
UPSTREAM_REAL_IP_HEADERRequest header containing client IPX-Forwarded-For
UPSTREAM_REAL_IP_RECURSIVEEnable recursive IP searchoff