Example #1
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()
Example #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()
Example #3
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()
Example #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()
Example #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')
Example #6
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')