Merge pull request #32 from clouserw/random

Update deploy script; prepare for manage.py commands
This commit is contained in:
Sean McArthur 2011-08-17 15:18:02 -07:00
Родитель 4a5e39ee6f a1c9706424
Коммит c5e901ec1a
1 изменённых файлов: 29 добавлений и 0 удалений

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

@ -36,6 +36,27 @@ def schematic(ctx):
ctx.local("python2.6 ./vendor/src/schematic/schematic migrations")
@task
def disable_cron(ctx):
ctx.local("mv /etc/cron.d/builder-prod-maint /tmp/builder-prod-maint")
@task
def enable_cron(ctx):
with ctx.lcd(FLIGHTDECK_DIR):
ctx.local("cp scripts/crontab/prod /etc/cron.d/builder-prod-maint")
def manage_cmd(ctx, command):
"""Call a manage.py command."""
with ctx.lcd(FLIGHTDECK_DIR):
ctx.local("python2.6 manage.py %s" % command)
@task
def make_crons(ctx):
with ctx.lcd(FLIGHTDECK_DIR):
ctx.local("python2.6 ./scripts/crontab/make-crons.py")
def _git_checkout_tag(ctx, tag):
ctx.local("git fetch -t origin")
ctx.local("git checkout %s" % tag)
@ -46,6 +67,7 @@ def _git_checkout_tag(ctx, tag):
@task
def start_update(ctx, tag):
"""Updates code to `tag`"""
disable_cron()
with ctx.lcd(FLIGHTDECK_DIR):
_git_checkout_tag(ctx, tag)
@ -53,6 +75,13 @@ def start_update(ctx, tag):
@task
def update_flightdeck(ctx):
"""Deploys code to the webservers and restarts celery"""
# BEGIN: The normal update/push cycle.
make_crons()
schematic()
deploy_code()
restart_celery()
enable_cron()
# END: The normal update/push cycle.
# Run management commands like this:
# manage_cmd(ctx, 'cmd')