mirror of
https://github.com/frappe/bench.git
synced 2024-11-14 09:14:04 +00:00
Merge branch 'develop' into patch-6
This commit is contained in:
commit
485aaa074d
@ -15,11 +15,12 @@ from bench.utils import post_upgrade, patch_sites, build_assets
|
|||||||
@click.option('--restart-supervisor', is_flag=True, help="Restart supervisor processes after update")
|
@click.option('--restart-supervisor', is_flag=True, help="Restart supervisor processes after update")
|
||||||
@click.option('--restart-systemd', is_flag=True, help="Restart systemd units after update")
|
@click.option('--restart-systemd', is_flag=True, help="Restart systemd units after update")
|
||||||
@click.option('--no-backup', is_flag=True, help="If this flag is set, sites won't be backed up prior to updates. Note: This is not recommended in production.")
|
@click.option('--no-backup', is_flag=True, help="If this flag is set, sites won't be backed up prior to updates. Note: This is not recommended in production.")
|
||||||
|
@click.option('--no-compile', is_flag=True, help="If set, Python bytecode won't be compiled before restarting the processes")
|
||||||
@click.option('--force', is_flag=True, help="Forces major version upgrades")
|
@click.option('--force', is_flag=True, help="Forces major version upgrades")
|
||||||
@click.option('--reset', is_flag=True, help="Hard resets git branch's to their new states overriding any changes and overriding rebase on pull")
|
@click.option('--reset', is_flag=True, help="Hard resets git branch's to their new states overriding any changes and overriding rebase on pull")
|
||||||
def update(pull, apps, patch, build, requirements, restart_supervisor, restart_systemd, no_backup, force, reset):
|
def update(pull, apps, patch, build, requirements, restart_supervisor, restart_systemd, no_backup, no_compile, force, reset):
|
||||||
from bench.utils import update
|
from bench.utils import update
|
||||||
update(pull=pull, apps=apps, patch=patch, build=build, requirements=requirements, restart_supervisor=restart_supervisor, restart_systemd=restart_systemd, backup=not no_backup, force=force, reset=reset)
|
update(pull=pull, apps=apps, patch=patch, build=build, requirements=requirements, restart_supervisor=restart_supervisor, restart_systemd=restart_systemd, backup=not no_backup, compile=not no_compile, force=force, reset=reset)
|
||||||
|
|
||||||
|
|
||||||
@click.command('retry-upgrade', help="Retry a failed upgrade")
|
@click.command('retry-upgrade', help="Retry a failed upgrade")
|
||||||
|
@ -24,7 +24,14 @@
|
|||||||
get_url:
|
get_url:
|
||||||
url: https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.focal_amd64.deb
|
url: https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.focal_amd64.deb
|
||||||
dest: /tmp/wkhtmltox.deb
|
dest: /tmp/wkhtmltox.deb
|
||||||
when: ansible_distribution == 'Ubuntu' and ansible_distribution_major_version == '20'
|
when: ansible_distribution == 'Ubuntu' and ansible_distribution_major_version == '20' and ansible_architecture != 'aarch64'
|
||||||
|
|
||||||
|
- name: download wkthmltox Ubuntu 20 arm64
|
||||||
|
get_url:
|
||||||
|
# wkhtmltox supports arm64 starting from 0.12.6
|
||||||
|
url: https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_arm64.deb
|
||||||
|
dest: /tmp/wkhtmltox.deb
|
||||||
|
when: ansible_distribution == 'Ubuntu' and ansible_distribution_major_version == '20' and ansible_architecture == 'aarch64'
|
||||||
|
|
||||||
- name: download wkthmltox Ubuntu 18
|
- name: download wkthmltox Ubuntu 18
|
||||||
get_url:
|
get_url:
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# imports - standard imports
|
# imports - standard imports
|
||||||
|
import compileall
|
||||||
import errno
|
import errno
|
||||||
import glob
|
import glob
|
||||||
import grp
|
import grp
|
||||||
@ -183,8 +184,8 @@ def init(path, apps_path=None, no_procfile=False, no_backups=False,
|
|||||||
copy_patches_txt(path)
|
copy_patches_txt(path)
|
||||||
|
|
||||||
|
|
||||||
def update(pull=False, apps=None, patch=False, build=False, requirements=False, backup=True, force=False, reset=False,
|
def update(pull=False, apps=None, patch=False, build=False, requirements=False, backup=True, compile=True,
|
||||||
restart_supervisor=False, restart_systemd=False):
|
force=False, reset=False, restart_supervisor=False, restart_systemd=False):
|
||||||
"""command: bench update"""
|
"""command: bench update"""
|
||||||
from bench import patches
|
from bench import patches
|
||||||
from bench.app import is_version_upgrade, pull_apps, validate_branch
|
from bench.app import is_version_upgrade, pull_apps, validate_branch
|
||||||
@ -218,7 +219,6 @@ def update(pull=False, apps=None, patch=False, build=False, requirements=False,
|
|||||||
|
|
||||||
if version_upgrade[0] or (not version_upgrade[0] and force):
|
if version_upgrade[0] or (not version_upgrade[0] and force):
|
||||||
validate_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path)
|
validate_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path)
|
||||||
|
|
||||||
conf.update({ "maintenance_mode": 1, "pause_scheduler": 1 })
|
conf.update({ "maintenance_mode": 1, "pause_scheduler": 1 })
|
||||||
update_config(conf, bench_path=bench_path)
|
update_config(conf, bench_path=bench_path)
|
||||||
|
|
||||||
@ -246,6 +246,10 @@ def update(pull=False, apps=None, patch=False, build=False, requirements=False,
|
|||||||
if version_upgrade[0] or (not version_upgrade[0] and force):
|
if version_upgrade[0] or (not version_upgrade[0] and force):
|
||||||
post_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path)
|
post_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path)
|
||||||
|
|
||||||
|
if pull and compile:
|
||||||
|
print("Compiling Python files...")
|
||||||
|
compileall.compile_dir('../apps', quiet=1, rx=re.compile('.*node_modules.*'))
|
||||||
|
|
||||||
if restart_supervisor or conf.get('restart_supervisor_on_update'):
|
if restart_supervisor or conf.get('restart_supervisor_on_update'):
|
||||||
restart_supervisor_processes(bench_path=bench_path)
|
restart_supervisor_processes(bench_path=bench_path)
|
||||||
|
|
||||||
|
25
install.py
25
install.py
@ -255,12 +255,11 @@ def install_bench(args):
|
|||||||
else:
|
else:
|
||||||
frappe_branch = "version-{0}".format(args.version)
|
frappe_branch = "version-{0}".format(args.version)
|
||||||
erpnext_branch = "version-{0}".format(args.version)
|
erpnext_branch = "version-{0}".format(args.version)
|
||||||
else:
|
# Allow override of frappe_branch and erpnext_branch, regardless of args.version (which always has a default set)
|
||||||
if args.frappe_branch:
|
if args.frappe_branch:
|
||||||
frappe_branch = args.frappe_branch
|
frappe_branch = args.frappe_branch
|
||||||
|
if args.erpnext_branch:
|
||||||
if args.erpnext_branch:
|
erpnext_branch = args.erpnext_branch
|
||||||
erpnext_branch = args.erpnext_branch
|
|
||||||
|
|
||||||
extra_vars.update(frappe_branch=frappe_branch)
|
extra_vars.update(frappe_branch=frappe_branch)
|
||||||
extra_vars.update(erpnext_branch=erpnext_branch)
|
extra_vars.update(erpnext_branch=erpnext_branch)
|
||||||
@ -269,6 +268,10 @@ def install_bench(args):
|
|||||||
extra_vars.update(bench_name=bench_name)
|
extra_vars.update(bench_name=bench_name)
|
||||||
|
|
||||||
# Will install ERPNext production setup by default
|
# Will install ERPNext production setup by default
|
||||||
|
if args.without_erpnext:
|
||||||
|
log("Initializing bench {bench_name}:\n\tFrappe Branch: {frappe_branch}\n\tERPNext will not be installed due to --without-erpnext".format(bench_name=bench_name, frappe_branch=frappe_branch))
|
||||||
|
else:
|
||||||
|
log("Initializing bench {bench_name}:\n\tFrappe Branch: {frappe_branch}\n\tERPNext Branch: {erpnext_branch}".format(bench_name=bench_name, frappe_branch=frappe_branch, erpnext_branch=erpnext_branch))
|
||||||
run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
|
run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
|
||||||
|
|
||||||
if os.path.exists(tmp_bench_repo):
|
if os.path.exists(tmp_bench_repo):
|
||||||
@ -281,11 +284,15 @@ def clone_bench_repo(args):
|
|||||||
repo_url = args.repo_url or 'https://github.com/frappe/bench'
|
repo_url = args.repo_url or 'https://github.com/frappe/bench'
|
||||||
|
|
||||||
if os.path.exists(tmp_bench_repo):
|
if os.path.exists(tmp_bench_repo):
|
||||||
|
log('Not cloning already existing Bench repository at {tmp_bench_repo}'.format(tmp_bench_repo=tmp_bench_repo))
|
||||||
return 0
|
return 0
|
||||||
elif args.without_bench_setup:
|
elif args.without_bench_setup:
|
||||||
clone_path = os.path.join(os.path.expanduser('~'), 'bench')
|
clone_path = os.path.join(os.path.expanduser('~'), 'bench')
|
||||||
|
log('--without-bench-setup specified, clone path is: {clone_path}'.format(clone_path=clone_path))
|
||||||
else:
|
else:
|
||||||
clone_path = tmp_bench_repo
|
clone_path = tmp_bench_repo
|
||||||
|
# Not logging repo_url to avoid accidental credential leak in case credential is embedded in URL
|
||||||
|
log('Cloning bench repository branch {branch} into {clone_path}'.format(branch=branch, clone_path=clone_path))
|
||||||
|
|
||||||
success = run_os_command(
|
success = run_os_command(
|
||||||
{'git': 'git clone --quiet {repo_url} {bench_repo} --depth 1 --branch {branch}'.format(
|
{'git': 'git clone --quiet {repo_url} {bench_repo} --depth 1 --branch {branch}'.format(
|
||||||
@ -344,6 +351,8 @@ def get_passwords(args):
|
|||||||
passwords_didnt_match("Administrator")
|
passwords_didnt_match("Administrator")
|
||||||
admin_password = ''
|
admin_password = ''
|
||||||
continue
|
continue
|
||||||
|
elif args.without_site:
|
||||||
|
log("Not creating a new site due to --without-site")
|
||||||
|
|
||||||
pass_set = False
|
pass_set = False
|
||||||
else:
|
else:
|
||||||
@ -413,8 +422,8 @@ def parse_commandline_args():
|
|||||||
|
|
||||||
args_group.add_argument('--develop', dest='develop', action='store_true', default=False, help='Install developer setup')
|
args_group.add_argument('--develop', dest='develop', action='store_true', default=False, help='Install developer setup')
|
||||||
args_group.add_argument('--production', dest='production', action='store_true', default=False, help='Setup Production environment for bench')
|
args_group.add_argument('--production', dest='production', action='store_true', default=False, help='Setup Production environment for bench')
|
||||||
parser.add_argument('--site', dest='site', action='store', default='site1.local', help='Specifiy name for your first ERPNext site')
|
parser.add_argument('--site', dest='site', action='store', default='site1.local', help='Specify name for your first ERPNext site')
|
||||||
parser.add_argument('--without-site', dest='without_site', action='store_true', default=False)
|
parser.add_argument('--without-site', dest='without_site', action='store_true', default=False, help='Do not create a new site')
|
||||||
parser.add_argument('--verbose', dest='verbose', action='store_true', default=False, help='Run the script in verbose mode')
|
parser.add_argument('--verbose', dest='verbose', action='store_true', default=False, help='Run the script in verbose mode')
|
||||||
parser.add_argument('--user', dest='user', help='Install frappe-bench for this user')
|
parser.add_argument('--user', dest='user', help='Install frappe-bench for this user')
|
||||||
parser.add_argument('--bench-branch', dest='bench_branch', help='Clone a particular branch of bench repository')
|
parser.add_argument('--bench-branch', dest='bench_branch', help='Clone a particular branch of bench repository')
|
||||||
|
Loading…
Reference in New Issue
Block a user