Skip to main content

Frappe Framework Version 15 Bench Setup: Complete Installation and Configuration Guide

Bench serves as the command-line backbone for managing Frappe Framework v15 applications and sites, providing developers with comprehensive tools for project initialization, development server management, and application lifecycle control.​

Understanding Bench CLI Architecture

Core Functionality Overview

Bench CLI functions as the central management tool for Frappe Framework v15 development environments, orchestrating complex multi-process applications through simplified command interfaces. The tool handles Python virtual environments, database management, static asset compilation, and background process coordination.​

Installation Prerequisites Verification

Before proceeding with bench setup, verify that all Frappe Framework v15 prerequisites are properly installed and configured.

bash
# Verify Python installation (3.10+ required)
python3 --version
# Verify Node.js installation (18+ required for v15)
node --version
# Verify MariaDB/MySQL service status
systemctl status mariadb
# Verify Redis service availability
redis-cli ping

Bench CLI Installation Process

Standard Installation Method

Install Frappe Bench CLI using pip with proper system configuration for Version 15 compatibility.​

bash
# Install bench CLI tool
pip install frappe-bench
# Verify installation success
bench --version
# Expected output: 5.1.0 or higher

Alternative Installation Methods

Managing Externally-Managed Environment

For systems with externally-managed Python environments, use the break-system-packages flag.​

bash
# Install with system package override
pip install frappe-bench --break-system-packages
# Verify PATH configuration
which bench

UV Package Manager Method

Use UV package manager for isolated bench installation without system modifications.

bash
# Install UV package manager
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create shell alias for bench
echo "alias bench='uvx --from frappe-bench bench'" >> ~/.bashrc
source ~/.bashrc
# Test bench availability
bench --version

PATH Configuration and Environment Setup

Ensure bench command accessibility across terminal sessions:​

bash
# Add bench to system PATH if required
echo "export PATH=/path/to/bin:$PATH" >> ~/.profile
source ~/.profile
# Reload shell configuration
source ~/.bashrc

Creating Frappe Bench Environment

Initialize Frappe v15 Bench Directory

Create the foundational project structure for Frappe Framework v15 development:​

bash
# Navigate to desired parent directory
cd ~
# Initialize bench with Frappe v15 specifically
bench init --frappe-branch version-15 frappe-bench
# Navigate to created bench directory
cd frappe-bench/
# Verify successful initialization
ls -la

Initialization Process Breakdown

The bench init command performs several critical setup operations for Version 15 environments​.

Automated Setup Tasks:

  • Python Virtual Environment: Creates isolated Python environment under env/ directory
  • Frappe Framework Installation: Fetches and installs Frappe v15 as Python package
  • Node.js Dependencies: Installs required Node modules for JavaScript functionality
  • Static Asset Building: Compiles CSS, JavaScript, and other frontend resources
  • Configuration Generation: Creates Redis, process, and site configuration files

Bench Directory Structure Analysis

Core Directory Layout

Understanding the bench directory structure enables effective development and troubleshooting:​

text
frappe-bench/
├── Procfile # Development process definitions
├── apps/ # Application directory
│ └── frappe/ # Core Frappe framework application
├── config/ # Configuration files
│ ├── pids/ # Process ID files
│ ├── redis_cache.conf # Redis caching configuration
│ ├── redis_queue.conf # Redis job queue configuration
│ └── redis_socketio.conf # Redis real-time configuration
├── env/ # Python virtual environment
│ ├── bin/ # Executable binaries
│ ├── include/ # Header files
│ ├── lib/ # Python libraries
│ └── share/ # Shared resources
├── logs/ # Process log files
│ ├── backup.log # Backup operation logs
│ └── bench.log # General bench operation logs
└── sites/ # Sites and assets
├── apps.txt # Installed application list
├── assets/ # Static assets for production
└── common_site_config.json # Global site configuration

Critical Directory Functions

Applications Directory (apps/)

The apps/ directory contains all Frappe applications including the core framework and custom applications. Each application maintains its own subdirectory with source code, configuration, and assets.​​

Application Structure Example:

text
apps/
├── frappe/ # Core framework
└── library_management/ # Custom application
├── library_management/ # Source code module
├── setup.py # Installation configuration
└── requirements.txt # Python dependencies

Virtual Environment (env/)

The env/ directory provides an isolated Python environment preventing package conflicts and ensuring consistent dependency management across development and production environments.​

Configuration Directory (config/)

Contains Redis configuration files for different services essential to Frappe v15 functionality:​

  • redis_cache.conf: Caching layer configuration for improved performance
  • redis_queue.conf: Background job queue management
  • redis_socketio.conf: Real-time communication and notifications

Development Server Management

Starting Development Environment

Launch the complete Frappe v15 development stack with comprehensive process monitoring:​

bash
# Navigate to bench directory
cd frappe-bench/
# Start all development processes
bench start

Process Architecture Overview

The bench start command initiates multiple interconnected processes essential for Frappe v15 functionality.​

Core Processes:

  • redis_cache: Caching layer (port 13000)
  • redis_socketio: Real-time communication (port 12000)
  • redis_queue: Background job processing (port 11000)
  • socketio: Real-time server (port 9000)
  • web: Python web server via Gunicorn (port 8000)
  • watch: Asset compilation and monitoring
  • schedule: Scheduled task execution
  • worker_short: Quick background jobs
  • worker_long: Extended background processes
  • worker_default: General background processing

