2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-23 15:08:24 +00:00

Merge branch 'master' into patch-2

This commit is contained in:
gavin 2019-10-22 11:34:38 +05:30 committed by GitHub
commit c9b5515517
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 61 additions and 21 deletions

View File

@ -126,14 +126,10 @@ If you are on a fresh server and logged in as root, at first create a dedicated
usermod -aG sudo frappe usermod -aG sudo frappe
``` ```
_(it is very common to name this user `frappe`, but this comes with the disadvantage of being _(it is very common to name this user `frappe`, but this comes with the disadvantage of being
ranked very high in hackers circles for attempts to entering servers. So production sites it ranked very high in hackers circles for attempts to entering servers. So production sites it
is highly recommended to use a custom username harder to guess for)_ is highly recommended to use a custom username harder to guess for)_
use --user flag to create a user and install using that user
python install.py --develop --user [frappe-user]
For developer setup: For developer setup:
sudo python install.py --develop sudo python install.py --develop
@ -142,6 +138,22 @@ For production:
sudo python install.py --production --user [frappe-user] sudo python install.py --production --user [frappe-user]
use --user flag to create a user and install using that user (By default, the script will create a user with the username `frappe` if the --user flag is not used)
python install.py --develop --user [frappe-user]
use --container flag to install inside a container (this will prevent the `/proc/sys/vm/swappiness: Read-only` file system error)
sudo python install.py --production --user [frappe-user] --container
use --version flag to install specific version
python install.py --develop --version 11 --user [frappe-user]
use --python flag to specify virtual environments python version, by default script setup python 3
python install.py --develop --version 11 --python python2.7 --user [frappe-user]
#### What will this script do? #### What will this script do?
- Install all the pre-requisites - Install all the pre-requisites

View File

@ -419,9 +419,9 @@ def get_apps_json(path):
if path.startswith('http'): if path.startswith('http'):
r = requests.get(path) r = requests.get(path)
return r.json() return r.json()
else:
with open(path) as f: with open(path) as f:
return json.load(f) return json.load(f)
def validate_branch(): def validate_branch():
for app in ['frappe', 'erpnext']: for app in ['frappe', 'erpnext']:

View File

@ -89,7 +89,7 @@ except ImportError:
@click.command('migrate-env') @click.command('migrate-env')
@click.argument('python', type = str) @click.argument('python', type = str)
@click.option('--no-backup', default = False, help = 'Do not backup the existing Virtual Environment') @click.option('--no-backup', is_flag=True)
def migrate_env(python, no_backup = False): def migrate_env(python, no_backup = False):
""" """
Migrate Virtual Environment to desired Python Version. Migrate Virtual Environment to desired Python Version.

View File

@ -5,10 +5,11 @@ import sys, os, copy
@click.command('start') @click.command('start')
@click.option('--no-dev', is_flag=True, default=False) @click.option('--no-dev', is_flag=True, default=False)
@click.option('--concurrency', '-c', type=str) @click.option('--concurrency', '-c', type=str)
def start(no_dev, concurrency): @click.option('--procfile', '-p', type=str)
def start(no_dev, concurrency, procfile):
"Start Frappe development processes" "Start Frappe development processes"
from bench.utils import start from bench.utils import start
start(no_dev=no_dev, concurrency=concurrency) start(no_dev=no_dev, concurrency=concurrency, procfile=procfile)
@click.command('restart') @click.command('restart')

View File

