def test_setup_production(self):
        self.test_multiple_benches()

        user = getpass.getuser()

        for bench_name in ("test-bench-1", "test-bench-2"):
            bench_path = os.path.join(os.path.abspath(self.benches_path),
                                      bench_name)
            setup_production(user, bench_path)
            self.assert_nginx_config(bench_name)
            self.assert_supervisor_config(bench_name)

        # test after start of both benches
        for bench_name in ("test-bench-1", "test-bench-2"):
            self.assert_supervisor_process(bench_name)

        self.assert_nginx_process()

        # sudoers
        bench.utils.setup_sudoers(user)
        self.assert_sudoers(user)

        for bench_name in ("test-bench-1", "test-bench-2"):
            bench_path = os.path.join(os.path.abspath(self.benches_path),
                                      bench_name)
            disable_production(bench_path)
예제 #2
0
def setup_production(user, yes=False):
    "setup bench for production"
    from bench.config.production_setup import setup_production
    from bench.utils import run_playbook
    # Install prereqs for production
    exec_cmd("sudo pip install ansible")
    exec_cmd("bench setup role fail2ban")
    exec_cmd("bench setup role nginx")
    exec_cmd("bench setup role supervisor")
    setup_production(user=user, yes=yes)
예제 #3
0
def setup_production(user, yes=False):
    from bench.config.production_setup import setup_production
    # Install prereqs for production
    from distutils.spawn import find_executable
    if not find_executable("ansible"):
        exec_cmd("sudo -H {0} -m pip install ansible".format(sys.executable))
    if not find_executable("fail2ban-client"):
        exec_cmd("bench setup role fail2ban")
    if not find_executable("nginx"):
        exec_cmd("bench setup role nginx")
    if not find_executable("supervisord"):
        exec_cmd("bench setup role supervisor")
    setup_production(user=user, yes=yes)
	def test_setup_production_v6(self):
		bench_name = 'test-bench-v6'
		self.test_init(bench_name, frappe_branch='master')

		user = getpass.getuser()

		bench_path = os.path.join(os.path.abspath(self.benches_path), bench_name)
		setup_production(user, bench_path)

		self.assert_nginx_config(bench_name)
		self.assert_nginx_process()

		self.assert_supervisor_config(bench_name, use_rq=False)
		self.assert_supervisor_process(bench_name, use_rq=False)
예제 #5
0
	def test_disable_production(self):
		bench_name = 'test-disable-prod'
		self.test_init(bench_name, frappe_branch='master')

		user = getpass.getuser()

		bench_path = os.path.join(os.path.abspath(self.benches_path), bench_name)
		setup_production(user, bench_path)

		disable_production(bench_path)

		self.assert_nginx_link(bench_name)
		self.assert_supervisor_link(bench_name)
		self.assert_supervisor_process(bench_name=bench_name, disable_production=True)
예제 #6
0
파일: setup.py 프로젝트: dataent/bench
def setup_production(user, yes=False):
    "setup bench for production"
    from bench.config.production_setup import setup_production
    from bench.utils import run_playbook
    # Install prereqs for production
    from distutils.spawn import find_executable
    if not find_executable('ansible'):
        exec_cmd("sudo pip install ansible")
    if not find_executable('fail2ban-client'):
        exec_cmd("bench setup role fail2ban")
    if not find_executable('nginx'):
        exec_cmd("bench setup role nginx")
    if not find_executable('supervisord'):
        exec_cmd("bench setup role supervisor")
    setup_production(user=user, yes=yes)
예제 #7
0
파일: setup.py 프로젝트: ccfiel/bench
def setup_production(user, yes=False):
	"setup bench for production"
	from bench.config.production_setup import setup_production
	from bench.utils import run_playbook
	# Install prereqs for production
	from distutils.spawn import find_executable
	if not find_executable('ansible'):
		exec_cmd("sudo pip install ansible")
	if not find_executable('fail2ban-client'):
		exec_cmd("bench setup role fail2ban")
	if not find_executable('nginx'):
		exec_cmd("bench setup role nginx")
	if not find_executable('supervisord'):
		exec_cmd("bench setup role supervisor")
	setup_production(user=user, yes=yes)
    def test_disable_production(self):
        bench_name = 'test-disable-prod'
        self.test_init(bench_name, frappe_branch='master')

        user = getpass.getuser()

        bench_path = os.path.join(os.path.abspath(self.benches_path),
                                  bench_name)
        setup_production(user, bench_path)

        disable_production(bench_path)

        self.assert_nginx_link(bench_name)
        self.assert_supervisor_link(bench_name)
        self.assert_supervisor_process(bench_name=bench_name,
                                       disable_production=True)
예제 #9
0
	def test_setup_production(self):
		self.test_multiple_benches()

		user = getpass.getuser()

		for bench_name in ("test-bench-1", "test-bench-2"):
			bench_path = os.path.join(os.path.abspath(self.benches_path), bench_name)
			setup_production(user, bench_path)
			self.assert_nginx_config(bench_name)
			self.assert_supervisor_config(bench_name)

		# test after start of both benches
		for bench_name in ("test-bench-1", "test-bench-2"):
			self.assert_supervisor_process(bench_name)

		self.assert_nginx_process()
예제 #10
0
def setup_production(user):
    "setup bench for production"
    from bench.config.production_setup import setup_production
    setup_production(user=user)
예제 #11
0
파일: setup.py 프로젝트: kossanah/bench
def setup_production(user, yes=False):
	"setup bench for production"
	from bench.config.production_setup import setup_production
	setup_production(user=user, yes=yes)