Permalink
Browse files

Adding in chief scripts/settings

  • Loading branch information...
rossbruniges committed Feb 20, 2013
1 parent 19d2ed0 commit 4aefb25e65b5d8699e2abedaf32e7ad02cb25d48
Showing with 69 additions and 0 deletions.
  1. +17 −0 scripts/update/commander_settings.py-dist
  2. +52 −0 scripts/update/update.py
@@ -0,0 +1,17 @@
+SRC_DIR = '/data/genericrhel6-stage/src/mozillaignite.allizom.org/mozillaignite'
+WWW_DIR = '/data/genericrhel6-stage/www/mozillaignite.allizom.org/mozillaignite'
+
+#CRON_NAME = 'mozillaignite.allizom.org-gencron'
+
+DEPLOY_SCRIPT = "/data/genericrhel6-stage/deploy -n mozillaignite.allizom.org"
+REMOTE_UPDATE_SCRIPT = "/data/bin/update-www.sh mozillaignite.allizom.org"
+
+WEB_HOSTGROUP = 'genericrhel6-stage'
+#CELERY_HOSTGROUP = 'genericrhel6-celery-stage'
+#CELERY_SERVICE = 'celeryd-mozillaignite-stage'
+
+UPDATE_REF = '1.0.X'
+SSH_KEY = '/root/.ssh/id_rsa'
+
+REMOTE_WSGI = '/data/www/mozillaignite.allizom.org/mozillaignite/mozillaignite/wsgi/betafarm.wsgi'
+REMOTE_HOSTNAME = 'mozillaignite.allizom.org'
View
@@ -0,0 +1,52 @@
+"""
+Deployment for mozillaignite
+
+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 origin")
+ ctx.local("git checkout -f 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")
+
+@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):
+ with ctx.lcd(settings.SRC_DIR):
+ ctx.local("git rev-parse HEAD > media/revision")
+
+@task
+def deploy(ctx):
+ pre_update()
+ update()
+ checkin_changes()
+ deploy_app()

0 comments on commit 4aefb25

Please sign in to comment.