@ -34,7 +34,7 @@ server {
ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"; ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS";
ssl_prefer_server_ciphers on; ssl_prefer_server_ciphers on;
{% endif %} {% endif %}
add_header X-Frame-Options "SAMEORIGIN"; add_header X-Frame-Options "SAMEORIGIN";
location /assets { location /assets {
@ -58,6 +58,12 @@ server {
} }
location / { location / {
location ~ ^/files/.*.(htm|html|svg|xml) {
add_header Content-disposition "attachment";
try_files /{{ site_name }}/public/$uri @webserver;
}
try_files /{{ site_name }}/public/$uri @webserver; try_files /{{ site_name }}/public/$uri @webserver;
} }

View File

@ -317,7 +317,7 @@ def get_program(programs):
def get_process_manager(): def get_process_manager():
return get_program(['foreman', 'forego', 'honcho']) return get_program(['foreman', 'forego', 'honcho'])
def start(no_dev=False, concurrency=None): def start(no_dev=False, concurrency=None, procfile=None):
program = get_process_manager() program = get_process_manager()
if not program: if not program:
raise Exception("No process manager found") raise Exception("No process manager found")
@ -329,6 +329,9 @@ def start(no_dev=False, concurrency=None):
if concurrency: if concurrency:
command.extend(['-c', concurrency]) command.extend(['-c', concurrency])
if procfile:
command.extend(['-f', procfile])
os.execv(program, command) os.execv(program, command)
def check_cmd(cmd, cwd='.'): def check_cmd(cmd, cwd='.'):
@ -351,16 +354,16 @@ def check_git_for_shallow_clone():
from .config.common_site_config import get_config from .config.common_site_config import get_config
config = get_config('.') config = get_config('.')
if config.get('release_bench'): if config:
return False if config.get('release_bench'):
return False
if not config.get('shallow_clone'): if not config.get('shallow_clone'):
return False return False
git_version = get_git_version() git_version = get_git_version()
if git_version > 1.9: if git_version > 1.9:
return True return True
return False
def get_cmd_output(cmd, cwd='.'): def get_cmd_output(cmd, cwd='.'):
try: try:
@ -537,7 +540,7 @@ def update_json_file(filename, ddict):
content.update(ddict) content.update(ddict)
with open(filename, 'w') as f: with open(filename, 'w') as f:
content = json.dump(content, f, indent=1, sort_keys=True) json.dump(content, f, indent=1, sort_keys=True)
def drop_privileges(uid_name='nobody', gid_name='nogroup'): def drop_privileges(uid_name='nobody', gid_name='nogroup'):
# from http://stackoverflow.com/a/2699996 # from http://stackoverflow.com/a/2699996

View File

@ -14,7 +14,7 @@ def install_bench(args):
success = run_os_command({ success = run_os_command({
'apt-get': [ 'apt-get': [
'sudo apt-get update', 'sudo apt-get update',
'sudo apt-get install -y git build-essential python3-setuptools python3-dev libffi-dev libssl-dev' 'sudo apt-get install -y git build-essential python3-setuptools python3-dev libffi-dev'
], ],
'yum': [ 'yum': [
'sudo yum groupinstall -y "Development tools"', 'sudo yum groupinstall -y "Development tools"',

View File

@ -21,4 +21,9 @@
- tk8.5-dev - tk8.5-dev
when: ansible_distribution_version | version_compare('8', 'ge') when: ansible_distribution_version | version_compare('8', 'ge')
- name: install pdf prerequisites debian
apt: pkg={{ item }} state=present force=yes
with_items:
- libssl-dev
... ...

View File

@ -12,7 +12,6 @@
- libcrypto++-dev - libcrypto++-dev
- libfreetype6-dev - libfreetype6-dev
- liblcms2-dev - liblcms2-dev
- libssl-dev
- libwebp-dev - libwebp-dev
- libxext6 - libxext6
- libxrender1 - libxrender1

View File

@ -18,4 +18,17 @@
- tk8.6-dev - tk8.6-dev
when: ansible_distribution_version | version_compare('14.04', 'ge') when: ansible_distribution_version | version_compare('14.04', 'ge')
- name: install pdf prerequisites for Ubuntu < 18.04
apt: pkg={{ item }} state=present force=yes
with_items:
- libssl-dev
when: ansible_distribution_version | version_compare('18.04', 'lt')
- name: install pdf prerequisites for Ubuntu >= 18.04
apt: pkg={{ item }} state=present force=yes
with_items:
- libssl1.0-dev
when: ansible_distribution_version | version_compare('18.04', 'ge')
... ...

View File

@ -1,3 +1,4 @@
six
Click Click
jinja2 jinja2
virtualenv virtualenv