From 9242b927ca3574f781475b264b5d35cd1b71191a Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 19 Jun 2019 17:25:41 +0530 Subject: [PATCH] fix: take backup before pulling the code and make site available after restarting the processes --- bench/commands/update.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/bench/commands/update.py b/bench/commands/update.py index 1779dd90..49d940ab 100755 --- a/bench/commands/update.py +++ b/bench/commands/update.py @@ -1,6 +1,6 @@ import click import sys, os -from bench.config.common_site_config import get_config +from bench.config.common_site_config import get_config, update_config from bench.app import pull_all_apps, is_version_upgrade from bench.utils import (update_bench, validate_upgrade, pre_upgrade, post_upgrade, before_update, update_requirements, update_node_packages, backup_all_sites, patch_sites, build_assets, @@ -69,6 +69,13 @@ def _update(pull=False, patch=False, build=False, update_bench=False, auto=False before_update(bench_path=bench_path, requirements=requirements) + config.update({ "maintenance_mode": 1, "pause_scheduler": 1 }) + update_config(config, bench_path=bench_path) + + if not no_backup: + print('Backing up sites...') + backup_all_sites(bench_path=bench_path) + if pull: pull_all_apps(bench_path=bench_path, reset=reset) @@ -89,10 +96,6 @@ def _update(pull=False, patch=False, build=False, update_bench=False, auto=False reload(bench.app) if patch: - if not no_backup: - print('Backing up sites...') - backup_all_sites(bench_path=bench_path) - print('Patching sites...') patch_sites(bench_path=bench_path) if build: @@ -104,6 +107,9 @@ def _update(pull=False, patch=False, build=False, update_bench=False, auto=False if restart_systemd or conf.get('restart_systemd_on_update'): restart_systemd_processes(bench_path=bench_path) + config.update({ "maintenance_mode": 0, "pause_scheduler": 0 }) + update_config(config, bench_path=bench_path) + print("_"*80) print("Bench: Deployment tool for Frappe and ERPNext (https://erpnext.org).") print("Open source depends on your contributions, so please contribute bug reports, patches, fixes or cash and be a part of the community")