From: Bryan Date: Fri, 17 Jan 2014 20:23:07 +0000 (-0500) Subject: added pip workaround closes #282; documented what fabric deploy does. X-Git-Tag: release-20150131~228 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=66445c14cd689e0caf7c6510422855ba98c129fd;p=oweals%2Fkarmaworld.git added pip workaround closes #282; documented what fabric deploy does. --- diff --git a/README.md b/README.md index e3ed02b..8cd86b5 100644 --- a/README.md +++ b/README.md @@ -327,6 +327,34 @@ not generally be needed. 1. If everything went well, gunicorn should be running the website on port 8000 and nginx should be serving gunicorn on port 80. +# Update a deployed system + +Once code has been updated, the running web service will need to be updated +to stay in sync with the code. + +## Fabric + +Run the `deploy` fab command. For example: +`fab -H 127.0.0.1 deploy` + +## By Hand + +1. pull code in from the repo with `git pull` +1. If any Python requirements have changed, install/upgrade them: + `pip install -r --upgrade reqs/prod.txt` +1. If the database has changed, update the database with: + `python manage.py syncdb --migrate` +1. If any static files have changed, synchornize them with; + `python manage.py collectstatic` +1. Django will probably need a restart. + * For a dev system, ctrl-c the running process and restart it. + * For a production system, there are two options. + * `python manage.py restart_supervisord` if far reaching changes + have been made (that might effect celery, beat, etc) + * `python manage.py restart_gunicorn` if only minor Django changes + have been made + * If you are uncertain, best bet is to restart supervisord. + # Accessing the Vagrant Virtual Machine ## Accessing the VM via Fabric diff --git a/fabfile.py b/fabfile.py index e4148d6..ddbd64c 100644 --- a/fabfile.py +++ b/fabfile.py @@ -183,8 +183,16 @@ def restart_gunicorn(): ####### Update Requirements +@task +def install_reqs(): + # first install must be done without --upgrade for a few packages that break + # due to a pip problem. + virtenv_exec('pip install -r {0}/reqs/prod.txt'.format(env.code_root)) + @task def update_reqs(): + # this should generally work to install reqs too, save for a pip problem + # with a few packages. virtenv_exec('pip install --upgrade -r {0}/reqs/prod.txt'.format(env.code_root)) ####### Pull new code @@ -259,7 +267,7 @@ def first_deploy(): make_virtualenv() file_setup() check_secrets() - update_reqs() + install_reqs() syncdb() collect_static() fetch_usde()