Skip to main content

Environment Configuration

The project utilizes a .env file at the root to orchestrate configuration for the Frappe/ERPNext Docker containers. Below is the comprehensive list of variables you can set.

tip

Tip: You can use the .env.example in the root directory as a template for your environment.

1. Image & Version Settings

  • ERPNEXT_VERSION: The specific version of ERPNext to use (e.g., version-16).
  • FRAPPE_VERSION: The specific version of the Frappe framework (e.g., version-16).
  • CUSTOM_IMAGE: Name of the custom Docker image (e.g., custom-frappe).
  • CUSTOM_TAG: Tag of the image (e.g., v16).
  • PULL_POLICY: When to pull the image (always, missing, never, if_not_present). Use never or if_not_present for local tar loads.
  • RESTART_POLICY: Docker restart policy (e.g., unless-stopped).

2. Database Settings

  • DB_HOST: Hostname of the MariaDB container (db).
  • DB_PORT: Port of the MariaDB container (3306).
  • DB_PASSWORD: Plaintext Database Password (not recommended for production).
  • DB_PASSWORD_SECRETS_FILE: Path to the secrets text file containing your database password (./secrets/db_password.txt).

3. Redis Settings

  • REDIS_CACHE: Hostname and port for the Redis Cache container (redis-cache:6379).
  • REDIS_QUEUE: Hostname and port for the Redis Queue container (redis-queue:6379).

4. Backend Performance (Gunicorn)

  • GUNICORN_THREADS: Number of threads per Gunicorn worker process handling concurrent requests (Tune based on CPU).
  • GUNICORN_WORKERS: Number of Gunicorn worker processes. A typical formula is (2 x number of CPU cores) + 1.
  • GUNICORN_TIMEOUT: Timeout (in seconds) before Gunicorn kills a slow worker request (e.g., 120).

5. Frontend & Reverse Proxy (Nginx)

  • FRAPPE_SITE_NAME_HEADER: HTTP header to resolve multi-tenant site name. Defaults to $$host.
  • HTTP_PUBLISH_PORT: Nginx HTTP port (80).
  • HTTPS_PUBLISH_PORT: Nginx HTTPS port (443).
  • CLIENT_MAX_BODY_SIZE: Max file upload size (e.g., 50m).
  • PROXY_READ_TIMEOUT: Max execution time for long HTTP requests (e.g., 120).

6. Proxy / Upstream IP Forwarding

Required for reverse proxies like Cloudflare or AWS ALB to log actual client IPs.

  • UPSTREAM_REAL_IP_ADDRESS: Trusted upstream IP address (0.0.0.0/0).
  • UPSTREAM_REAL_IP_HEADER: Request header field with the client IP (X-Forwarded-For).
  • UPSTREAM_REAL_IP_RECURSIVE: Enable recursive search for trusted IPs (on).

7. Ingress / Traefik / SSL

  • LETSENCRYPT_EMAIL: Email for Let's Encrypt certificates.
  • SITES_RULE: Traefik routing rule (e.g., Host(\frappe.example.org`)`).
  • NGINX_PROXY_HOSTS: Nginx routing hosts (e.g., frappe.example.org).