This commit is contained in:
Jonathan Eads 2014-05-27 13:29:17 -07:00
Родитель f0cfb96e2c
Коммит 08c77a340f
1 изменённых файлов: 24 добавлений и 9 удалений

Просмотреть файл

@ -25,11 +25,14 @@ def update_code(ctx, tag):
ctx.local('git submodule update --init --recursive') ctx.local('git submodule update --init --recursive')
ctx.local("find . -type f -name '*.pyc' -delete") ctx.local("find . -type f -name '*.pyc' -delete")
@task
def update_assets(ctx): def update_assets(ctx):
with ctx.lcd(settings.SRC_DIR): ctx.remote("{0} grunt build".format(settings.WEB_DIR))
ctx.local("python2.6 manage.py collectstatic --noinput")
def update_oauth_credentials(ctx):
ctx.local("python2.6 manage.py export_project_credentials")
# Need to scp the credentials from admin node to workers and web service nodes
@task @task
def update_db(ctx): def update_db(ctx):
@ -44,14 +47,26 @@ def checkin_changes(ctx):
"""Use the local, IT-written deploy script to check in changes.""" """Use the local, IT-written deploy script to check in changes."""
ctx.local(settings.DEPLOY_SCRIPT) ctx.local(settings.DEPLOY_SCRIPT)
def deploy_admin_node(ctx):
ctx.local('/usr/bin/supervisorctl restart celerybeat')
ctx.local('/usr/bin/supervisorctl restart celerymon')
ctx.local('/usr/bin/supervisorctl restart celery')
@hostgroups(settings.WEB_HOSTGROUP, remote_kwargs={'ssh_key': settings.SSH_KEY}) @hostgroups(settings.WEB_HOSTGROUP, remote_kwargs={'ssh_key': settings.SSH_KEY})
def deploy_app(ctx): def deploy_web_app(ctx):
"""Call the remote update script to push changes to webheads.""" """Call the remote update script to push changes to webheads."""
ctx.remote(settings.REMOTE_UPDATE_SCRIPT) ctx.remote(settings.REMOTE_UPDATE_SCRIPT)
ctx.remote('/usr/bin/supervisorctl gunicorn restart')
# Make sure web assets are rebuilt when code is updated
update_assets(ctx)
ctx.remote('/usr/bin/supervisorctl restart gunicorn')
ctx.remote('/usr/bin/supervisorctl restart socketio-server')
@hostgroups(settings.CELERY_HOSTGROUP, remote_kwargs={'ssh_key': settings.SSH_KEY}) @hostgroups(settings.CELERY_HOSTGROUP, remote_kwargs={'ssh_key': settings.SSH_KEY})
def deploy_app(ctx): def deploy_workers(ctx):
"""Call the remote update script to push changes to workers."""
ctx.remote(settings.REMOTE_UPDATE_SCRIPT)
ctx.remote('/usr/bin/supervisorctl restart celery') ctx.remote('/usr/bin/supervisorctl restart celery')
@task @task
@ -81,10 +96,10 @@ def update(ctx):
@task @task
def deploy(ctx): def deploy(ctx):
install_cron()
checkin_changes() checkin_changes()
deploy_app() deploy_admin_node()
#update_celery() deploy_web_app()
deploy_workers()
update_info() update_info()