2
0
mirror of https://github.com/frappe/bench.git synced 2024-09-22 20:19:01 +00:00
This commit is contained in:
Pratik Vyas 2014-11-18 16:07:46 +05:30
parent 5933032e03
commit 504a71fa68
4 changed files with 9 additions and 7 deletions

View File

@ -267,9 +267,10 @@ def setup_supervisor():
generate_supervisor_config() generate_supervisor_config()
@click.command('production') @click.command('production')
def setup_production(): @click.argument('user')
def setup_production(user):
"setup bench for production" "setup bench for production"
_setup_production() _setup_production(user=user)
@click.command('auto-update') @click.command('auto-update')
def setup_auto_update(): def setup_auto_update():

View File

@ -6,12 +6,13 @@ from .utils import get_sites, get_config, update_config
env = Environment(loader=PackageLoader('bench', 'templates'), trim_blocks=True) 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') template = env.get_template('supervisor.conf')
bench_dir = os.path.abspath(bench) bench_dir = os.path.abspath(bench)
sites_dir = os.path.join(bench_dir, "sites") sites_dir = os.path.join(bench_dir, "sites")
sites = get_sites(bench=bench) sites = get_sites(bench=bench)
user = getpass.getuser() if not user:
user = getpass.getuser()
config = get_config() config = get_config()
config = template.render(**{ config = template.render(**{

View File

@ -34,8 +34,8 @@ def is_centos7():
def copy_default_nginx_config(): def copy_default_nginx_config():
shutil.copy(os.path.join(os.path.dirname(__file__), 'templates', 'nginx_default.conf'), '/etc/nginx/nginx.conf') shutil.copy(os.path.join(os.path.dirname(__file__), 'templates', 'nginx_default.conf'), '/etc/nginx/nginx.conf')
def setup_production(bench='.'): def setup_production(bench='.', user):
generate_supervisor_config(bench=bench) generate_supervisor_config(bench=bench, user=user)
generate_nginx_config(bench=bench) generate_nginx_config(bench=bench)
remove_default_nginx_configs() remove_default_nginx_configs()

View File

@ -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 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" run_cmd bash -c "cd /home/$FRAPPE_USER/frappe-bench && bench setup sudoers $FRAPPE_USER"
if $SETUP_PROD; then 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 fi
} }