Skip to content

Commit

Permalink
Exclude database.php from deployment during upgrade processes
Browse files Browse the repository at this point in the history
  • Loading branch information
pbchase committed May 7, 2018
1 parent 9e63f51 commit 9db03a2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 3 additions & 2 deletions upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ def upgrade(name):
as packaged by this fabfile
"""

upgrade = True
utility_redcap.make_upload_target()
copy_running_code_to_backup_dir()
utility_redcap.upload_package_and_extract(name)
utility_redcap.upload_package_and_extract(name, upgrade)
utility.write_remote_my_cnf()
offline()
utility_redcap.move_software_to_live()
Expand Down Expand Up @@ -104,4 +105,4 @@ def change_online_status(state):
utility.write_remote_my_cnf()
utility_redcap.set_redcap_config('system_offline', '%s' % offline_binary)
utility_redcap.set_redcap_config('system_offline_message', '%s' % offline_message)
utility.delete_remote_my_cnf()
utility.delete_remote_my_cnf()
12 changes: 8 additions & 4 deletions utility_redcap.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def make_upload_target():
run("mkdir -p %(upload_target_backup_dir)s" % env)


def upload_package_and_extract(name):
def upload_package_and_extract(name, upgrade=False):
"""
Upload the redcap package and extract it into the directory from which new
software will be deployed, e.g., /var/www.backup/redcap-20160117T1543/
Expand All @@ -50,7 +50,13 @@ def upload_package_and_extract(name):
with settings(warn_only=True):
if run('test -d %s/webtools2/pdf/font/unifont' % env.upload_target_backup_dir).succeeded:
run('chmod ug+w %s/webtools2/pdf/font/unifont/*' % env.upload_target_backup_dir)
run('rsync -rc %s/redcap/* %s' % (temp2, env.upload_target_backup_dir))
# Write the new code on top of the existing code
if upgrade == False:
run('rsync -rc %s/redcap/* %s' % (temp2, env.upload_target_backup_dir))
else:
# exclude some files during upgrades
exclusions = "--exclude=database.php"
run('rsync -rc %s %s/redcap/* %s' % (exclusions, temp2, env.upload_target_backup_dir))
# make sure the temp file directory in redcap web space will be writeable
run('chmod -R g+w %s/temp' % env.upload_target_backup_dir)
# Remove the temp directories
Expand Down Expand Up @@ -111,5 +117,3 @@ def test(warn_only=False):
abort("One or more tests failed.")
else:
return(True)


0 comments on commit 9db03a2

Please sign in to comment.