2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-24 23:48:24 +00:00
Omar Altayyan 317cc26c2c fixed a bug in default port for a site (#300)
* fixed a bug in nginx config

i found a bug when the user of the bench is currently using a dns-multitenant setup and he has multiple sites, and then he decides to switch to multiport setup, then all the sites present on the server get assigned the same port "80" and you can't change the port of any site due to the exception "Port 80 is being used by..." 

so i fixed the bug by assigning a new port number that is not in use to every unassigned site, so afterwards the user can set his own custom port for each site without having to face this exception and failing at this task

* fixed a compile error

that's what knowing too much c-based languages doesn to you

* changed increment method

* added a better description for port conflic 

if you are using port-based multi-tenant setup, i have found that if your ports are set in the site_config.py of your sites, or you set the port manually by using set-nginx-port command, and you have a port conflict between sites, the exception message raised is not be very helpful especially if you have many sites in your setup, so i added a list of ports that are conflicted and at what sites

and the behavior of default port assignment is changed as follows:

at first, the first site created gets port number 80, and every other site will get a new sequential port number, then, if a port is set manually that was assigned automatically, the manually set port number is applied and the old site moves to a new port

but the conflict message only displays if two ports where manually (or in the site_config) assigned to a site, and the message will display the site names

* added a message displaying the current port to site setup

added a new message that displays the mappings between sites and ports if port multi-tenant setup is used

* fixed security error in browsers

some browsers prevent low numbered ports from being used, so instead of continuously assigning ports from 80 onward, we start at 80 and then jump to 8000, and then continue from there

* fixed a problem with start port

apparently setting a site at port 8000 breaks nginx, so i changed it to 8001

* changed naming scheme to snake case
2016-08-29 12:24:05 +05:30
2016-06-25 00:12:28 +08:00
2016-05-16 02:33:08 -07:00
2014-07-15 11:18:26 +05:30
2016-06-28 13:22:58 +05:30
2015-04-03 18:20:05 +05:30
2014-07-09 15:55:27 +05:30
2015-12-22 11:59:41 -08:00
2016-06-09 15:39:54 +05:30

Bench

The bench allows you to setup Frappe / ERPNext apps on your local Linux (CentOS 6, Debian 7, Ubuntu, etc) machine or a production server. You can use the bench to serve multiple frappe sites. If you are using a DigitalOcean droplet or any other VPS / Dedicated Server, make sure it has >= 1Gb of ram or has swap setup properly.

To do this install, you must have basic information on how Linux works and should be able to use the command-line. If you are looking easier ways to get started and evaluate ERPNext, download the Virtual Machine or take a free trial on erpnext.com.

If you have questions, please ask them on our forum.

Installation

Easy Setup

  • This is an opinionated setup with logging and SE Linux. So, it is best to setup on a blank server.
  • Works on Ubuntu 14.04 to 16.04, CentOS 7+, Debian 7 to 8 and MacOS X.
  • You may have to install Python 2.7 (eg on Ubuntu 16.04+) by running apt-get install python-minimal
  • This script will install the pre-requisites, install bench and setup an ERPNext site
  • Passwords for Frappe Administrator and MariaDB (root) will be asked
  • You can then login as Administrator with the Administrator password
  • If you find any problems, post them on our forum: https://discuss.erpnext.com

Production vs Develop

Production setup should be run on a new box and installs nginx and supervisor to manage the processes. Develop setup uses honcho to manage the processes and uses the built-in web server (bench start)

Steps

Open your Terminal and enter:

# Linux:

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

# Mac OSX:

# install X Code (from App store)
# install HomeBrew (http://brew.sh/)
brew install python
brew install git
curl "https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py" -o install.py

# For development
sudo python install.py --develop

# For production
sudo python install.py --production

# If you're logged in as root, use --user flag to create a user and install using that user
sudo python install.py --develop --user frappe

For development, you have to explicitly start services by running bench start. This script requires Python2.7+ installed on your machine. You will have to manually create a new site (bench new-site) and get apps that you need (bench get-app, bench install-app).

For production, you will have a preinstalled site with ERPNext installed in it.

You need to run this with a user that is not root, but can sudo. If you don't have such a user, you can search the web for How to add a new user in { your OS } and How to add an existing user to sudoers in { your OS }.

On Mac OS X, you will have to create a group with the same name as { your User }. On creating this group, you have to assign { your User } to it. You can do this by going to "System preferences" -> "Users & Groups" -> "+" (as if you were adding new account) -> Under "New account" select "Group" -> Type in group name -> "Create group"

This script will:

  • Install pre-requisites like git and ansible
  • Shallow clones this bench repository under /usr/local/frappe/bench-repo
  • Runs the Ansible playbook 'playbooks/develop/install.yml', which:
    • Installs
      • MariaDB and its config
      • Redis
      • NodeJS
      • WKHTMLtoPDF with patched QT
    • Initializes a new Bench at ~/frappe/frappe-bench with frappe framework already installed under apps.

####Script Options:

	--help
	--verbose
	--develop
	--production
	--site
	--user
	--bench-branch
	--repo-url

Updating

To manually update the bench, run bench update to update all the apps, run patches, build JS and CSS files and restart supervisor (if configured to).

You can also run the parts of the bench selectively.

bench update --pull will only pull changes in the apps

bench update --patch will only run database migrations in the apps

bench update --build will only build JS and CSS files for the bench

bench update --bench will only update the bench utility (this project)

bench update --requirements will only update dependencies (python packages) for the apps installed

Guides

Resources

Description
CLI to manage Multi-tenant deployments for Frappe apps
Readme GPL-3.0 33 MiB
Languages
Python 95%
HTML 2.1%
Jinja 1.9%
Shell 0.6%
Procfile 0.4%