Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #20 from solarce/master

adds chief compatible update script
  • Loading branch information...
commit fdab9b9ad6e30f382392c7748502be19e4a7073d 2 parents 55bd9e3 + 99c08e3
@camd camd authored
View
17 scripts/update/commander_settings.py-dist
@@ -0,0 +1,17 @@
+SRC_DIR = '/data/genericrhel6-stage/src/moztrap.allizom.org/moz-trap'
+WWW_DIR = '/data/genericrhel6-stage/www/moztrap.allizom.org/moz-trap'
+
+#CRON_NAME = 'moztrap.allizom.org-gencron'
+
+DEPLOY_SCRIPT = "/data/genericrhel6-stage/deploy -n moztrap.allizom.org"
+REMOTE_UPDATE_SCRIPT = "/data/bin/update-www.sh moztrap.allizom.org"
+
+WEB_HOSTGROUP = 'genericrhel6-stage'
+#CELERY_HOSTGROUP = 'genericrhel6-celery-stage'
+#CELERY_SERVICE = 'celeryd-moztrap-stage'
+
+UPDATE_REF = '1.0.X'
+SSH_KEY = ''
+
+REMOTE_WSGI = '/data/www/moztrap.allizom.org/moz-trap/moztrap/deploy/vendor_wsgi.py'
+REMOTE_HOSTNAME = 'moztrap.allizom.org'
View
65 scripts/update/update.py
@@ -0,0 +1,65 @@
+"""
+Deployment for moztrap
+
+Requires commander (https://github.com/oremj/commander) which is installed on
+the systems that need it.
+"""
+
+import os
+import sys
+
+sys.path.append(os.path.dirname(os.path.abspath(__file__)))
+
+from commander.deploy import task, hostgroups
+
+import commander_settings as settings
+
+@task
+def update_code(ctx, tag):
+ with ctx.lcd(settings.SRC_DIR):
+ ctx.local("git fetch")
+ ctx.local("git pull origin %s" % tag)
+ ctx.local("git submodule sync")
+ ctx.local("git submodule update --init --recursive")
+ ctx.local("find . -type f -name '.gitignore' -or -name '*.pyc' -delete")
+ ctx.local("git rev-parse HEAD > media/revision.txt")
+
+@task
+def update_assets(ctx):
+ with ctx.lcd(settings.SRC_DIR):
+ ctx.local("LANG=en_US.UTF-8 python2.6 vendor-manage.py collectstatic --noinput")
+ ctx.local("LANG=en_US.UTF-8 python2.6 vendor-manage.py compress")
+
+@task
+def database(ctx):
+ with ctx.lcd(settings.SRC_DIR):
+ ctx.local("python2.6 vendor-manage.py syncdb --migrate")
+
+@task
+def checkin_changes(ctx):
+ ctx.local(settings.DEPLOY_SCRIPT)
+
+
+@hostgroups(settings.WEB_HOSTGROUP, remote_kwargs={'ssh_key': settings.SSH_KEY})
+def deploy_app(ctx):
+ ctx.remote(settings.REMOTE_UPDATE_SCRIPT)
+ ctx.remote("/bin/touch %s" % settings.REMOTE_WSGI)
+
+
+@task
+def pre_update(ctx, ref=settings.UPDATE_REF):
+ update_code(ref)
+
+
+@task
+def update(ctx):
+ update_assets()
+ database()
+
+
+@task
+def deploy(ctx):
+ pre_update()
+ update()
+ checkin_changes()
+ deploy_app()
Please sign in to comment.
Something went wrong with that request. Please try again.