Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

Commit

Permalink
only restart vcweb supervisor processes
Browse files Browse the repository at this point in the history
  • Loading branch information
alee committed Apr 5, 2016
1 parent 7d7b098 commit 3a453b1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
23 changes: 20 additions & 3 deletions fabfile.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.conf import settings as vcweb_settings
from fabric.api import local, sudo, cd, env, lcd, execute, hosts, roles, task
from fabric.context_managers import prefix
from fabric.contrib.console import confirm
Expand All @@ -7,6 +8,7 @@
import os
import logging


logger = logging.getLogger(__name__)

# default to current working directory
Expand All @@ -28,7 +30,7 @@
env.deploy_parent_dir = '/opt/'
env.hg_url = 'https://bitbucket.org/virtualcommons/vcweb'
env.git_url = 'https://github.com/virtualcommons/vcweb.git'
env.services = 'nginx redis supervisord'
env.services = 'nginx redis'
# FIXME: use django conf INSTALLED_APPS to introspect instead, similar to
# experiment_urls
env.docs_path = os.path.join(env.project_path, 'docs')
Expand Down Expand Up @@ -56,8 +58,6 @@

# django integration for access to settings, etc.
django.project(env.project_name)
from django.conf import settings as vcweb_settings


@hosts('vcweb-dev.asu.edu')
@task
Expand Down Expand Up @@ -198,6 +198,22 @@ def _restart_command(systemd=True):
return cmd % env


@task(alias='relu')
def reload_uwsgi():
sudo("supervisorctl restart vcweb-uwsgi vcweb-sockjs")
"""
fallback if supervisorctl socket not set up properly..
status_line = sudo("supervisorctl status | grep %(project_name)s" % env)
m = re.search('RUNNING(?:\s+)pid\s(\d+)', status_line)
if m:
uwsgi_pid = m.group(1)
logger.debug("sending HUP to %s", uwsgi_pid)
sudo("kill -HUP {}".format(uwsgi_pid))
else:
logger.warning("No pid found: %s", status_line)
"""


@roles('localhost')
@task
def clean():
Expand Down Expand Up @@ -245,3 +261,4 @@ def deploy(vcs_branch_dict):
'chown -R %(deploy_user)s:%(deploy_group)s . %(static_root)s %(virtualenv_path)s' % env,
_restart_command(),
pty=True)
execute(reload_uwsgi)
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django==1.9.4
Django==1.9.5
Fabric==1.10.2
Markdown==2.6.6
PyYAML==3.11
Expand All @@ -22,7 +22,7 @@ psycopg2==2.6.1
pycrypto==2.6.1
python-coveralls==2.7.0
python-openid==2.2.5
raven==5.11.1
raven==5.12.0
requests==2.9.1
sockjs-tornado==1.0.2
tornado==4.3
Expand Down

0 comments on commit 3a453b1

Please sign in to comment.