Exemple #1
0
def setup_production(user, bench_path='.', yes=False):
	if get_config(bench_path).get('restart_supervisor_on_update') and get_config(bench_path).get('restart_systemd_on_update'):
		raise Exception("You cannot use supervisor and systemd at the same time. Modify your common_site_config accordingly." )

	if get_config(bench_path).get('restart_systemd_on_update'):
		generate_systemd_config(bench_path=bench_path, user=user, yes=yes)
	else:
		generate_supervisor_config(bench_path=bench_path, user=user, yes=yes)
	make_nginx_conf(bench_path=bench_path, yes=yes)
	fix_prod_setup_perms(bench_path, dataent_user=user)
	remove_default_nginx_configs()

	bench_name = get_bench_name(bench_path)
	nginx_conf = '/etc/nginx/conf.d/{bench_name}.conf'.format(bench_name=bench_name)

	if get_config(bench_path).get('restart_supervisor_on_update'):
		supervisor_conf_extn = "ini" if is_centos7() else "conf"
		supervisor_conf = os.path.join(get_supervisor_confdir(), '{bench_name}.{extn}'.format(
			bench_name=bench_name, extn=supervisor_conf_extn))

		# Check if symlink exists, If not then create it.
		if not os.path.islink(supervisor_conf):
			os.symlink(os.path.abspath(os.path.join(bench_path, 'config', 'supervisor.conf')), supervisor_conf)

	if not os.path.islink(nginx_conf):
		os.symlink(os.path.abspath(os.path.join(bench_path, 'config', 'nginx.conf')), nginx_conf)

	if get_config(bench_path).get('restart_supervisor_on_update'):
		reload_supervisor()

	if os.environ.get('NO_SERVICE_RESTART'):
		return

	reload_nginx()
Exemple #2
0
def setup_production(user, bench_path='.'):
	generate_supervisor_config(bench_path=bench_path, user=user)
	make_nginx_conf(bench_path=bench_path)
	fix_prod_setup_perms(bench_path, frappe_user=user)
	remove_default_nginx_configs()

	bench_name = get_bench_name(bench_path)
	nginx_conf = '/etc/nginx/conf.d/{bench_name}.conf'.format(bench_name=bench_name)

	supervisor_conf_extn = "ini" if is_centos7() else "conf"
	supervisor_conf = os.path.join(get_supervisor_confdir(), '{bench_name}.{extn}'.format(
		bench_name=bench_name, extn=supervisor_conf_extn))

	# Check if symlink exists, If not then create it.
	if not os.path.islink(supervisor_conf):
		os.symlink(os.path.abspath(os.path.join(bench_path, 'config', 'supervisor.conf')), supervisor_conf)

	if not os.path.islink(nginx_conf):
		os.symlink(os.path.abspath(os.path.join(bench_path, 'config', 'nginx.conf')), nginx_conf)

	reload_supervisor()

	if os.environ.get('NO_SERVICE_RESTART'):
		return

	reload_nginx()
Exemple #3
0
def setup_production(user, bench_path='.'):
    generate_supervisor_config(bench_path=bench_path, user=user)
    make_nginx_conf(bench_path=bench_path)
    fix_prod_setup_perms(bench_path, frappe_user=user)
    remove_default_nginx_configs()

    bench_name = get_bench_name(bench_path)
    nginx_conf = '/etc/nginx/conf.d/{bench_name}.conf'.format(
        bench_name=bench_name)

    supervisor_conf_extn = "ini" if is_centos7() else "conf"
    supervisor_conf = os.path.join(
        get_supervisor_confdir(),
        '{bench_name}.{extn}'.format(bench_name=bench_name,
                                     extn=supervisor_conf_extn))

    # Check if symlink exists, If not then create it.
    if not os.path.islink(supervisor_conf):
        os.symlink(
            os.path.abspath(
                os.path.join(bench_path, 'config', 'supervisor.conf')),
            supervisor_conf)

    if not os.path.islink(nginx_conf):
        os.symlink(
            os.path.abspath(os.path.join(bench_path, 'config', 'nginx.conf')),
            nginx_conf)

    reload_supervisor()

    if os.environ.get('NO_SERVICE_RESTART'):
        return

    reload_nginx()
Exemple #4
0
def setup_production(user, bench_path='.', yes=False):
	if get_config(bench_path).get('restart_supervisor_on_update') and get_config(bench_path).get('restart_systemd_on_update'):
		raise Exception("You cannot use supervisor and systemd at the same time. Modify your common_site_config accordingly." )

	if get_config(bench_path).get('restart_systemd_on_update'):
		generate_systemd_config(bench_path=bench_path, user=user, yes=yes)
	else:
		generate_supervisor_config(bench_path=bench_path, user=user, yes=yes)
	make_nginx_conf(bench_path=bench_path, yes=yes)
	fix_prod_setup_perms(bench_path, frappe_user=user)
	remove_default_nginx_configs()

	bench_name = get_bench_name(bench_path)
	nginx_conf = '/etc/nginx/conf.d/{bench_name}.conf'.format(bench_name=bench_name)

	if get_config(bench_path).get('restart_supervisor_on_update'):
		supervisor_conf_extn = "ini" if is_centos7() else "conf"
		supervisor_conf = os.path.join(get_supervisor_confdir(), '{bench_name}.{extn}'.format(
			bench_name=bench_name, extn=supervisor_conf_extn))

		# Check if symlink exists, If not then create it.
		if not os.path.islink(supervisor_conf):
			os.symlink(os.path.abspath(os.path.join(bench_path, 'config', 'supervisor.conf')), supervisor_conf)

	if not os.path.islink(nginx_conf):
		os.symlink(os.path.abspath(os.path.join(bench_path, 'config', 'nginx.conf')), nginx_conf)

	if get_config(bench_path).get('restart_supervisor_on_update'):
		reload_supervisor()

	if os.environ.get('NO_SERVICE_RESTART'):
		return

	reload_nginx()
