mirror of
https://github.com/frappe/bench.git
synced 2025-01-24 15:38:25 +00:00
restart systemd on update
This commit is contained in:
parent
1b3c98d0ff
commit
624e8bdf63
@ -1,6 +1,7 @@
|
||||
import os
|
||||
from .utils import (exec_cmd, get_frappe, check_git_for_shallow_clone, build_assets,
|
||||
restart_supervisor_processes, get_cmd_output, run_frappe_cmd, CommandFailedError)
|
||||
restart_supervisor_processes, get_cmd_output, run_frappe_cmd, CommandFailedError,
|
||||
restart_systemd_processes)
|
||||
from .config.common_site_config import get_config
|
||||
|
||||
import logging
|
||||
@ -110,6 +111,8 @@ def get_app(git_url, branch=None, bench_path='.', build_asset_files=True, verbos
|
||||
conf = get_config(bench_path=bench_path)
|
||||
if conf.get('restart_supervisor_on_update'):
|
||||
restart_supervisor_processes(bench_path=bench_path)
|
||||
if conf.get('restart_systemd_on_update'):
|
||||
restart_systemd_processes(bench_path=bench_path)
|
||||
|
||||
def new_app(app, bench_path='.'):
|
||||
# For backwards compatibility
|
||||
@ -160,7 +163,8 @@ def remove_app(app, bench_path='.'):
|
||||
run_frappe_cmd("build", bench_path=bench_path)
|
||||
if get_config(bench_path).get('restart_supervisor_on_update'):
|
||||
restart_supervisor_processes(bench_path=bench_path)
|
||||
|
||||
if get_config(bench_path).get('restart_systemd_on_update'):
|
||||
restart_systemd_processes(bench_path=bench_path)
|
||||
|
||||
def pull_all_apps(bench_path='.', reset=False):
|
||||
'''Check all apps if there no local changes, pull'''
|
||||
|
@ -23,6 +23,12 @@ def config_restart_supervisor_on_update(state):
|
||||
state = True if state == 'on' else False
|
||||
update_config({'restart_supervisor_on_update': state})
|
||||
|
||||
@click.command('restart_systemd_on_update')
|
||||
@click.argument('state', type=click.Choice(['on', 'off']))
|
||||
def config_restart_systemd_on_update(state):
|
||||
"Enable/Disable auto restart of systemd units"
|
||||
state = True if state == 'on' else False
|
||||
update_config({'restart_systemd_on_update': state})
|
||||
|
||||
@click.command('update_bench_on_update')
|
||||
@click.argument('state', type=click.Choice(['on', 'off']))
|
||||
@ -112,6 +118,7 @@ def remove_common_config(keys):
|
||||
config.add_command(config_auto_update)
|
||||
config.add_command(config_update_bench_on_update)
|
||||
config.add_command(config_restart_supervisor_on_update)
|
||||
config.add_command(config_restart_systemd_on_update)
|
||||
config.add_command(config_dns_multitenant)
|
||||
config.add_command(config_serve_default_site)
|
||||
config.add_command(config_http_timeout)
|
||||
|
@ -14,10 +14,13 @@ def start(no_dev, concurrency):
|
||||
@click.command('restart')
|
||||
@click.option('--web', is_flag=True, default=False)
|
||||
def restart(web):
|
||||
"Restart supervisor processes"
|
||||
from bench.utils import restart_supervisor_processes
|
||||
restart_supervisor_processes(bench_path='.', web_workers=web)
|
||||
|
||||
"Restart supervisor processes or systemd units"
|
||||
from bench.utils import restart_supervisor_processes, restart_systemd_processes
|
||||
from bench.config.common_site_config import get_config
|
||||
if get_config('.').get('restart_supervisor_on_update') == True:
|
||||
restart_supervisor_processes(bench_path='.', web_workers=web)
|
||||
if get_config('.').get('restart_systemd_on_update'):
|
||||
restart_systemd_processes(bench_path='.', web_workers=web)
|
||||
|
||||
@click.command('set-nginx-port')
|
||||
@click.argument('site')
|
||||
|
@ -7,6 +7,7 @@ except ImportError:
|
||||
|
||||
default_config = {
|
||||
'restart_supervisor_on_update': False,
|
||||
'restart_systemd_on_update': False,
|
||||
'auto_update': False,
|
||||
'serve_default_site': True,
|
||||
'rebase_on_pull': False,
|
||||
|
Loading…
x
Reference in New Issue
Block a user