2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-16 10:05:21 +00:00

feat: Restart process manager for develop mode

This commit is contained in:
Gavin D'souza 2021-11-13 14:24:39 +05:30
parent 3709682231
commit 6123cd5b49
3 changed files with 16 additions and 6 deletions

View File

@ -18,6 +18,7 @@ from bench.utils.bench import (
validate_app_installed_on_sites, validate_app_installed_on_sites,
restart_supervisor_processes, restart_supervisor_processes,
restart_systemd_processes, restart_systemd_processes,
restart_process_manager,
remove_backups_crontab, remove_backups_crontab,
get_venv_path, get_venv_path,
get_env_cmd, get_env_cmd,
@ -129,7 +130,8 @@ class Bench(Base, Validator):
restart_supervisor_processes(bench_path=self.name) restart_supervisor_processes(bench_path=self.name)
if conf.get("restart_systemd_on_update"): if conf.get("restart_systemd_on_update"):
restart_systemd_processes(bench_path=self.name) restart_systemd_processes(bench_path=self.name)
if conf.get("developer_mode"):
restart_process_manager(bench_path=self.name)
class BenchApps(MutableSequence): class BenchApps(MutableSequence):
def __init__(self, bench: Bench): def __init__(self, bench: Bench):

View File

@ -32,14 +32,14 @@ def is_version_upgrade(app="frappe", bench_path=".", branch=None):
def switch_branch(branch, apps=None, bench_path=".", upgrade=False, check_upgrade=True): def switch_branch(branch, apps=None, bench_path=".", upgrade=False, check_upgrade=True):
import git import git
import importlib import importlib
from bench.utils import ( from bench.utils.bench import (
build_assets,
update_requirements, update_requirements,
update_node_packages, update_node_packages,
backup_all_sites,
patch_sites, patch_sites,
post_upgrade, post_upgrade,
) )
from bench.utils.bench import build_assets from bench.utils.system import backup_all_sites
apps_dir = os.path.join(bench_path, "apps") apps_dir = os.path.join(bench_path, "apps")
version_upgrade = (False,) version_upgrade = (False,)

View File

@ -12,7 +12,7 @@ import click
import bench import bench
# imports - module imports # imports - module imports
from bench.utils import which, log, exec_cmd, get_bench_name, get_cmd_output from bench.utils import get_process_manager, which, log, exec_cmd, get_bench_name, get_cmd_output
from bench.exceptions import PatchError, ValidationError from bench.exceptions import PatchError, ValidationError
logger = logging.getLogger(bench.PROJECT_NAME) logger = logging.getLogger(bench.PROJECT_NAME)
@ -304,6 +304,14 @@ def restart_systemd_processes(bench_path=".", web_workers=False):
) )
def restart_process_manager(bench_path="."):
# only overmind has the restart feature, not sure other supported procmans do
if which("overmind") and os.path.exists(
os.path.join(bench_path, ".overmind.sock")
):
exec_cmd("overmind restart", cwd=bench_path)
def build_assets(bench_path=".", app=None): def build_assets(bench_path=".", app=None):
command = "bench build" command = "bench build"
if app: if app:
@ -331,8 +339,8 @@ def update(
from bench.utils.bench import ( from bench.utils.bench import (
restart_supervisor_processes, restart_supervisor_processes,
restart_systemd_processes, restart_systemd_processes,
backup_all_sites,
) )
from bench.utils.system import backup_all_sites
from bench.app import pull_apps from bench.app import pull_apps
from bench.utils.app import is_version_upgrade from bench.utils.app import is_version_upgrade
from bench.config.common_site_config import update_config from bench.config.common_site_config import update_config