Skip to content

Commit

Permalink
fix: take backup before pulling the code and make site available afte…
Browse files Browse the repository at this point in the history
…r restarting the processes
  • Loading branch information
saurabh6790 committed Jun 19, 2019
1 parent d487824 commit 9242b92
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions bench/commands/update.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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)

Expand All @@ -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:
Expand All @@ -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")
Expand Down

0 comments on commit 9242b92

Please sign in to comment.