From 81330fd894db79ad0a6767b948a59b3ebee63dbb Mon Sep 17 00:00:00 2001 From: Chinmay Pai Date: Thu, 9 May 2019 23:51:10 +0530 Subject: [PATCH 01/28] fix(easy_install): add support for Ubuntu 19.04 --- playbooks/install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbooks/install.py b/playbooks/install.py index 5cc4afc9..4782480c 100644 --- a/playbooks/install.py +++ b/playbooks/install.py @@ -129,7 +129,7 @@ def install_bench(args): shutil.rmtree(tmp_bench_repo) def check_distribution_compatibility(): - supported_dists = {'ubuntu': [14, 15, 16, 18], 'debian': [8, 9], + supported_dists = {'ubuntu': [14, 15, 16, 18, 19], 'debian': [8, 9], 'centos': [7], 'macos': [10.9, 10.10, 10.11, 10.12]} dist_name, dist_version = get_distribution_info() From a0739897c5c7959091977fffd59dc1a1d6f74087 Mon Sep 17 00:00:00 2001 From: Kenneth Sequeira <33246109+kennethsequeira@users.noreply.github.com> Date: Mon, 10 Jun 2019 17:11:15 +0530 Subject: [PATCH 02/28] Fix Install Links Fix the manual install links for Mac and Linux guides. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c58a6f6f..b4c68837 100755 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ To install the Frappe/ERPNext server software, you will need an operating system ### Manual Install -To manually install frappe/erpnext, you can follow this [this wiki](https://github.com/frappe/frappe/wiki/The-Hitchhiker%27s-Guide-to-Installing-Frapp%C3%A9-on-Linux) for Linux and [this wiki](https://github.com/frappe/frappe/wiki/The-Hitchhiker's-Guide-to-Installing-Frapp%C3%A9-on-Mac-OS-X) for MacOS. It gives an excellent explanation about the stack. You can also follow the steps mentioned below: +To manually install frappe/erpnext, you can follow this [this wiki](https://github.com/frappe/frappe/wiki/The-Hitchhiker%27s-Guide-to-Installing-Frappe-on-Linux) for Linux and [this wiki](https://github.com/frappe/frappe/wiki/The-Hitchhiker's-Guide-to-Installing-Frappe-on-Mac-OS-X) for MacOS. It gives an excellent explanation about the stack. You can also follow the steps mentioned below: #### 1. Install Pre-requisites From d5003e1944ec1fccc34c742930ad1741e7e0ab66 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 14 Jun 2019 15:14:21 +0530 Subject: [PATCH 03/28] fix: dir permissions --- playbooks/site.yml | 3 +++ vm/build.py | 2 +- vm/vm-develop.json | 2 +- vm/vm-production.json | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/playbooks/site.yml b/playbooks/site.yml index 328cfcba..9ac8ca00 100644 --- a/playbooks/site.yml +++ b/playbooks/site.yml @@ -39,6 +39,9 @@ - name: setup bench and dev environment hosts: localhost + become: '{{ use_sudo }}' + become_user: '{{ frappe_user }}' + become_method: sudo vars: bench_repo_path: "/home/{{ frappe_user }}/.bench" bench_path: "/home/{{ frappe_user }}/{{ bench_name }}" diff --git a/vm/build.py b/vm/build.py index e5434013..0fc0d6d0 100644 --- a/vm/build.py +++ b/vm/build.py @@ -33,7 +33,7 @@ def install_virtualbox(): check_output(['bench', 'install', 'virtualbox']) def install_packer(): - if not spawn.find_executable("packer") or not os.path.exists(os.path.join('/', 'opt', 'packer')): + if not spawn.find_executable("packer") and not os.path.exists(os.path.join('/', 'opt', 'packer')): check_output(['bench', 'install', 'packer']) def silent_remove(name, is_dir=False): diff --git a/vm/vm-develop.json b/vm/vm-develop.json index 0e8ca8aa..f7883d24 100644 --- a/vm/vm-develop.json +++ b/vm/vm-develop.json @@ -38,7 +38,7 @@ "iso_checksum_type": "md5", "ssh_username": "frappe", "ssh_password": "frappe", - "ssh_port": 22, + "ssh_port": 22, "ssh_wait_timeout": "10000s", "http_directory": "http", "guest_additions_mode": "disable", diff --git a/vm/vm-production.json b/vm/vm-production.json index 2d584950..ef33b275 100644 --- a/vm/vm-production.json +++ b/vm/vm-production.json @@ -38,7 +38,7 @@ "iso_checksum_type": "md5", "ssh_username": "frappe", "ssh_password": "frappe", - "ssh_port": 22, + "ssh_port": 22, "ssh_wait_timeout": "10000s", "http_directory": "http", "guest_additions_mode": "disable", From b6dd496e35109165d796441450b35dc58e316c03 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 14 Jun 2019 18:08:14 +0530 Subject: [PATCH 04/28] fix: separate out scripts --- playbooks/site.yml | 3 --- vm/scripts/debian_family/install_erpnext_develop.sh | 5 +---- vm/vm-develop.json | 5 ++++- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/playbooks/site.yml b/playbooks/site.yml index 9ac8ca00..328cfcba 100644 --- a/playbooks/site.yml +++ b/playbooks/site.yml @@ -39,9 +39,6 @@ - name: setup bench and dev environment hosts: localhost - become: '{{ use_sudo }}' - become_user: '{{ frappe_user }}' - become_method: sudo vars: bench_repo_path: "/home/{{ frappe_user }}/.bench" bench_path: "/home/{{ frappe_user }}/{{ bench_name }}" diff --git a/vm/scripts/debian_family/install_erpnext_develop.sh b/vm/scripts/debian_family/install_erpnext_develop.sh index 4d3031af..9e9c7ab7 100644 --- a/vm/scripts/debian_family/install_erpnext_develop.sh +++ b/vm/scripts/debian_family/install_erpnext_develop.sh @@ -1,8 +1,5 @@ #!/bin/bash -eux -# Install base requirements. -apt-get install -y curl git wget vim python-dev gcc - # Install ERPNext wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py -sudo python install.py --develop --user frappe --mysql-root-password frappe --admin-password admin \ No newline at end of file +python install.py --develop --user frappe --mysql-root-password frappe --admin-password admin \ No newline at end of file diff --git a/vm/vm-develop.json b/vm/vm-develop.json index f7883d24..1a70c44a 100644 --- a/vm/vm-develop.json +++ b/vm/vm-develop.json @@ -70,9 +70,12 @@ "type": "shell", "execute_command": "echo 'frappe' | {{.Vars}} sudo -S -E bash '{{.Path}}'", "script": "scripts/debian_family/setup.sh" - }, { + },{ "type": "shell", "execute_command": "echo 'frappe' | {{.Vars}} sudo -S -E bash '{{.Path}}'", + "script": "scripts/debian_family/install_prerequisites.sh" + }, { + "type": "shell", "script": "scripts/debian_family/install_erpnext_develop.sh" }, { "type": "shell", From e7f45e36d2ba4f72821d2049d0f6ff25c02536de Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 14 Jun 2019 18:08:40 +0530 Subject: [PATCH 05/28] fix: script to install pre-requisites --- vm/scripts/debian_family/install_prerequisites.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 vm/scripts/debian_family/install_prerequisites.sh diff --git a/vm/scripts/debian_family/install_prerequisites.sh b/vm/scripts/debian_family/install_prerequisites.sh new file mode 100644 index 00000000..0aed12fd --- /dev/null +++ b/vm/scripts/debian_family/install_prerequisites.sh @@ -0,0 +1,4 @@ +#!/bin/bash -eux + +# Install base requirements. +apt-get install -y curl git wget vim python-dev gcc From 982b727a3c56cb422b6003474ab8d92a2d20a6ef Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 14 Jun 2019 18:10:04 +0530 Subject: [PATCH 06/28] fix: run install script without sudo --- vm/scripts/debian_family/install_erpnext_production.sh | 5 +---- vm/vm-production.json | 5 ++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vm/scripts/debian_family/install_erpnext_production.sh b/vm/scripts/debian_family/install_erpnext_production.sh index c0e4ade0..91b48d1d 100644 --- a/vm/scripts/debian_family/install_erpnext_production.sh +++ b/vm/scripts/debian_family/install_erpnext_production.sh @@ -1,8 +1,5 @@ #!/bin/bash -eux -# Install base requirements. -apt-get install -y curl git wget vim python-dev gcc - # Install ERPNext wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py -sudo python install.py --production --user frappe --mysql-root-password frappe --admin-password admin \ No newline at end of file +python install.py --production --user frappe --mysql-root-password frappe --admin-password admin \ No newline at end of file diff --git a/vm/vm-production.json b/vm/vm-production.json index ef33b275..c2883d54 100644 --- a/vm/vm-production.json +++ b/vm/vm-production.json @@ -69,9 +69,12 @@ "type": "shell", "execute_command": "echo 'frappe' | {{.Vars}} sudo -S -E bash '{{.Path}}'", "script": "scripts/debian_family/setup.sh" - }, { + },{ "type": "shell", "execute_command": "echo 'frappe' | {{.Vars}} sudo -S -E bash '{{.Path}}'", + "script": "scripts/debian_family/install_prerequisites.sh" + }, { + "type": "shell", "script": "scripts/debian_family/install_erpnext_production.sh" }, { "type": "shell", From f23698afd70d928cffbbc182e12295b16c481d1b Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 14 Jun 2019 18:45:24 +0530 Subject: [PATCH 07/28] fix: perm while executing create user --- playbooks/create_user.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/playbooks/create_user.yml b/playbooks/create_user.yml index e853ed6f..2991afb3 100644 --- a/playbooks/create_user.yml +++ b/playbooks/create_user.yml @@ -1,6 +1,8 @@ --- - hosts: localhost + become: yes + become_user: root tasks: - name: Create user user: From 9242b927ca3574f781475b264b5d35cd1b71191a Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 19 Jun 2019 17:25:41 +0530 Subject: [PATCH 08/28] fix: take backup before pulling the code and make site available after restarting the processes --- bench/commands/update.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/bench/commands/update.py b/bench/commands/update.py index 1779dd90..49d940ab 100755 --- a/bench/commands/update.py +++ b/bench/commands/update.py @@ -1,6 +1,6 @@ import click import sys, os -from bench.config.common_site_config import get_config +from bench.config.common_site_config import get_config, update_config from bench.app import pull_all_apps, is_version_upgrade from bench.utils import (update_bench, validate_upgrade, pre_upgrade, post_upgrade, before_update, update_requirements, update_node_packages, backup_all_sites, patch_sites, build_assets, @@ -69,6 +69,13 @@ def _update(pull=False, patch=False, build=False, update_bench=False, auto=False before_update(bench_path=bench_path, requirements=requirements) + config.update({ "maintenance_mode": 1, "pause_scheduler": 1 }) + update_config(config, bench_path=bench_path) + + if not no_backup: + print('Backing up sites...') + backup_all_sites(bench_path=bench_path) + if pull: pull_all_apps(bench_path=bench_path, reset=reset) @@ -89,10 +96,6 @@ def _update(pull=False, patch=False, build=False, update_bench=False, auto=False reload(bench.app) if patch: - if not no_backup: - print('Backing up sites...') - backup_all_sites(bench_path=bench_path) - print('Patching sites...') patch_sites(bench_path=bench_path) if build: @@ -104,6 +107,9 @@ def _update(pull=False, patch=False, build=False, update_bench=False, auto=False if restart_systemd or conf.get('restart_systemd_on_update'): restart_systemd_processes(bench_path=bench_path) + config.update({ "maintenance_mode": 0, "pause_scheduler": 0 }) + update_config(config, bench_path=bench_path) + print("_"*80) print("Bench: Deployment tool for Frappe and ERPNext (https://erpnext.org).") print("Open source depends on your contributions, so please contribute bug reports, patches, fixes or cash and be a part of the community") From 22f3bc6c360c5db49360b6893b3abbd6aabc6fa4 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 19 Jun 2019 18:03:04 +0530 Subject: [PATCH 09/28] fix: typo fix --- bench/commands/update.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bench/commands/update.py b/bench/commands/update.py index 49d940ab..e91eef1b 100755 --- a/bench/commands/update.py +++ b/bench/commands/update.py @@ -69,8 +69,8 @@ def _update(pull=False, patch=False, build=False, update_bench=False, auto=False before_update(bench_path=bench_path, requirements=requirements) - config.update({ "maintenance_mode": 1, "pause_scheduler": 1 }) - update_config(config, bench_path=bench_path) + conf.update({ "maintenance_mode": 1, "pause_scheduler": 1 }) + update_config(conf, bench_path=bench_path) if not no_backup: print('Backing up sites...') @@ -107,8 +107,8 @@ def _update(pull=False, patch=False, build=False, update_bench=False, auto=False if restart_systemd or conf.get('restart_systemd_on_update'): restart_systemd_processes(bench_path=bench_path) - config.update({ "maintenance_mode": 0, "pause_scheduler": 0 }) - update_config(config, bench_path=bench_path) + conf.update({ "maintenance_mode": 0, "pause_scheduler": 0 }) + update_config(conf, bench_path=bench_path) print("_"*80) print("Bench: Deployment tool for Frappe and ERPNext (https://erpnext.org).") From e24ca16c9021e74138c1894987e78791c71b2bd5 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Fri, 21 Jun 2019 08:40:13 +0530 Subject: [PATCH 10/28] fix: Initialize bench with Python 3 --- bench/commands/make.py | 4 +- bench/commands/setup.py | 4 +- bench/utils.py | 4 +- playbooks/install.py | 46 ++++--------------- playbooks/roles/bench/tasks/main.yml | 4 +- .../roles/common/tasks/debian_family.yml | 7 ++- playbooks/roles/common/tasks/main.yml | 2 +- playbooks/roles/mariadb/tasks/debian.yml | 1 - .../tasks/mysql_secure_installation.yml | 2 +- .../roles/mariadb/tasks/ubuntu-trusty.yml | 2 +- .../mariadb/tasks/ubuntu-xenial_bionic.yml | 2 +- 11 files changed, 24 insertions(+), 54 deletions(-) diff --git a/bench/commands/make.py b/bench/commands/make.py index 744f961c..e30f23d5 100755 --- a/bench/commands/make.py +++ b/bench/commands/make.py @@ -2,7 +2,7 @@ import click @click.command() @click.argument('path') -@click.option('--python', type = str, default = 'python', help = 'Path to Python Executable.') +@click.option('--python', type = str, default = 'python3', help = 'Path to Python Executable.') @click.option('--ignore-exist', is_flag = True, default = False, help = "Ignore if Bench instance exists.") @click.option('--apps_path', default=None, help="path to json files with apps to install after init") @click.option('--frappe-path', default=None, help="path to frappe repo") @@ -17,7 +17,7 @@ import click def init(path, apps_path, frappe_path, frappe_branch, no_procfile, no_backups, no_auto_update, clone_from, verbose, skip_redis_config_generation, clone_without_update, ignore_exist = False, - python = 'python'): # Let's change we're ready. - + python = 'python3'): ''' Create a New Bench Instance. ''' diff --git a/bench/commands/setup.py b/bench/commands/setup.py index d789aa3a..bb59a857 100755 --- a/bench/commands/setup.py +++ b/bench/commands/setup.py @@ -81,8 +81,8 @@ def setup_backups(): setup_backups() @click.command('env') -@click.option('--python', type = str, default = 'python', help = 'Path to Python Executable.') -def setup_env(python='python'): +@click.option('--python', type = str, default = 'python3', help = 'Path to Python Executable.') +def setup_env(python='python3'): "Setup virtualenv for bench" from bench.utils import setup_env setup_env(python=python) diff --git a/bench/utils.py b/bench/utils.py index c531eb8f..cee84833 100755 --- a/bench/utils.py +++ b/bench/utils.py @@ -38,7 +38,7 @@ def init(path, apps_path=None, no_procfile=False, no_backups=False, verbose=False, clone_from=None, skip_redis_config_generation=False, clone_without_update=False, ignore_exist = False, - python = 'python'): # Let's change when we're ready. - + python = 'python3'): # Let's change when we're ready. - from .app import get_app, install_apps_from_path from .config.common_site_config import make_config from .config import redis @@ -169,7 +169,7 @@ def which(executable, raise_err = False): return exec_ -def setup_env(bench_path='.', python = 'python'): +def setup_env(bench_path='.', python = 'python3'): python = which(python, raise_err = True) pip = os.path.join('env', 'bin', 'pip') diff --git a/playbooks/install.py b/playbooks/install.py index db50160c..355e03a0 100644 --- a/playbooks/install.py +++ b/playbooks/install.py @@ -1,4 +1,4 @@ -# wget setup_frappe.py | python +# wget setup_frappe.py | python3 import os, sys, subprocess, getpass, json, multiprocessing, shutil, platform from distutils.spawn import find_executable @@ -14,7 +14,7 @@ def install_bench(args): success = run_os_command({ 'apt-get': [ 'sudo apt-get update', - 'sudo apt-get install -y git build-essential python-setuptools python-dev libffi-dev libssl-dev' + 'sudo apt-get install -y git build-essential python3-setuptools python3-dev libffi-dev libssl-dev' ], 'yum': [ 'sudo yum groupinstall -y "Development tools"', @@ -46,7 +46,7 @@ def install_bench(args): }) success = run_os_command({ - 'python': 'sudo python get-pip.py --force-reinstall' + 'python3': 'sudo python3 get-pip.py --force-reinstall' }) if success: @@ -85,12 +85,11 @@ def install_bench(args): raise Exception('Please run this script as a non-root user with sudo privileges, but without using sudo or pass --user=USER') # Python executable - if not args.production: - dist_name, dist_version = get_distribution_info() - if dist_name=='centos': - args.python = 'python3.6' - else: - args.python = 'python3' + dist_name, dist_version = get_distribution_info() + if dist_name=='centos': + args.python = 'python3.6' + else: + args.python = 'python3' # create user if not exists extra_vars = vars(args) @@ -157,27 +156,6 @@ def get_distribution_info(): current_dist = platform.mac_ver() return "macos", current_dist[0].rsplit('.', 1)[0] -def install_python27(): - version = (sys.version_info[0], sys.version_info[1]) - - if version == (2, 7): - return - - print('Installing Python 2.7') - - # install python 2.7 - success = run_os_command({ - 'apt-get': 'sudo apt-get install -y python-dev', - 'yum': 'sudo yum install -y python27', - 'brew': 'brew install python' - }) - - if not success: - could_not_install('Python 2.7') - - # replace current python with python2.7 - os.execvp('python2.7', ([] if is_sudo_user() else ['sudo']) + ['python2.7', __file__] + sys.argv[1:]) - def install_package(package): package_exec = find_executable(package) @@ -407,7 +385,7 @@ def parse_commandline_args(): parser.add_argument('--bench-name', dest='bench_name', help='Create bench with specified name. Default name is frappe-bench') # Python interpreter to be used - parser.add_argument('--python', dest='python', default='python', + parser.add_argument('--python', dest='python', default='python3', help=argparse.SUPPRESS ) @@ -421,12 +399,6 @@ def parse_commandline_args(): return args if __name__ == '__main__': - try: - import argparse - except ImportError: - # install python2.7 - install_python27() - args = parse_commandline_args() install_bench(args) diff --git a/playbooks/roles/bench/tasks/main.yml b/playbooks/roles/bench/tasks/main.yml index 0a9afa6e..1294d054 100644 --- a/playbooks/roles/bench/tasks/main.yml +++ b/playbooks/roles/bench/tasks/main.yml @@ -34,8 +34,8 @@ creates: "{{ bench_path }}" when: not bench_stat.stat.exists and not production - - name: python2 bench init for production - command: bench init {{ bench_path }} --frappe-path {{ frappe_repo_url }} --frappe-branch {{ frappe_branch }} + - name: python3 bench init for production + command: bench init {{ bench_path }} --frappe-path {{ frappe_repo_url }} --frappe-branch {{ frappe_branch }} --python {{ python }} args: creates: "{{ bench_path }}" when: not bench_stat.stat.exists and production diff --git a/playbooks/roles/common/tasks/debian_family.yml b/playbooks/roles/common/tasks/debian_family.yml index c7639264..893b0632 100644 --- a/playbooks/roles/common/tasks/debian_family.yml +++ b/playbooks/roles/common/tasks/debian_family.yml @@ -21,10 +21,9 @@ - libffi-dev - ntp # Clock synchronization - postfix # Mail Server - - python-dev # Installing python developer suite - - python3-dev # For python3 compatibility + - python3-dev # Installing python developer suite - python-tk - - screen # To aid ssh sessions with connectivity problems + - screen # To aid ssh sessions with connectivity problems - vim # Is that supposed to be a question!? - xfonts-75dpi - xfonts-base @@ -34,7 +33,7 @@ - libldap2-dev - libcups2-dev - pv # Show progress during database restore - + - include_tasks: debian.yml when: ansible_distribution == 'Debian' diff --git a/playbooks/roles/common/tasks/main.yml b/playbooks/roles/common/tasks/main.yml index e5f6ac0d..b6b2be29 100644 --- a/playbooks/roles/common/tasks/main.yml +++ b/playbooks/roles/common/tasks/main.yml @@ -1,5 +1,5 @@ --- -# Install's prerequisites, like fonts, image libraries, vim, screen, python-dev +# Install's prerequisites, like fonts, image libraries, vim, screen, python3-dev - include_tasks: debian_family.yml when: ansible_os_family == 'Debian' diff --git a/playbooks/roles/mariadb/tasks/debian.yml b/playbooks/roles/mariadb/tasks/debian.yml index 906576d9..8e9596c5 100644 --- a/playbooks/roles/mariadb/tasks/debian.yml +++ b/playbooks/roles/mariadb/tasks/debian.yml @@ -27,6 +27,5 @@ - mariadb-client - mariadb-common - libmariadbclient18 - - python-mysqldb - python3-mysqldb ... \ No newline at end of file diff --git a/playbooks/roles/mariadb/tasks/mysql_secure_installation.yml b/playbooks/roles/mariadb/tasks/mysql_secure_installation.yml index 27d1ca80..4265375e 100644 --- a/playbooks/roles/mariadb/tasks/mysql_secure_installation.yml +++ b/playbooks/roles/mariadb/tasks/mysql_secure_installation.yml @@ -12,7 +12,7 @@ # FLUSH PRIVILEGES; - name: Set root Password - mysql_user: login_password={{ mysql_root_password }} check_implicit_admin=yes name=root host={{ item }} password={{ mysql_root_password }} state=present + mysql_user: login_password={{ mysql_root_password }} check_implicit_admin=yes name=root host={{ item }} password={{ mysql_root_password }} state=present with_items: - localhost - 127.0.0.1 diff --git a/playbooks/roles/mariadb/tasks/ubuntu-trusty.yml b/playbooks/roles/mariadb/tasks/ubuntu-trusty.yml index 56cd0b66..6493b985 100644 --- a/playbooks/roles/mariadb/tasks/ubuntu-trusty.yml +++ b/playbooks/roles/mariadb/tasks/ubuntu-trusty.yml @@ -23,5 +23,5 @@ - libmariadbclient18 - name: Install MySQLdb Python package for secure installations. - apt: pkg=python-mysqldb state=present + apt: pkg=python3-mysqldb state=present when: mysql_secure_installation and mysql_root_password is defined diff --git a/playbooks/roles/mariadb/tasks/ubuntu-xenial_bionic.yml b/playbooks/roles/mariadb/tasks/ubuntu-xenial_bionic.yml index 8e834ee8..2163cc00 100644 --- a/playbooks/roles/mariadb/tasks/ubuntu-xenial_bionic.yml +++ b/playbooks/roles/mariadb/tasks/ubuntu-xenial_bionic.yml @@ -23,5 +23,5 @@ - libmariadbclient18 - name: Install MySQLdb Python package for secure installations. - apt: pkg=python-mysqldb state=present + apt: pkg=python3-mysqldb state=present when: mysql_secure_installation and mysql_root_password is defined From dd78011717a4aaabe12ba40af817ed80bedf9afa Mon Sep 17 00:00:00 2001 From: Sahil Khan Date: Fri, 19 Jul 2019 17:08:09 +0530 Subject: [PATCH 11/28] fix(release): handle release for multiple branches --- bench/release.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/bench/release.py b/bench/release.py index a6b33672..9e0252a1 100755 --- a/bench/release.py +++ b/bench/release.py @@ -15,13 +15,14 @@ import click branches_to_update = { 'develop': [], - 'hotfix': ['develop'] + 'version-11-hotfix': [], + 'version-12-hotfix': [], } github_username = None github_password = None -def release(bench_path, app, bump_type, from_branch='develop', to_branch='master', +def release(bench_path, app, bump_type, from_branch, to_branch, remote='upstream', owner='frappe', repo_name=None, frontport=True): confirm_testing() @@ -30,7 +31,7 @@ def release(bench_path, app, bump_type, from_branch='develop', to_branch='master if not config.get('release_bench'): print('bench not configured to release') sys.exit(1) - + if config.get('branches_to_update'): branches_to_update.update(config.get('branches_to_update')) @@ -91,7 +92,7 @@ def bump(bench_path, app, bump_type, from_branch, to_branch, remote, owner, repo create_github_release(repo_path, tag_name, message, remote=remote, owner=owner, repo_name=repo_name, prerelease=prerelease) print('Released {tag} for {repo_path}'.format(tag=tag_name, repo_path=repo_path)) -def update_branches_and_check_for_changelog(repo_path, from_branch='develop', to_branch='master', remote='upstream'): +def update_branches_and_check_for_changelog(repo_path, from_branch, to_branch, remote='upstream'): update_branch(repo_path, to_branch, remote=remote) update_branch(repo_path, from_branch, remote=remote) @@ -116,7 +117,7 @@ def check_for_unmerged_changelog(repo_path): if os.path.exists(current) and [f for f in os.listdir(current) if f != "readme.md"]: raise Exception("Unmerged change log! in " + repo_path) -def get_release_message(repo_path, from_branch='develop', to_branch='master', remote='upstream'): +def get_release_message(repo_path, from_branch, to_branch, remote='upstream'): print('getting release message for', repo_path, 'comparing', to_branch, '...', from_branch) repo = git.Repo(repo_path) @@ -127,7 +128,7 @@ def get_release_message(repo_path, from_branch='develop', to_branch='master', re if log: return "* " + log.replace('\n', '\n* ') -def bump_repo(repo_path, bump_type, from_branch='develop', to_branch='master'): +def bump_repo(repo_path, bump_type, from_branch, to_branch): current_version = get_current_version(repo_path, to_branch) new_version = get_bumped_version(current_version, bump_type) @@ -140,7 +141,7 @@ def get_current_version(repo_path, to_branch): # TODO clean this up! version_key = '__version__' - if to_branch.lower() == 'master': + if to_branch.lower() in ['version-11', 'version-12']: filename = os.path.join(repo_path, os.path.basename(repo_path), '__init__.py') else: filename = os.path.join(repo_path, os.path.basename(repo_path), 'hooks.py') @@ -194,7 +195,7 @@ def get_bumped_version(version, bump_type): return str(v) def set_version(repo_path, version, to_branch): - if to_branch.lower() == 'master': + if to_branch.lower() in ['version-11', 'version-12']: set_filename_version(os.path.join(repo_path, os.path.basename(repo_path),'__init__.py'), version, '__version__') else: set_filename_version(os.path.join(repo_path, os.path.basename(repo_path),'hooks.py'), version, 'staging_version') @@ -237,14 +238,14 @@ def commit_changes(repo_path, new_version, to_branch): repo = git.Repo(repo_path) app_name = os.path.basename(repo_path) - if to_branch.lower() == 'master': + if to_branch.lower() in ['version-11', 'version-12']: repo.index.add([os.path.join(app_name, '__init__.py')]) else: repo.index.add([os.path.join(app_name, 'hooks.py')]) repo.index.commit('bumped to version {}'.format(new_version)) -def create_release(repo_path, new_version, from_branch='develop', to_branch='master', frontport=True): +def create_release(repo_path, new_version, from_branch, to_branch, frontport=True): print('creating release for version', new_version) repo = git.Repo(repo_path) g = repo.git @@ -283,7 +284,7 @@ def handle_merge_error(e, source, target): print('-'*80) click.confirm('Have you manually resolved the error?', abort=True) -def push_release(repo_path, from_branch='develop', to_branch='master', remote='upstream'): +def push_release(repo_path, from_branch, to_branch, remote='upstream'): print('pushing branches', to_branch, from_branch, 'of', repo_path) repo = git.Repo(repo_path) g = repo.git From 5699204a587a48425b271cc65b154a411d0170c5 Mon Sep 17 00:00:00 2001 From: Sahil Khan Date: Fri, 19 Jul 2019 17:29:07 +0530 Subject: [PATCH 12/28] fix(release): accomodate future branches --- bench/release.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bench/release.py b/bench/release.py index 9e0252a1..02a32ff6 100755 --- a/bench/release.py +++ b/bench/release.py @@ -19,6 +19,8 @@ branches_to_update = { 'version-12-hotfix': [], } +releasable_branches = ['master'] + github_username = None github_password = None @@ -36,6 +38,9 @@ def release(bench_path, app, bump_type, from_branch, to_branch, if config.get('branches_to_update'): branches_to_update.update(config.get('branches_to_update')) + if config.get('releasable_branches'): + releasable_branches.extend(config.get('releasable_branches'),[]) + validate(bench_path, config) bump(bench_path, app, bump_type, from_branch=from_branch, to_branch=to_branch, owner=owner, @@ -141,7 +146,7 @@ def get_current_version(repo_path, to_branch): # TODO clean this up! version_key = '__version__' - if to_branch.lower() in ['version-11', 'version-12']: + if to_branch.lower() in releasable_branches: filename = os.path.join(repo_path, os.path.basename(repo_path), '__init__.py') else: filename = os.path.join(repo_path, os.path.basename(repo_path), 'hooks.py') @@ -195,7 +200,7 @@ def get_bumped_version(version, bump_type): return str(v) def set_version(repo_path, version, to_branch): - if to_branch.lower() in ['version-11', 'version-12']: + if to_branch.lower() in releasable_branches: set_filename_version(os.path.join(repo_path, os.path.basename(repo_path),'__init__.py'), version, '__version__') else: set_filename_version(os.path.join(repo_path, os.path.basename(repo_path),'hooks.py'), version, 'staging_version') @@ -238,7 +243,7 @@ def commit_changes(repo_path, new_version, to_branch): repo = git.Repo(repo_path) app_name = os.path.basename(repo_path) - if to_branch.lower() in ['version-11', 'version-12']: + if to_branch.lower() in releasable_branches: repo.index.add([os.path.join(app_name, '__init__.py')]) else: repo.index.add([os.path.join(app_name, 'hooks.py')]) From 0e91bf43fd2b337a8883cebe9f39aa0e2a0af96e Mon Sep 17 00:00:00 2001 From: Sahil Khan Date: Mon, 22 Jul 2019 16:01:36 +0530 Subject: [PATCH 13/28] fix(easy_install): add version argument for installing different versions --- playbooks/install.py | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/playbooks/install.py b/playbooks/install.py index 0fda3fa3..71ba385c 100644 --- a/playbooks/install.py +++ b/playbooks/install.py @@ -108,17 +108,25 @@ def install_bench(args): if args.production: extra_vars.update(max_worker_connections=multiprocessing.cpu_count() * 1024) - if args.frappe_branch: - frappe_branch = args.frappe_branch + if args.version: + if args.version <= 10: + frappe_branch = "{0}.x.x".format(args.version) + erpnext_branch = "{0}.x.x".format(args.version) + else: + frappe_branch = "version-{0}".format(args.version) + erpnext_branch = "version-{0}".format(args.version) else: - frappe_branch = 'master' if args.production else 'develop' - extra_vars.update(frappe_branch=frappe_branch) + if args.frappe_branch: + frappe_branch = args.frappe_branch + else: + frappe_branch = 'version-12' + extra_vars.update(frappe_branch=frappe_branch) - if args.erpnext_branch: - erpnext_branch = args.erpnext_branch - else: - erpnext_branch = 'master' if args.production else 'develop' - extra_vars.update(erpnext_branch=erpnext_branch) + if args.erpnext_branch: + erpnext_branch = args.erpnext_branch + else: + erpnext_branch = 'version-12' + extra_vars.update(erpnext_branch=erpnext_branch) bench_name = 'frappe-bench' if not args.bench_name else args.bench_name extra_vars.update(bench_name=bench_name) @@ -367,6 +375,10 @@ def parse_commandline_args(): parser.add_argument('--without-erpnext', dest='without_erpnext', action='store_true', default=False, help='Prevent fetching ERPNext') + # direct provision to install versions + parser.add_argument('--version', dest='version', action='store', default='12', type=int, + help='Clone particular version of frappe and erpnext') + # To enable testing of script using Travis, this should skip the prompt parser.add_argument('--run-travis', dest='run_travis', action='store_true', default=False, help=argparse.SUPPRESS) From d32d905567d40c99387cf7dc8cbbcaa57e631f65 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Mon, 22 Jul 2019 16:10:28 +0530 Subject: [PATCH 14/28] fix: validate branch before update --- bench/app.py | 10 ++++++++++ bench/commands/update.py | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bench/app.py b/bench/app.py index 896affa2..8b6c25e2 100755 --- a/bench/app.py +++ b/bench/app.py @@ -421,3 +421,13 @@ def get_apps_json(path): else: with open(path) as f: return json.load(f) + +def validate_branch(): + for app in ['frappe', 'erpnext']: + branch = get_current_branch(app) + + if branch == "master": + print(''' master branch is renamed to version-11 and develop to version-12. Please switch to new branches to get future updates. + +To switch to version 11, run the following commands: bench switch-to-branch version-11''') + sys.exit(1) \ No newline at end of file diff --git a/bench/commands/update.py b/bench/commands/update.py index e91eef1b..af32b424 100755 --- a/bench/commands/update.py +++ b/bench/commands/update.py @@ -1,7 +1,7 @@ import click import sys, os from bench.config.common_site_config import get_config, update_config -from bench.app import pull_all_apps, is_version_upgrade +from bench.app import pull_all_apps, is_version_upgrade, validate_branch from bench.utils import (update_bench, validate_upgrade, pre_upgrade, post_upgrade, before_update, update_requirements, update_node_packages, backup_all_sites, patch_sites, build_assets, restart_supervisor_processes, restart_systemd_processes) @@ -48,8 +48,9 @@ def update(pull=False, patch=False, build=False, bench=False, auto=False, restar print('Release bench, cannot update') sys.exit(1) - version_upgrade = is_version_upgrade() + validate_branch() + version_upgrade = is_version_upgrade() if version_upgrade[0]: print() print() From 94525d0721125a4108957a477edcc1d820f3b7e0 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Tue, 23 Jul 2019 12:04:47 +0530 Subject: [PATCH 15/28] fix: branch argument while running easy install --- playbooks/install.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/playbooks/install.py b/playbooks/install.py index 71ba385c..670ccbcc 100644 --- a/playbooks/install.py +++ b/playbooks/install.py @@ -108,6 +108,9 @@ def install_bench(args): if args.production: extra_vars.update(max_worker_connections=multiprocessing.cpu_count() * 1024) + frappe_branch = 'version-12' + erpnext_branch = 'version-12' + if args.version: if args.version <= 10: frappe_branch = "{0}.x.x".format(args.version) @@ -118,15 +121,12 @@ def install_bench(args): else: if args.frappe_branch: frappe_branch = args.frappe_branch - else: - frappe_branch = 'version-12' - extra_vars.update(frappe_branch=frappe_branch) if args.erpnext_branch: erpnext_branch = args.erpnext_branch - else: - erpnext_branch = 'version-12' - extra_vars.update(erpnext_branch=erpnext_branch) + + extra_vars.update(frappe_branch=frappe_branch) + extra_vars.update(erpnext_branch=erpnext_branch) bench_name = 'frappe-bench' if not args.bench_name else args.bench_name extra_vars.update(bench_name=bench_name) From 46b78f4a53485849fffa3354983f22f890fdc900 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Fri, 21 Jun 2019 11:50:30 +0530 Subject: [PATCH 16/28] fix: Remove the infamous print style --- bench/app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bench/app.py b/bench/app.py index 8b6c25e2..72f91020 100755 --- a/bench/app.py +++ b/bench/app.py @@ -1,3 +1,4 @@ +from __future__ import print_function import os from .utils import (exec_cmd, get_frappe, check_git_for_shallow_clone, build_assets, restart_supervisor_processes, get_cmd_output, run_frappe_cmd, CommandFailedError, From bdda0419ea165e41a279a8858b0568f1b5622990 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Mon, 1 Jul 2019 22:26:58 +0530 Subject: [PATCH 17/28] fix: Allow skipping assets --- bench/commands/make.py | 5 +++-- bench/utils.py | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/bench/commands/make.py b/bench/commands/make.py index e30f23d5..b3ca8341 100755 --- a/bench/commands/make.py +++ b/bench/commands/make.py @@ -13,10 +13,11 @@ import click @click.option('--no-backups',is_flag=True, help="Run migrations for all sites in the bench") @click.option('--no-auto-update',is_flag=True, help="Build JS and CSS artifacts for the bench") @click.option('--skip-redis-config-generation', is_flag=True, help="Skip redis config generation if already specifying the common-site-config file") +@click.option('--skip-assets',is_flag=True, default=False, help="Do not build assets") @click.option('--verbose',is_flag=True, help="Verbose output during install") def init(path, apps_path, frappe_path, frappe_branch, no_procfile, no_backups, no_auto_update, clone_from, verbose, skip_redis_config_generation, clone_without_update, - ignore_exist = False, + ignore_exist = False, skip_assets=False, python = 'python3'): ''' Create a New Bench Instance. @@ -26,7 +27,7 @@ def init(path, apps_path, frappe_path, frappe_branch, no_procfile, no_backups, no_auto_update=no_auto_update, frappe_path=frappe_path, frappe_branch=frappe_branch, verbose=verbose, clone_from=clone_from, skip_redis_config_generation=skip_redis_config_generation, clone_without_update=clone_without_update, - ignore_exist = ignore_exist, + ignore_exist = ignore_exist, skip_assets=skip_assets, python = python) click.echo('Bench {} initialized'.format(path)) diff --git a/bench/utils.py b/bench/utils.py index cee84833..496410d3 100755 --- a/bench/utils.py +++ b/bench/utils.py @@ -37,7 +37,7 @@ def init(path, apps_path=None, no_procfile=False, no_backups=False, no_auto_update=False, frappe_path=None, frappe_branch=None, wheel_cache_dir=None, verbose=False, clone_from=None, skip_redis_config_generation=False, clone_without_update=False, - ignore_exist = False, + ignore_exist = False, skip_assets=False, python = 'python3'): # Let's change when we're ready. - from .app import get_app, install_apps_from_path from .config.common_site_config import make_config @@ -80,10 +80,12 @@ def init(path, apps_path=None, no_procfile=False, no_backups=False, bench.set_frappe_version(bench_path=path) if bench.FRAPPE_VERSION > 5: - update_node_packages(bench_path=path) + if not skip_assets: + update_node_packages(bench_path=path) set_all_patches_executed(bench_path=path) - build_assets(bench_path=path) + if not skip_assets: + build_assets(bench_path=path) if not skip_redis_config_generation: redis.generate_config(path) From 46566cd9ac0bfe0a828b9a0fd6e89f37bfdebafe Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Tue, 23 Jul 2019 19:50:07 +0530 Subject: [PATCH 18/28] fix(ansible): Make everything verbose --- bench/utils.py | 2 +- playbooks/install.py | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/bench/utils.py b/bench/utils.py index 496410d3..c0fd88df 100755 --- a/bench/utils.py +++ b/bench/utils.py @@ -814,7 +814,7 @@ def run_playbook(playbook_name, extra_vars=None, tag=None): if not find_executable('ansible'): print("Ansible is needed to run this command, please install it using 'pip install ansible'") sys.exit(1) - args = ['ansible-playbook', '-c', 'local', playbook_name] + args = ['ansible-playbook', '-c', 'local', playbook_name, '-vvvv'] if extra_vars: args.extend(['-e', json.dumps(extra_vars)]) diff --git a/playbooks/install.py b/playbooks/install.py index 670ccbcc..ecabd422 100644 --- a/playbooks/install.py +++ b/playbooks/install.py @@ -310,14 +310,11 @@ def get_extra_vars_json(extra_args): return ('@' + json_path) def run_playbook(playbook_name, sudo=False, extra_vars=None): - args = ['ansible-playbook', '-c', 'local', playbook_name] + args = ['ansible-playbook', '-c', 'local', playbook_name , '-vvvv'] if extra_vars: args.extend(['-e', get_extra_vars_json(extra_vars)]) - if extra_vars.get('verbosity'): - args.append('-vvvv') - if sudo: user = extra_vars.get('user') or getpass.getuser() args.extend(['--become', '--become-user={0}'.format(user)]) From 1c8b4c032549af0822e2b027c32363491c71f2f0 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Tue, 23 Jul 2019 19:54:34 +0530 Subject: [PATCH 19/28] fix(travis): Use Ubuntu 16.04 --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index d3221fd8..b4b6de7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,10 @@ language: python -dist: trusty +dist: xenial python: - "2.7" install: - - sudo rm /etc/apt/sources.list.d/mongodb*.list - - sudo rm /etc/apt/sources.list.d/docker.list - sudo pip install urllib3 pyOpenSSL ndg-httpsclient pyasn1 - sudo apt-get purge -y mysql-common mysql-server mysql-client - sudo apt-get install --only-upgrade -y git From f57635eebf45bdda85c5d5c4fa2efc15dcfc7ee1 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Tue, 23 Jul 2019 20:00:05 +0530 Subject: [PATCH 20/28] fix(travis): Make install script verbose --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b4b6de7f..9df3b6d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ install: - cp -r $TRAVIS_BUILD_DIR/* ~/.bench - cp -r $TRAVIS_BUILD_DIR/* /tmp/.bench - - sudo python $TRAVIS_BUILD_DIR/playbooks/install.py --user travis --run-travis --production + - sudo python $TRAVIS_BUILD_DIR/playbooks/install.py --user travis --run-travis --production --verbose # - sudo bash $TRAVIS_BUILD_DIR/install_scripts/setup_frappe.sh --skip-install-bench --mysql-root-password travis # - cd ~ && sudo python bench-repo/installer/install.py --only-dependencies From 933d7a15b893f7faebc1eaba203e36f2cfaf15b8 Mon Sep 17 00:00:00 2001 From: Sahil Khan Date: Fri, 26 Jul 2019 15:41:28 +0530 Subject: [PATCH 21/28] fix(release): syntax error --- bench/release.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bench/release.py b/bench/release.py index 02a32ff6..ebf60f6a 100755 --- a/bench/release.py +++ b/bench/release.py @@ -39,7 +39,7 @@ def release(bench_path, app, bump_type, from_branch, to_branch, branches_to_update.update(config.get('branches_to_update')) if config.get('releasable_branches'): - releasable_branches.extend(config.get('releasable_branches'),[]) + releasable_branches.extend(config.get('releasable_branches',[])) validate(bench_path, config) From 7e89a233576720b03f9b2b7a32cbc6e334646339 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 31 Jul 2019 12:54:49 +0530 Subject: [PATCH 22/28] feat: update flags to readme --- README.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b4c68837..7890ae1b 100755 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ To manually install frappe/erpnext, you can follow this [this wiki](https://gith #### 1. Install Pre-requisites -- Python 2.7 [Python3.5+ also supported, but not recommended for production] +- Python 2.7 or Python 3.5+ - MariaDB 10+ - Nginx (for production) - Nodejs @@ -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 ``` -_(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 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: sudo python install.py --develop @@ -142,6 +138,18 @@ For production: sudo python install.py --production --user [frappe-user] +use --user flag to create a user and install using that user + + python install.py --develop --user [frappe-user] + +use --veresion 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? - Install all the pre-requisites From ccb58355e56946383f392e57b015226170756053 Mon Sep 17 00:00:00 2001 From: sahil28297 <37302950+sahil28297@users.noreply.github.com> Date: Thu, 1 Aug 2019 13:09:17 +0530 Subject: [PATCH 23/28] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7890ae1b..4bcd9971 100755 --- a/README.md +++ b/README.md @@ -142,7 +142,7 @@ use --user flag to create a user and install using that user python install.py --develop --user [frappe-user] -use --veresion flag to install specific version +use --version flag to install specific version python install.py --develop --version 11 --user [frappe-user] From 596a1f912f306a2a8e1236fed7626b708735741c Mon Sep 17 00:00:00 2001 From: sharky98 Date: Fri, 16 Aug 2019 20:04:59 -0400 Subject: [PATCH 24/28] Add description of the container flag --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 4bcd9971..7dc8788d 100755 --- a/README.md +++ b/README.md @@ -142,6 +142,10 @@ use --user flag to create a user and install using that user 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] From 5bedd2cb527c4b2c1680f73074903fd84cb530b3 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Sat, 24 Aug 2019 19:55:32 +0530 Subject: [PATCH 25/28] feat: Option to provide path to Procfile --- bench/commands/utils.py | 5 +++-- bench/utils.py | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bench/commands/utils.py b/bench/commands/utils.py index 9e829887..87cb15b3 100644 --- a/bench/commands/utils.py +++ b/bench/commands/utils.py @@ -5,10 +5,11 @@ import sys, os, copy @click.command('start') @click.option('--no-dev', is_flag=True, default=False) @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" from bench.utils import start - start(no_dev=no_dev, concurrency=concurrency) + start(no_dev=no_dev, concurrency=concurrency, procfile=procfile) @click.command('restart') diff --git a/bench/utils.py b/bench/utils.py index c0fd88df..84f98909 100755 --- a/bench/utils.py +++ b/bench/utils.py @@ -317,7 +317,7 @@ def get_program(programs): def get_process_manager(): 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() if not program: raise Exception("No process manager found") @@ -329,6 +329,9 @@ def start(no_dev=False, concurrency=None): if concurrency: command.extend(['-c', concurrency]) + if procfile: + command.extend(['-f', procfile]) + os.execv(program, command) def check_cmd(cmd, cwd='.'): From 31fc3a0ebb3f0532f1e099a4c6aae3ce641a75b7 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Tue, 27 Aug 2019 15:12:58 +0530 Subject: [PATCH 26/28] fix(pdf): Use libssl1.0-dev instead of libssl-dev --- playbooks/install.py | 2 +- playbooks/roles/common/tasks/debian_family.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/playbooks/install.py b/playbooks/install.py index ecabd422..87b7e6b8 100644 --- a/playbooks/install.py +++ b/playbooks/install.py @@ -14,7 +14,7 @@ def install_bench(args): success = run_os_command({ 'apt-get': [ '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 libssl1.0-dev' ], 'yum': [ 'sudo yum groupinstall -y "Development tools"', diff --git a/playbooks/roles/common/tasks/debian_family.yml b/playbooks/roles/common/tasks/debian_family.yml index 893b0632..5b1b9c3f 100644 --- a/playbooks/roles/common/tasks/debian_family.yml +++ b/playbooks/roles/common/tasks/debian_family.yml @@ -12,7 +12,7 @@ - libcrypto++-dev - libfreetype6-dev - liblcms2-dev - - libssl-dev + - libssl1.0-dev - libwebp-dev - libxext6 - libxrender1 From 893cb884eed520b6bea1a74ec28c37ac8c0a2767 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Thu, 5 Sep 2019 14:44:32 +0530 Subject: [PATCH 27/28] fix(security): Force download html, svg and xml files Same as https://github.com/frappe/frappe/pull/7074 for public files in production environment --- bench/config/templates/nginx.conf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bench/config/templates/nginx.conf b/bench/config/templates/nginx.conf index 629dad3c..557b97ae 100644 --- a/bench/config/templates/nginx.conf +++ b/bench/config/templates/nginx.conf @@ -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_prefer_server_ciphers on; {% endif %} - + add_header X-Frame-Options "SAMEORIGIN"; location /assets { @@ -58,6 +58,12 @@ server { } 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; } From 6dbf6b984640170fa71f67ae34401c7488b67606 Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Tue, 10 Sep 2019 17:59:36 +0530 Subject: [PATCH 28/28] fix: no-backup option argument (#842) * fix: --no-backup option set to 1 by default * Update bench/commands/__init__.py Co-Authored-By: Chinmay Pai --- bench/commands/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bench/commands/__init__.py b/bench/commands/__init__.py index 0da08013..cb749420 100755 --- a/bench/commands/__init__.py +++ b/bench/commands/__init__.py @@ -89,7 +89,7 @@ except ImportError: @click.command('migrate-env') @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): """ Migrate Virtual Environment to desired Python Version.