Process Output Analysis

Understanding process startup output enables effective debugging and monitoring:​

bash
18:16:36 system | redis_cache.1 started (pid=11231)
18:16:36 system | redis_socketio.1 started (pid=11233)
18:16:36 system | redis_queue.1 started (pid=11234)
18:16:36 system | socketio.1 started (pid=11236)
18:16:36 system | web.1 started (pid=11237)
18:16:36 system | watch.1 started (pid=11240)

Critical Process Indicators:

  • PID Assignment: Each process receives unique identifier for monitoring
  • Redis Initialization: Database systems start with configuration loading
  • Asset Compilation: JavaScript and CSS building begins automatically
  • Web Server Readiness: HTTP server becomes available on port 8000

Development Workflow Optimization

Multi-Terminal Development Setup

Effective Frappe v15 development requires multiple terminal sessions for optimal workflow management.

Terminal Session Organization:

  1. Primary Terminal: Run bench start and monitor process output
  2. Command Terminal: Execute bench commands for development tasks
  3. Editor Terminal: Navigate source code and file operations
  4. Database Terminal: Database queries and administration

Essential Development Commands

Master fundamental bench commands for efficient Frappe v15 development:​

bash
# Navigate to bench directory for all commands
cd frappe-bench/
# Create new applications
bench new-app library_management
# Create development sites
bench new-site library.test
# Install applications on sites
bench --site library.test install-app library_management
# Set default site for convenience
bench use library.test
# Clear cache after code changes
bench clear-cache
# Restart processes after configuration changes
bench restart

Site Management and Configuration

Site Creation Process

Sites represent individual instances within a Frappe bench environment, enabling multiple applications and configurations:​

bash
# Create new site with custom database
bench new-site mysite.local
# Create site with specific database configuration
bench new-site mysite.local --mariadb-root-password yourpassword
# Verify site creation
bench --site mysite.local show-config

Site Directory Structure

Each site maintains its own configuration, database, and file storage:​

text
sites/
├── mysite.local/
│ ├── private/ # Private files and backups
│ ├── public/ # Public web-accessible files
│ └── site_config.json # Site-specific configuration
├── apps.txt # Global app installation list
├── assets/ # Compiled static assets
└── common_site_config.json # Shared configuration

Production Preparation Considerations

Security and Permission Configuration

Prepare development environments for production deployment with proper permissions:​

bash
# Set proper user permissions
chmod -R o+rx /home/frappe/
# Enable site scheduler for background tasks
bench --site mysite.local enable-scheduler
# Configure production-ready settings
bench --site mysite.local set-maintenance-mode off

Performance Optimization Settings

Configure bench environment for optimal performance in development and production scenarios:

bash
# Enable developer mode for rapid development
bench set-config -g developer_mode true
# Configure database optimization
bench --site mysite.local set-config db_timeout 300
# Set up SSL for production readiness
bench setup lets-encrypt mysite.local

Troubleshooting Common Issues

Installation and Setup Problems

Permission Errors

Resolve common permission issues during bench installation and operation:

bash
# Fix permission denied errors
sudo chown -R $USER:$USER frappe-bench/
# Resolve PATH configuration issues
export PATH=$HOME/.local/bin:$PATH
# Fix virtual environment activation
source frappe-bench/env/bin/activate

Process Management Issues

Address process startup failures and port conflicts:

bash
# Check port availability
netstat -tlnp | grep :8000
# Kill existing processes if needed
pkill -f "frappe"
# Restart with clean state
bench restart

Asset Compilation Problems

Resolve JavaScript and CSS compilation issues:

bash
# Clear and rebuild assets
bench clear-cache
bench build
# Update Node.js dependencies
cd apps/frappe && yarn install
# Force asset rebuild
bench build --force

Advanced Configuration and Customization

Multi-Version Environment Management

Manage multiple Frappe versions simultaneously for development flexibility:

bash
# Create version-specific bench directories
bench init frappe-v14-bench --frappe-branch version-14
bench init frappe-v15-bench --frappe-branch version-15
# Switch between environments as needed
cd frappe-v15-bench/ && bench start

Custom Configuration Files

Customize bench behavior through configuration file modifications:

json
// common_site_config.json example
{
"db_host": "localhost",
"redis_cache": "redis://localhost:13000",
"redis_queue": "redis://localhost:11000",
"redis_socketio": "redis://localhost:12000",
"developer_mode": 1,
"file_watcher_port": 6787
}

Community Resources and Next Steps

Enhanced Learning Path

Continue your Frappe Framework v15 journey through GoERPNext platform resources :​

  • Comprehensive Documentation: Access enhanced installation guides and troubleshooting
  • Community Forum: Connect with developers experiencing similar setup challenges
  • Best Practices: Learn optimization techniques from community experience
  • Advanced Configuration: Explore production deployment strategies

Development Environment Enhancement

Expand your bench setup with additional tools and configurations:

  • IDE Integration: Configure development environments for optimal coding experience
  • Database Administration: Set up database management tools and monitoring
  • Version Control: Integrate Git workflows with bench-managed applications
  • Testing Frameworks: Implement automated testing in development workflows

This comprehensive bench setup guide provides the foundation for effective Frappe Framework Version 15 development, ensuring developers can efficiently manage applications, sites, and development processes while maintaining best practices for scalability and production readiness.

Click to rate this post!
[Total: 0 Average: 0]