Example #1
0
def setup_manager(yes=False, port=23624, domain=None):
	"Setup bench-manager.local site with the bench_manager app installed on it"
	from six.moves import input
	create_new_site = True
	if 'bench-manager.local' in os.listdir('sites'): 
		ans = input('Site aleady exists. Overwrite existing new site? [Y/n]: ')
		while ans.lower() not in ['y', 'n', '']:
			ans = input('Please type "y" or "n". Site aleady exists. Overwrite existing new site? [Y/n]: ')
		if ans=='n': create_new_site = False
	if create_new_site: exec_cmd("bench new-site --force bench-manager.local")

	if 'bench_manager' in os.listdir('apps'):
		print('App aleady exists. Skipping downloading the app')
	else: 
		exec_cmd("bench get-app bench_manager")

	exec_cmd("bench --site bench-manager.local install-app bench_manager")

	from bench.config.common_site_config import get_config
	bench_path = '.'
	conf = get_config(bench_path)
	if conf.get('restart_supervisor_on_update') or conf.get('restart_systemd_on_update'):
		# implicates a production setup or so I presume
		if not domain:
			print("Please specify the site name on which you want to host bench-manager using the 'domain' flag")
			sys.exit(1)
	
		from bench.utils import get_sites, get_bench_name
		bench_name = get_bench_name(bench_path)

		if domain not in get_sites(bench_path):
			raise Exception("No such site")

		from bench.config.nginx import make_bench_manager_nginx_conf
		make_bench_manager_nginx_conf(bench_path, yes=yes, port=port, domain=domain)
Example #2
0
def setup_manager(yes=False, port=23624, domain=None):
    from six.moves import input
    from bench.utils import get_sites
    from bench.config.common_site_config import get_config
    from bench.config.nginx import make_bench_manager_nginx_conf

    create_new_site = True

    if "bench-manager.local" in os.listdir("sites"):
        ans = input(
            "Site already exists. Overwrite existing site? [Y/n]: ").lower()
        while ans not in ("y", "n", ""):
            ans = input(
                "Please enter 'y' or 'n'. Site already exists. Overwrite existing site? [Y/n]: "
            ).lower()
        if ans == "n":
            create_new_site = False

    if create_new_site:
        exec_cmd("bench new-site --force bench-manager.local")

    if "bench_manager" in os.listdir("apps"):
        print("App already exists. Skipping app download.")
    else:
        exec_cmd("bench get-app bench_manager")

    exec_cmd("bench --site bench-manager.local install-app bench_manager")

    bench_path = "."
    conf = get_config(bench_path)

    if conf.get("restart_supervisor_on_update") or conf.get(
            "restart_systemd_on_update"):
        # implicates a production setup or so I presume
        if not domain:
            print(
                "Please specify the site name on which you want to host bench-manager using the 'domain' flag"
            )
            sys.exit(1)

        if domain not in get_sites(bench_path):
            raise Exception("No such site")

        make_bench_manager_nginx_conf(bench_path,
                                      yes=yes,
                                      port=port,
                                      domain=domain)
Example #3
0
def setup_manager(yes=False, port=23624, domain=None):
    "Setup bench-manager.local site with the bench_manager app installed on it"
    from six.moves import input
    create_new_site = True
    if 'bench-manager.local' in os.listdir('sites'):
        ans = input(
            'Site already exists. Overwrite existing site? [Y/n]: ').lower()
        while ans not in ('y', 'n', ''):
            ans = input(
                'Please enter "y" or "n". Site already exists. Overwrite existing site? [Y/n]: '
            ).lower()
        if ans == 'n':
            create_new_site = False
    if create_new_site:
        exec_cmd("bench new-site --force bench-manager.local")

    if 'bench_manager' in os.listdir('apps'):
        print('App already exists. Skipping app download.')
    else:
        exec_cmd("bench get-app bench_manager")

    exec_cmd("bench --site bench-manager.local install-app bench_manager")

    from bench.config.common_site_config import get_config
    bench_path = '.'
    conf = get_config(bench_path)
    if conf.get('restart_supervisor_on_update') or conf.get(
            'restart_systemd_on_update'):
        # implicates a production setup or so I presume
        if not domain:
            print(
                "Please specify the site name on which you want to host bench-manager using the 'domain' flag"
            )
            sys.exit(1)

        from bench.utils import get_sites, get_bench_name
        bench_name = get_bench_name(bench_path)

        if domain not in get_sites(bench_path):
            raise Exception("No such site")

        from bench.config.nginx import make_bench_manager_nginx_conf
        make_bench_manager_nginx_conf(bench_path,
                                      yes=yes,
                                      port=port,
                                      domain=domain)