mirror of
https://github.com/frappe/bench.git
synced 2025-01-23 15:08:24 +00:00
Merge branch 'master' into vrms_enhance-README
This commit is contained in:
commit
70ce045feb
@ -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
|
||||
@ -16,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
|
||||
|
||||
|
24
README.md
24
README.md
@ -31,11 +31,11 @@ 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
|
||||
|
||||
- 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
|
||||
@ -128,10 +128,6 @@ If you are on a fresh server and logged in as root, at first create a dedicated
|
||||
|
||||
*(it is very common to use "frappe" as frappe-username, but this comes with the security flaw of ["frappe" ranking very high](https://www.reddit.com/r/dataisbeautiful/comments/b3sirt/i_deployed_over_a_dozen_cyber_honeypots_all_over/?st=JTJ0SC0Q&sh=76e05240) in as a username challenged in hacking attempts. So, for production sites it is highly recommended to use a custom username harder to guess)*
|
||||
|
||||
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
|
||||
@ -140,6 +136,22 @@ 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 --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?
|
||||
|
||||
- Install all the pre-requisites
|
||||
|
11
bench/app.py
11
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,
|
||||
@ -421,3 +422,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)
|
@ -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.
|
||||
|
@ -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")
|
||||
@ -13,11 +13,12 @@ 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,
|
||||
python = 'python'): # Let's change we're ready. - <achilles@frappe.io>
|
||||
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))
|
||||
|
||||
|
@ -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)
|
||||
|
@ -1,7 +1,7 @@
|
||||
import click
|
||||
import sys, os
|
||||
from bench.config.common_site_config import get_config
|
||||
from bench.app import pull_all_apps, is_version_upgrade
|
||||
from bench.config.common_site_config import get_config, update_config
|
||||
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()
|
||||
@ -69,6 +70,13 @@ def _update(pull=False, patch=False, build=False, update_bench=False, auto=False
|
||||
|
||||
before_update(bench_path=bench_path, requirements=requirements)
|
||||
|
||||
conf.update({ "maintenance_mode": 1, "pause_scheduler": 1 })
|
||||
update_config(conf, 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 +97,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 +108,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)
|
||||
|
||||
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).")
|
||||
print("Open source depends on your contributions, so please contribute bug reports, patches, fixes or cash and be a part of the community")
|
||||
|
@ -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')
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -15,13 +15,16 @@ import click
|
||||
|
||||
branches_to_update = {
|
||||
'develop': [],
|
||||
'hotfix': ['develop']
|
||||
'version-11-hotfix': [],
|
||||
'version-12-hotfix': [],
|
||||
}
|
||||
|
||||
releasable_branches = ['master']
|
||||
|
||||
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()
|
||||
@ -35,6 +38,9 @@ def release(bench_path, app, bump_type, from_branch='develop', to_branch='master
|
||||
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,
|
||||
@ -91,7 +97,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 +122,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 +133,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 +146,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 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')
|
||||
@ -194,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() == 'master':
|
||||
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')
|
||||
@ -237,14 +243,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 releasable_branches:
|
||||
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 +289,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
|
||||
|
@ -37,8 +37,8 @@ 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,
|
||||
python = 'python'): # Let's change when we're ready. - <achilles@frappe.io>
|
||||
ignore_exist = False, skip_assets=False,
|
||||
python = 'python3'): # Let's change when we're ready. - <achilles@frappe.io>
|
||||
from .app import get_app, install_apps_from_path
|
||||
from .config.common_site_config import make_config
|
||||
from .config import redis
|
||||
@ -80,9 +80,11 @@ def init(path, apps_path=None, no_procfile=False, no_backups=False,
|
||||
|
||||
bench.set_frappe_version(bench_path=path)
|
||||
if bench.FRAPPE_VERSION > 5:
|
||||
if not skip_assets:
|
||||
update_node_packages(bench_path=path)
|
||||
|
||||
set_all_patches_executed(bench_path=path)
|
||||
if not skip_assets:
|
||||
build_assets(bench_path=path)
|
||||
|
||||
if not skip_redis_config_generation:
|
||||
@ -169,7 +171,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')
|
||||
|
||||
@ -315,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")
|
||||
@ -327,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='.'):
|
||||
@ -812,7 +817,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)])
|
||||
|
@ -1,6 +1,8 @@
|
||||
---
|
||||
|
||||
- hosts: localhost
|
||||
become: yes
|
||||
become_user: root
|
||||
tasks:
|
||||
- name: Create user
|
||||
user:
|
||||
|
@ -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 libssl1.0-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,7 +85,6 @@ 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'
|
||||
@ -109,16 +108,24 @@ 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)
|
||||
erpnext_branch = "{0}.x.x".format(args.version)
|
||||
else:
|
||||
frappe_branch = "version-{0}".format(args.version)
|
||||
erpnext_branch = "version-{0}".format(args.version)
|
||||
else:
|
||||
if args.frappe_branch:
|
||||
frappe_branch = args.frappe_branch
|
||||
else:
|
||||
frappe_branch = 'master' if args.production else 'develop'
|
||||
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(frappe_branch=frappe_branch)
|
||||
extra_vars.update(erpnext_branch=erpnext_branch)
|
||||
|
||||
bench_name = 'frappe-bench' if not args.bench_name else args.bench_name
|
||||
@ -135,7 +142,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()
|
||||
@ -157,27 +164,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)
|
||||
|
||||
@ -324,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)])
|
||||
@ -389,6 +372,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)
|
||||
@ -407,7 +394,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 +408,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)
|
||||
|
@ -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
|
||||
|
@ -12,7 +12,7 @@
|
||||
- libcrypto++-dev
|
||||
- libfreetype6-dev
|
||||
- liblcms2-dev
|
||||
- libssl-dev
|
||||
- libssl1.0-dev
|
||||
- libwebp-dev
|
||||
- libxext6
|
||||
- libxrender1
|
||||
@ -21,8 +21,7 @@
|
||||
- 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
|
||||
- vim # Is that supposed to be a question!?
|
||||
|
@ -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'
|
||||
|
@ -27,6 +27,5 @@
|
||||
- mariadb-client
|
||||
- mariadb-common
|
||||
- libmariadbclient18
|
||||
- python-mysqldb
|
||||
- python3-mysqldb
|
||||
...
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
python install.py --develop --user frappe --mysql-root-password frappe --admin-password admin
|
@ -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
|
||||
python install.py --production --user frappe --mysql-root-password frappe --admin-password admin
|
4
vm/scripts/debian_family/install_prerequisites.sh
Normal file
4
vm/scripts/debian_family/install_prerequisites.sh
Normal file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash -eux
|
||||
|
||||
# Install base requirements.
|
||||
apt-get install -y curl git wget vim python-dev gcc
|
@ -73,6 +73,9 @@
|
||||
},{
|
||||
"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",
|
||||
|
@ -72,6 +72,9 @@
|
||||
},{
|
||||
"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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user