Exemple #5
0
def setup_production(user, bench='.'):
    generate_supervisor_config(bench_path=bench, user=user)
    make_nginx_conf(bench_path=bench)
    fix_prod_setup_perms(bench, frappe_user=user)
    remove_default_nginx_configs()

    bench_name = get_bench_name(bench)
    nginx_conf = '/etc/nginx/conf.d/{bench_name}.conf'.format(
        bench_name=bench_name)

    supervisor_conf_extn = "ini" if is_centos7() else "conf"
    supervisor_conf = os.path.join(
        get_supervisor_confdir(),
        '{bench_name}.{extn}'.format(bench_name=bench_name,
                                     extn=supervisor_conf_extn))

    os.symlink(
        os.path.abspath(os.path.join(bench, 'config', 'supervisor.conf')),
        supervisor_conf)
    os.symlink(os.path.abspath(os.path.join(bench, 'config', 'nginx.conf')),
               nginx_conf)

    exec_cmd('supervisorctl reload')
    if os.environ.get('NO_SERVICE_RESTART'):
        return

    restart_service('nginx')
def execute(bench_path):
	click.confirm('\nThis update will remove Celery config and prepare the bench to use Python RQ.\n'
		'And it will overwrite Procfile and supervisor.conf.\n'
		'If you don\'t know what this means, type Y ;)\n\n'
		'Do you want to continue?',
		abort=True)

	setup_procfile(bench_path, force=True)

	# if production setup
	if os.path.exists(os.path.join(bench_path, 'config', 'supervisor.conf')):
		generate_supervisor_config(bench_path, force=True)
def execute(bench_path):
    click.confirm(
        '\nThis update will remove Celery config and prepare the bench to use Python RQ.\n'
        'And it will overwrite Procfile and supervisor.conf.\n'
        'If you don\'t know what this means, type Y ;)\n\n'
        'Do you want to continue?',
        abort=True)

    setup_procfile(bench_path, force=True)

    # if production setup
    if os.path.exists(os.path.join(bench_path, 'config', 'supervisor.conf')):
        generate_supervisor_config(bench_path, force=True)
def execute(bench_path):
	frappe_branch = get_current_branch('frappe', bench_path)
	frappe_version = get_current_frappe_version(bench_path)

	if not (frappe_branch=='develop' or frappe_version >= 7):
		# not version 7+
		# prevent running this patch
		return False

	click.confirm('\nThis update will remove Celery config and prepare the bench to use Python RQ.\n'
		'And it will overwrite Procfile and supervisor.conf.\n'
		'If you don\'t know what this means, type Y ;)\n\n'
		'Do you want to continue?',
		abort=True)

	setup_procfile(bench_path, yes=True)

	# if production setup
	if os.path.exists(os.path.join(bench_path, 'config', 'supervisor.conf')):
		generate_supervisor_config(bench_path, yes=True)
def setup_production(user, bench='.'):
	generate_supervisor_config(bench_path=bench, user=user)
	make_nginx_conf(bench_path=bench)
	fix_prod_setup_perms(bench, frappe_user=user)
	remove_default_nginx_configs()

	bench_name = get_bench_name(bench)
	nginx_conf = '/etc/nginx/conf.d/{bench_name}.conf'.format(bench_name=bench_name)

	supervisor_conf_extn = "ini" if is_centos7() else "conf"
	supervisor_conf = os.path.join(get_supervisor_confdir(), '{bench_name}.{extn}'.format(
		bench_name=bench_name, extn=supervisor_conf_extn))


	os.symlink(os.path.abspath(os.path.join(bench, 'config', 'supervisor.conf')), supervisor_conf)
	os.symlink(os.path.abspath(os.path.join(bench, 'config', 'nginx.conf')), nginx_conf)

	exec_cmd('supervisorctl reload')
	if os.environ.get('NO_SERVICE_RESTART'):
		return

	restart_service('nginx')
Exemple #10
0
def setup_supervisor(user=None, yes=False):
    "generate config for supervisor with an optional user argument"
    from bench.config.supervisor import generate_supervisor_config
    generate_supervisor_config(bench_path=".", user=user, yes=yes)
Exemple #11
0
def setup_supervisor(user=None, yes=False):
	"generate config for supervisor with an optional user argument"
	from bench.config.supervisor import generate_supervisor_config
	generate_supervisor_config(bench_path=".", user=user, yes=yes)
Exemple #12
0
def setup_supervisor(user=None, yes=False):
    from bench.config.supervisor import generate_supervisor_config
    generate_supervisor_config(bench_path=".", user=user, yes=yes)
Exemple #13
0
def setup_supervisor():
	"generate config for supervisor"
	from bench.config.supervisor import generate_supervisor_config
	generate_supervisor_config(bench_path=".")