2
0
mirror of https://github.com/frappe/bench.git synced 2024-09-24 13:09:01 +00:00

fix: take backup before pulling the code and make site available after restarting the processes

This commit is contained in:
Saurabh 2019-06-19 17:25:41 +05:30
parent d487824b31
commit 9242b927ca

View File

@ -1,6 +1,6 @@
import click import click
import sys, os 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.app import pull_all_apps, is_version_upgrade
from bench.utils import (update_bench, validate_upgrade, pre_upgrade, post_upgrade, before_update, 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, 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) 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: if pull:
pull_all_apps(bench_path=bench_path, reset=reset) 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) reload(bench.app)
if patch: if patch:
if not no_backup:
print('Backing up sites...')
backup_all_sites(bench_path=bench_path)
print('Patching sites...') print('Patching sites...')
patch_sites(bench_path=bench_path) patch_sites(bench_path=bench_path)
if build: 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'): if restart_systemd or conf.get('restart_systemd_on_update'):
restart_systemd_processes(bench_path=bench_path) 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("_"*80)
print("Bench: Deployment tool for Frappe and ERPNext (https://erpnext.org).") 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") print("Open source depends on your contributions, so please contribute bug reports, patches, fixes or cash and be a part of the community")