Overview
Bench uses several configuration files to manage its environment, sites, and services. Understanding these files helps you customize your bench setup and troubleshoot configuration issues.Configuration File Hierarchy
common_site_config.json
The main configuration file for the entire bench instance. Located atsites/common_site_config.json.
Structure
Configuration Options
Core Settings
Core Settings
frappe_user
- Type:
string - Default: Current user
- Description: System user that runs bench processes
- Type:
boolean - Default:
true - Description: Whether to serve a default site on the root domain
- Type:
boolean - Default:
true - Description: Use shallow git clones to save space (git 1.9+)
Web Server Settings
Web Server Settings
webserver_port
- Type:
integer - Default:
8000 - Description: Port for the development web server
- Type:
integer - Default:
9000 - Description: Port for Socket.IO server (real-time connections)
- Type:
integer - Default:
6787 - Description: Port for file watcher (auto-reload in development)
- Type:
integer - Default:
(CPU cores × 2) + 1 - Description: Number of Gunicorn worker processes in production
Redis Configuration
Redis Configuration
redis_cache
- Type:
string - Default:
redis://127.0.0.1:13000 - Description: Redis URL for caching layer
- Format:
redis://[host]:[port]/[db]
- Type:
string - Default:
redis://127.0.0.1:11000 - Description: Redis URL for background job queue
- Type:
string - Default:
redis://127.0.0.1:13000 - Description: Redis URL for Socket.IO pub/sub
- Type:
boolean - Default:
false - Description: Enable Redis authentication
Worker Settings
Worker Settings
background_workers
- Type:
integer - Default:
1 - Description: Number of background worker processes
- Type:
object - Description: Detailed worker configuration per queue
- Example:
Update and Deployment
Update and Deployment
restart_supervisor_on_update
- Type:
boolean - Default:
false - Description: Auto-restart Supervisor processes after
bench update
- Type:
boolean - Default:
false - Description: Auto-restart systemd services after
bench update
- Type:
boolean - Default:
false - Description: Enable automatic updates
- Type:
boolean - Default:
false - Description: Use rebase instead of merge when pulling updates
Development Settings
Development Settings
live_reload
- Type:
boolean - Default:
true - Description: Enable live reload during development
- Type:
boolean - Default:
false - Description: Enable developer mode features
Database Settings
Database Settings
db_host
- Type:
string - Default:
127.0.0.1(orlocalhost) - Description: MariaDB/MySQL host
- Type:
integer - Default:
3306 - Description: MariaDB/MySQL port
- Type:
string - Description: Database name (usually in site_config.json)
- Type:
string - Default:
mariadb - Options:
mariadb,postgres
Multi-tenancy
Multi-tenancy
dns_multitenant
- Type:
boolean - Default:
false - Description: Enable DNS-based multi-tenancy
- Type:
string - Description: Path to wildcard SSL certificate
- Type:
string - Description: Path to wildcard SSL certificate key
Example Configurations
Development:bench/config/common_site_config.py:6
site_config.json
Site-specific configuration file. Located atsites/[site-name]/site_config.json.
Structure
Configuration Options
Database Configuration
Database Configuration
db_name
- Type:
string - Description: Database name for this site
- Example:
site1_db
- Type:
string - Description: Database password
- Security: Keep this secure, don’t commit to version control
- Type:
string - Default:
mariadb - Options:
mariadb,postgres
Site Identity
Site Identity
host_name
- Type:
string - Description: Primary URL for the site
- Example:
https://example.com
- Type:
string - Description: Site name (usually matches folder name)
Security
Security
encryption_key
- Type:
string - Description: Key for encrypting sensitive data
- Security: Randomly generated, keep secure
- Type:
string - Description: Administrator password hash (set during creation)
Site Settings
Site Settings
developer_mode
- Type:
integer(0 or 1) - Default:
0 - Description: Enable developer mode for this site
- Type:
integer(0 or 1) - Default:
0 - Description: Enable maintenance mode (site inaccessible)
- Type:
boolean - Default:
false - Description: Disable website caching
Limits and Quotas
Limits and Quotas
limits
- Type:
object - Description: Resource limits for the site
- Example:
Site-Specific Overrides
Settings insite_config.json override those in common_site_config.json for that specific site.
Example:
Procfile
Defines processes for development mode. Located atProcfile in bench root.
Structure
Process Types
- Essential
- Workers
- Utilities
redis_cache
- Starts Redis instance for caching
- Config:
config/redis_cache.conf
- Starts Redis instance for job queue
- Config:
config/redis_queue.conf
- Starts development web server (Werkzeug)
- Default port: 8000
- Starts Socket.IO server for real-time features
- Uses Node.js
Customization
You can customize the Procfile by regenerating it:bench/config/procfile.py:11
supervisor.conf
Configuration for Supervisor process manager (production). Located atconfig/supervisor.conf.
Structure
Process Groups
Web Workers
frappe-bench-web
- Gunicorn web workers
- Handles HTTP requests
- Number of workers:
(CPU cores × 2) + 1
Background Workers
frappe-bench-workers
- Short, long, and default queue workers
- Process background jobs
- Each queue has separate workers
Generated Configuration
This file is auto-generated by:--user- User to run processes as--yes- Skip confirmation--skip-redis- Skip Redis configuration
bench/config/supervisor.py
nginx.conf
NGINX configuration for production web server. Located atconfig/nginx.conf.
Structure
Key Sections
Upstream Definition
Upstream Definition
Defines backend Gunicorn server:
Static Assets
Static Assets
Serves compiled static files directly:
Protected Files
Protected Files
Handles X-Accel-Redirect for file downloads:
Socket.IO Proxy
Socket.IO Proxy
Proxies WebSocket connections:
Application Proxy
Application Proxy
Proxies requests to Gunicorn:
SSL Configuration
With SSL enabled:Generated Configuration
Generate NGINX config:--yes- Skip confirmation--logging- Logging type:none,site, orcombined
bench/config/nginx.py
Redis Configuration Files
redis_cache.conf
Redis configuration for caching. Located atconfig/redis_cache.conf.
redis_queue.conf
Redis configuration for job queue. Located atconfig/redis_queue.conf.
Key Differences
| Setting | redis_cache | redis_queue |
|---|---|---|
| Port | 13000 | 11000 |
| Persistence | None (save "") | AOF enabled |
| Purpose | Volatile cache | Durable queue |
bench/config/redis.py
Supporting Files
apps.txt
List of installed apps in order. Located atsites/apps.txt.
currentsite.txt
Default site for CLI commands. Located atsites/currentsite.txt.
bench console use this site if --site is not specified.
patches.txt
Tracks applied patches. Located atpatches.txt in bench root.
This file is managed by Frappe’s migration system. Don’t edit it manually.
Configuration Management
Viewing Configuration
Updating Configuration
Via bench commands:Regenerating Configs
Configuration Best Practices
Version Control
Version Control
Do commit:
common_site_config.json(with sensitive values removed)Procfile- Custom configuration templates
site_config.json(contains passwords)- Generated
nginx.conf,supervisor.conf - Redis dump files
Security
Security
- Use strong, random encryption keys
- Enable Redis authentication in production
- Use HTTPS in production
- Restrict file permissions:
Performance
Performance
- Adjust
gunicorn_workersbased on traffic - Configure appropriate
background_workers - Use Redis auth only if needed (slight overhead)
- Enable
live_reloadonly in development
Maintenance
Maintenance
- Document custom configuration changes
- Regenerate configs after bench updates
- Backup configuration files before changes
- Test configuration changes in staging first
Troubleshooting
Configuration Not Applied
- Verify file syntax (valid JSON/INI/NGINX)
- Restart services:
- Check file permissions
- Review logs for errors
Config File Conflicts
Site config overrides bench config. Check both:Regeneration Issues
If regenerating configs fails:Related Resources
Environment Variables
Environment variables used by bench
Architecture
How bench components work together
Production Setup
Setting up production environment
All Commands
Complete command reference