4.6 KiB
Executable file
4.6 KiB
Executable file
Bench Commands Cheatsheet
General Usage
bench --version- Show bench versionbench src- Show bench repo directorybench --help- Show all commands and helpbench [command] --help- Show help for commandbench init [bench-name]- Create a new bench (Run from home dir)bench --site [site-name] COMMAND- Specify site for commandbench update- Pulls changes for bench-repo and all apps, applies patches, builds JS and CSS, and then migrates.--pullPull changes in all the apps in bench--patchRun migrations for all sites in the bench--buildBuild JS and CSS artifacts for the bench--benchUpdate bench--requirementsUpdate requirements--restart-supervisorrestart supervisor processes after update--upgradeDoes major upgrade (Eg. ERPNext 6 -> 7)--no-backupDon't take a backup before update
bench restartRestart all bench servicesbench backupBackupbench backup-all-sitesBackup all sites--with-filesBackup site with files
bench restoreRestore--with-private-filesRestore site with private files (Path to tar file)--with-public-filesRestore site with public files (Path to tar file)
bench migrateWill read JSON files and make changes to the database accordingly
###Config
bench config- Change bench configurationauto_update [on/off]Enable/Disable auto update for benchdns_multitenant [on/off]Enable/Disable DNS Multitenancyhttp_timeoutSet http timeoutrestart_supervisor_on_updateEnable/Disable auto restart of supervisorserve_default_siteConfigure nginx to serve the default site onupdate_bench_on_updateEnable/Disable bench updates on running bench...
bench setup- Setup componentsauto-updateAdd cronjob for bench auto updatebackupsAdd cronjob for bench backupsconfigoverwrite or make config.jsonenvSetup virtualenv for benchnginxgenerate config for nginxprocfileSetup Procfile for bench startproductionsetup bench for productionredisgenerate config for redis cachesocketioSetup node deps for socketio serversudoersAdd commands to sudoers list for execution...supervisorgenerate config for supervisoradd-domainadd custom domain for sitefirewallsetup firewall and block all ports except 22, 80 and 443ssh-portchange the default ssh connection port
###Development
bench new-app [app-name]Creates a new appbench get-app [repo-link]- Downloads an app from a git repository and installs itbench install-app [app-name]Installs existing appbench remove-from-installed-apps [app-name]Remove app from the list of appsbench uninstall-app [app-name]Delete app and everything linked to the app (Bench needs to be running)bench remove-app [app-name]Remove app from the bench entirelybench --site [sitename] --force reinstallReinstall with fresh database (Caution: Will wipe out old database)bench new-site [sitename]- Creates a new site--db-nameDatabase name--mariadb-root-usernameRoot username for MariaDB--mariadb-root-passwordRoot password for MariaDB--admin-passwordAdministrator password for new site--verboseVerbose--forceForce restore if site/database already exists--source_sqlInitiate database with a SQL file--install-appInstall app after installation`
bench use [site]Sets a default sitebench drop-siteRemoves site from disk and database completely--root-login--root-password
bench set-config [key] [value]Adds a key-value pair to site's config filebench consoleOpens a IPython console in the bench venvbench executeExecute a method inside any app.- Eg :
bench execute frappe.utils.scheduler.enqueue_scheduler_events
- Eg :
bench mysqlOpens SQL Consolebench run-testsRun tests--appApp Name--doctypeDocType to run tests for--testSpecific Test--moduleRun a particular module that has tests--profileRuns a Python profiler on the test
bench disable-productionDisables production environment
###Scheduler
bench enable-scheduler- Enables Scheduler that will run scheduled tasksbench doctor- Get diagnostic info about background workersbench show-pending-jobs- Get pending jobsbench purge-jobs- Destroy all pending jobs