Skip to content

Commit

Permalink
work on #16
Browse files Browse the repository at this point in the history
  • Loading branch information
domenkozar committed Aug 7, 2012
1 parent 1f1fd71 commit f9a3e43
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
4 changes: 2 additions & 2 deletions buildout.d/production.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[buildout]
extends = base.cfg
eggs +=
iw.rotatezlogs
eestec.portal [production]

# TODO
# TODO
2 changes: 2 additions & 0 deletions buildout.d/staging.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[buildout]
extends = production.cfg
51 changes: 51 additions & 0 deletions fabfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from fabric.api import env, run, local
from fabric.context_managers import settings, cd, lcd
from fabric.decorators import task

env.hosts = ['staging.eestec.net']
env.user = 'staging'
env.repository = "https://github.com/eestec/eestec.portal.git"
env.branch = "master"
env.staging_folder = "/home/staging/env"


@task
def staging_bootstrap():
with settings(warn_only=True):
run('%(staging_folder)s/bin/supervisorctl shutdown' % env)
run('rm -rf %(staging_folder)s' % env)
run('git clone %(repository)s %(staging_folder)s' % env)
# TODO: install crontab
staging_deploy()


@task
def has_new_commits():
"""Check for fresh deploy branch commits"""
with lcd(env.staging_folder):
local('git fetch origin')
output = local('git log %(branch)s...origin/%(branch)s' % env,
capture=True)
if output.strip():
local('git pull origin')
print "new commits!"
return True
else:
print "no new commits."
return False


@task
def staging_update():
if not has_new_commits():
return
staging_deploy()


@task
def staging_deploy():
with cd(env.staging_folder):
# TODO: copy production data
run('bin/buildout -c buildout.d/staging.cfg')
run('bin/supervisord')
# TODO: run upgrade profile
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ def read(*rnames):
'setuptools-flakes',
'zest.releaser',
'jarn.mkrelease',
'Fabric',
],
'production': [
'Fabric',
]
},
entry_points="""
[z3c.autoinclude.plugin]
Expand Down

0 comments on commit f9a3e43

Please sign in to comment.