From 504a71fa686384035e320eba026ba5caae34eaac Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Tue, 18 Nov 2014 16:07:46 +0530 Subject: [PATCH] fix #74 --- bench/cli.py | 5 +++-- bench/config.py | 5 +++-- bench/production_setup.py | 4 ++-- install_scripts/setup_frappe.sh | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/bench/cli.py b/bench/cli.py index 28cb458e..097d8028 100644 --- a/bench/cli.py +++ b/bench/cli.py @@ -267,9 +267,10 @@ def setup_supervisor(): generate_supervisor_config() @click.command('production') -def setup_production(): +@click.argument('user') +def setup_production(user): "setup bench for production" - _setup_production() + _setup_production(user=user) @click.command('auto-update') def setup_auto_update(): diff --git a/bench/config.py b/bench/config.py index abb0bf96..90231b47 100644 --- a/bench/config.py +++ b/bench/config.py @@ -6,12 +6,13 @@ from .utils import get_sites, get_config, update_config env = Environment(loader=PackageLoader('bench', 'templates'), trim_blocks=True) -def generate_supervisor_config(bench='.'): +def generate_supervisor_config(bench='.', user=None): template = env.get_template('supervisor.conf') bench_dir = os.path.abspath(bench) sites_dir = os.path.join(bench_dir, "sites") sites = get_sites(bench=bench) - user = getpass.getuser() + if not user: + user = getpass.getuser() config = get_config() config = template.render(**{ diff --git a/bench/production_setup.py b/bench/production_setup.py index 9719b8fa..0eb8c618 100644 --- a/bench/production_setup.py +++ b/bench/production_setup.py @@ -34,8 +34,8 @@ def is_centos7(): def copy_default_nginx_config(): shutil.copy(os.path.join(os.path.dirname(__file__), 'templates', 'nginx_default.conf'), '/etc/nginx/nginx.conf') -def setup_production(bench='.'): - generate_supervisor_config(bench=bench) +def setup_production(bench='.', user): + generate_supervisor_config(bench=bench, user=user) generate_nginx_config(bench=bench) remove_default_nginx_configs() diff --git a/install_scripts/setup_frappe.sh b/install_scripts/setup_frappe.sh index 225e23ec..d04981cb 100644 --- a/install_scripts/setup_frappe.sh +++ b/install_scripts/setup_frappe.sh @@ -331,7 +331,7 @@ setup_bench() { run_cmd sudo su $FRAPPE_USER -c "cd /home/$FRAPPE_USER/frappe-bench && bench frappe --install_app shopping_cart" run_cmd bash -c "cd /home/$FRAPPE_USER/frappe-bench && bench setup sudoers $FRAPPE_USER" if $SETUP_PROD; then - run_cmd bash -c "cd /home/$FRAPPE_USER/frappe-bench && bench setup production" + run_cmd bash -c "cd /home/$FRAPPE_USER/frappe-bench && bench setup production $FRAPPE_USER" fi }