2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-12 00:06:36 +00:00
CLI to manage Multi-tenant deployments for Frappe apps
Go to file
gavin 1f5c7ec201
chore: add travis, deepsource (#900)
* chore: added deepsource config

* chore: updated travis config

* chore: updated travis config

* chore: updated travis tests for 2.7, 3.6, 3.7, 3.8

* chore: quiet installs and sudo easy install

* fix(tests): add mariadb versioning

* fix(travis): print compat for pyhton 3

* fix: drop deprecated function usage

* chore(tests): update test_init

* tests: update branch to use version-12 for testing and use git module

* chore: quieten git command outputs on branch switch

* fix: execute 'setup production' via cli

* style: sort imports

* chore: update mariadb variables in .travis.yml

* chore: seperate jobs for easy install and production setup

* chore: use exec_cmd to log command output

* chore: pin tests to ubuntu trusty

* chore: use playbooks to install mariadb

* chore: mariadb fixes in travis

* chore: pin dist to ubuntu 18.04

* chore: setup envs according by type of test

* chore: ignore auto backup, procfile, assets build

* chore: change app frammeclient to frappe_theme

* test: try travis_wait

* tests: update and restructure tests

* tests: restructure flow of setUp, tearDown

* fix: python class inheritence fix

* chore: use local frappe repo instead of remote pull

* tests: skip assets during get-app

* fix(tests): remove reinstalling app after get_app called

* fix(tests): updated test_install_app

* fix: broken remove_app
tests: broken tests

* tests: no backup while dropping new_sites

* tests: added certain tests and py obj fixes

* tests: seperate basic and production setup tests

* tests: update travis, remove basic setup

* chore: move from function calls to exec_cmd

* chore: tests fixes

* chore: removed sudo from basic setup runs

* chore: use "sudo" for setting up sudoers

* fix: allow get_app from local folder

* fix: use gitpython to switch branch instead of exec_cmd

* chore: use test to check for file existing

* chore: restructure bench tests

* fix: fetch app repo before checking for version upgrade during
switch_branch

* fix: gitpython error in usage

* fix: boolean return value of file_exists

* fix: dont decode file contents

* fix: bench names and close open files

* chore: update bench config multiple benches

* chore: check where production fails

* chore: mention python version for init

* chore: remove node production test in CI

* fix: compatibility and permissions fixes

* chore: setup sudoers after prod setup

* fix: set remote upstream after local clone

* fix: disable production via cli

* chore(tests): fix upstream link

* chore: split tests and remove unused imports
2020-03-09 17:47:43 +05:30
.circleci Revert "fix: pip pinned to 19.3.1 after v20 breaking" 2020-02-10 14:56:55 +05:30
.github chore: updated pull request template 2020-01-16 14:23:43 +05:30
bench chore: add travis, deepsource (#900) 2020-03-09 17:47:43 +05:30
docs docs: updated and re-link docs 2020-02-24 12:51:53 +05:30
install_scripts removed unnecessary install shell script 2018-04-09 11:59:12 +05:30
playbooks fix(easy-install): compatibility for easy install on PY2 (#937) 2020-02-27 21:19:20 +05:30
vm fix: run install script without sudo 2019-06-14 18:47:47 +05:30
.deepsource.toml chore: add travis, deepsource (#900) 2020-03-09 17:47:43 +05:30
.gitignore added checksum to gitignore 2018-03-18 20:19:02 +05:30
.travis.yml chore: add travis, deepsource (#900) 2020-03-09 17:47:43 +05:30
completion.sh Autocompletion for bench (zsh and bash) 2018-07-12 19:45:14 +05:30
LICENSE.md Create LICENSE.md 2014-07-09 15:55:27 +05:30
MANIFEST.in fix no procfile found 2018-04-25 18:07:12 +01:00
patches.txt fixes for encoding decoding 2018-03-12 18:25:00 +05:30
README.md docs: updated and re-link docs 2020-02-24 12:51:53 +05:30
requirements.txt chore: update GitPython (#938) 2020-02-28 14:42:14 +05:30
setup.py removed pip lockdown on 9.0.3 2018-08-15 18:02:03 +00:00

bench

bench is a command-line utility that helps you to install apps, manage multiple sites and update Frappe / ERPNext apps on */nix (macOS, Ubuntu, Debian, CentOS, etc) for development and production.

Note

: If you are looking for easier ways to get started and evaluate ERPNext, download the Virtual Machine or take a free trial on erpnext.com.


Table of Contents


bench CLI

Bench is a command line tool that helps you install, setup, manage multiple sites and apps based on Frappe Framework.


Usage

  • Create a new bench

      bench init [bench-name]
    
  • Add a site under current bench

      bench new-site [site-name]
    

    Optional: If the database for the site does not reside on localhost or listens on a custom port, you can use the flags --db-host to set a custom host and/or --db-port to set a custom port.

      bench new-site [site-name] --db-host [custom-db-host-ip] --db-port [custom-db-port]
    
  • Add apps to bench

      bench get-app [app-name] [app-link]
    
  • Install apps on a particular site

      bench --site [site-name] install-app [app-name]
    
  • Start bench (only for development)

      bench start
    
  • Show bench help

      bench --help
    

Note: Apart from bench init, all other bench commands have to be run having the respective bench directory as the working directory. (bench update may also be run, but it's behaviour is covered in depth in the docs)

For more in depth information on commands and usage follow here. As for a consolidated list of bench commands, go through this page.


Installation

To do this install, you must have basic information on how Linux works and should be able to use the command-line. bench will also create nginx and supervisor config files, setup backups and much more. If you are using on a VPS make sure it has >= 1Gb of RAM or has swap setup properly.

git clone https://github.com/frappe/bench ~/.bench
pip3 install --user -e ~/.bench

As bench is a python application, its installation really depends on python + pip + git. The Frappe Framework, however has various other system dependencies like nodejs, yarn, redis and a database system like mariadb or postgres. Go through the installation requirements for an updated list.

If you have questions, please ask them on the forum under the "Install / Update" category.


Custom Bench Commands

Want to utilize a bench command you've added in your custom Frappe application? This guide might be of some help.


Easy Install Script

  • This is an opinionated setup so it is best to setup on a blank server.

  • Works on Ubuntu 16.04+, CentOS 7+, Debian 8+

  • You may have to install Python 3 and other essentials by running apt-get install python3-minimal build-essential python3-setuptools

  • This script will install the pre-requisites, install bench and setup an ERPNext site (site1.local under frappe-bench)

  • Passwords for Frappe Administrator and MariaDB (root) will be asked and saved under ~/passwoords.txt

  • MariaDB (root) password may be password on a fresh server

  • You can then login as Administrator with the Administrator password

  • The log file is saved under /tmp/logs/install_bench.log in case you run into any issues during the install.

  • If you find any problems, post them on the forum: https://discuss.erpnext.com with the installation_problem under "Install / Update" category.

      wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
      python3 install.py --production
    

Follow Easy Install Docs for more information.


Release Bench

Releases can be made for Frappe apps using bench. More information about this process can be found here.


Bench Manager (GUI for Bench)

Bench Manager is a graphical user interface to emulate the functionalities of Frappe Bench. Like the command line utility it helps you install apps, manage multiple sites, update apps and much more. Install just by executing the following command in the respective bench directory.

	bench setup manager

Docker Install

  1. For developer setup, you can also use the official Frappe Docker.
  2. The app, mariadb and redis run on individual containers.
  3. This setup supports multi-tenancy and exposes the frappe-bench volume as a external storage.
  4. For more details, [ead the instructions on the Frappe Docker README

Guides


Resources


License

bench is licensed under GNU GPLv3