Skip to content

Commit

Permalink
Updated the fabric file for this branch: uwsgi, not gunicorn, nginx, …
Browse files Browse the repository at this point in the history
…not apache,

and no virtualenv.

Had a WTF moment looking at the DEPLOYMENTS dict, since those never should have
been posted publically, but them as-is for now (unfortunately, if someone wants
to see them, all they have to do is look at prior commits).
  • Loading branch information
Denis Papathanasiou committed Jun 10, 2014
1 parent 86520e2 commit 33fad62
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@


DEFAULTS = {
'home': '/home/wsgi/srv/',
'home': '/home/fhuser/',
'repo_name': 'formhub',
}

DEPLOYMENTS = {
DEPLOYMENTS = { # why are these here, in a publically-posted file??
'dev': {
'home': '/home/ubuntu/srv/',
'host_string': '[email protected]', # TODO: switch to dev.formhub.org
Expand All @@ -25,15 +25,6 @@
}


def run_in_virtualenv(command):
d = {
'activate': os.path.join(
env.project_directory, 'project_env', 'bin', 'activate'),
'command': command,
}
run('source %(activate)s && %(command)s' % d)


def check_key_filename(deployment_name):
if DEPLOYMENTS[deployment_name].has_key('key_filename') and \
not os.path.exists(DEPLOYMENTS[deployment_name]['key_filename']):
Expand All @@ -48,8 +39,7 @@ def setup_env(deployment_name):
if not check_key_filename(deployment_name): sys.exit(1)
env.project_directory = os.path.join(env.home, env.project)
env.code_src = os.path.join(env.project_directory, env.repo_name)
env.wsgi_config_file = os.path.join(
env.project_directory, 'apache', 'environment.wsgi')
env.wsgi_config_file = os.path.join(env.project_directory, 'formhub', 'wsgi.py')
env.pip_requirements_file = os.path.join(env.code_src, 'requirements.pip')


Expand All @@ -62,12 +52,13 @@ def deploy(deployment_name, branch='master'):
run("git submodule update")
run('find . -name "*.pyc" -exec rm -rf {} \;')
# numpy pip install from requirments file fails
run_in_virtualenv("pip install numpy --upgrade")
run_in_virtualenv("pip install -r %s --upgrade" % env.pip_requirements_file)
run("sudo pip install numpy --upgrade")
run("sudo pip install -r %s --upgrade" % env.pip_requirements_file)
with cd(env.code_src):
run_in_virtualenv("python manage.py syncdb --settings='formhub.preset.local_settings'")
run_in_virtualenv("python manage.py migrate --settings='formhub.preset.local_settings'")
run_in_virtualenv("python manage.py collectstatic --settings='formhub.preset.local_settings' --noinput")
run("python manage.py syncdb --settings='formhub.preset.default_settings'")
run("python manage.py migrate --settings='formhub.preset.default_settings'")
run("python manage.py collectstatic --settings='formhub.preset.default_settings' --noinput")
run("sudo /etc/init.d/celeryd restart")
run("sudo /etc/init.d/celerybeat restart")
run("sudo reload gunicorn-formhub")
run("sudo /etc/init.d/formhub-uwsgi restart")
run("sudo /etc/init.d/nginx restart")

0 comments on commit 33fad62

Please sign in to comment.