bench-commands
Bench Commands
Overview
This skill provides comprehensive guidance for using the Frappe bench command-line interface in development environments, covering all aspects from site creation to production backup restoration.
Environment Constants
When working with bench commands, use these standard development environment values:
- Site Name:
development.localhost - Database Root Password:
123 - Admin Password:
admin - Bench Path:
/workspace/development/frappe-bench
All commands assume execution from the bench directory unless otherwise specified.
Command Categories
Commands are organized by functional area. See the corresponding reference file for detailed information:
Site Management
See references/site-management.md for:
- Creating new sites
- Dropping sites (with automatic backup)
- Reinstalling sites
- Site configuration
App Management
See references/app-management.md for:
- Installing apps to sites
- Uninstalling apps from sites
- Getting apps from repositories
- Managing multiple apps
App Development
See references/app-development.md for:
- Creating new Frappe apps
- Managing app remotes
- Branch switching and management
- Dependency validation
- App development workflows
Backup and Restore
See references/backup-restore.md for:
- Creating full or database-only backups
- Restoring from production backups
- Handling encryption keys
- Backup file management
Database Operations
See references/database-operations.md for:
- Running migrations
- Executing specific patches
- Accessing database consoles
- MariaDB runtime configuration (memory limits, packet sizes)
- Performance tuning for large operations
Database Maintenance
See references/database-maintenance.md for:
- Removing deleted DocType tables and columns
- Table analysis and statistics
- Index management
- Database optimization
Development Operations
See references/development-operations.md for:
- Starting/stopping the development server
- Building assets
- Watching for changes
- Clearing caches
- Managing developer mode
Testing and Debugging
See references/testing-debugging.md for:
- Running test suites
- Running specific tests
- Using the Python console
- Executing Python code
- Code coverage
Job Queue Management
See references/job-queue.md for:
- Starting and managing workers
- Scheduler control
- Viewing pending jobs
- Queue diagnostics and troubleshooting
Translation Operations
See references/translation-operations.md for:
- Complete translation workflow (POT/PO/MO)
- CSV to PO migration
- Translation compilation
- Managing translations for multiple locales
Utilities
See references/utilities.md for:
- Setting/getting configuration values
- Managing the scheduler
- RQ job queue management (clearing jobs, purging queues)
- Reloading doctypes
- Resetting passwords
- Version checking
- System diagnostics
More Commands
See references/more-commands.md for:
- User management commands
- Data import/export operations
- Search and indexing
- Production setup commands
- NGINX and SSL configuration
- And many more specialized commands
Common Workflows
For complete step-by-step workflows, see references/workflows.md:
- Fresh Install: Complete setup from scratch
- Restore from Production: Migrating production backups to development
- Quick Reinstall: Reinstalling apps without dropping the site
- Large Database Restore: Configuring MariaDB for large backups
Usage
When a user asks about bench commands or needs help with Frappe development operations:
- Identify the category of their request (site management, backup, database, etc.)
- Reference the appropriate section from references/ directory
- Provide the specific commands with the correct environment constants
- Include important notes about prerequisites or side effects
Always ensure commands use the correct site name (development.localhost) and include necessary flags like --db-root-password when required.
Key Principles
- Always specify site name: Most commands require
--site development.localhost - Database root access: Use
--db-root-password 123for operations requiring database root access - Developer mode: Enable for development work with
bench --site development.localhost set-config developer_mode 1 - Cache clearing: After code or configuration changes, run
bench clear-cache - Migration after changes: Run
bench --site development.localhost migrateafter app installations or updates
Important Notes
- Backups are automatically created in
./sites/development.localhost/private/backups/unless specified otherwise - Runtime MariaDB settings (memory limits) are lost on container restart - add to docker-compose.yml to persist
- Database users are lost on MariaDB container restart - if you get "Access denied" errors, recreate the database user (see database-operations.md)
- When recreating a site, always set the encryption_key from backup before restoring data
- Use
--skip-search-indexflag with migrate for faster migrations during development
More from kehwar/frappe_tweaks
frappe-tweaks-power-query-expert
Expert guidance for connecting Power Query (Power BI, Excel) to Frappe apps and reports. Use when building Power Query M code for Frappe data access, integrating Frappe reports with Power BI/Excel, implementing authentication for Power Query connections, handling heavy/long-running reports with report_long_polling API to avoid timeouts, applying column types and transformations, or troubleshooting Power Query caching and connection issues.
6open-observe-api-expert
Expert guidance for OpenObserve API integration in Frappe Tweaks. Use when creating, configuring, or troubleshooting OpenObserve API DocType, implementing send_logs() or search_logs() functionality, integrating with Server Scripts/Business Logic/Client-side code, debugging connection issues, or implementing logging, monitoring, error tracking, performance metrics, or audit trail use cases.
5frappe-ci-expert
Expert guidance for setting up CI/CD tests for Frappe apps. Use when users ask about GitHub Actions workflows, CI test setup, continuous integration for Frappe apps, running tests in CI environments, database setup for CI, bench configuration in CI, or automating tests for Frappe/ERPNext applications.
4workflow-expert
Expert guidance on Frappe Workflow system including workflow structure, states and transitions, workflow actions, email notifications, permission hooks (before_transition, after_transition, filter_workflow_transitions, has_workflow_action_permission), and best practices. Use when creating workflows, implementing workflow logic, understanding state transitions, working with workflow actions, configuring email notifications, or troubleshooting workflow-related issues.
4report-expert
Expert guidance on Frappe reports including report types, structure, creation workflow, and best practices. Use when creating standard script reports, query reports, understanding report structure, working with columns and filters, or troubleshooting report-related issues.
4api-reviewer
Security review and analysis for Frappe API endpoints decorated with @frappe.whitelist(). Use when reviewing API security, checking for permission vulnerabilities, scanning for unprotected endpoints, validating role restrictions, or auditing API endpoints for security best practices. Helps identify missing frappe.only_for(), frappe.has_permission(), or frappe.get_list() usage.
4