Skip to content
Snippets Groups Projects
Unverified Commit 4c2f7eec authored by Todd Dembrey's avatar Todd Dembrey Committed by GitHub
Browse files

Merge pull request #34 from OpenTechFund/fabfile-pre-production

fabfile tweaks
parents d353da02 71de9e2c
No related branches found
No related tags found
No related merge requests found
...@@ -49,7 +49,7 @@ def pull_production_media(): ...@@ -49,7 +49,7 @@ def pull_production_media():
@roles('staging') @roles('staging')
def deploy_staging(): def deploy_staging():
_build_static() _build_static(build_branch='staging')
_deploy_static() _deploy_static()
run('git pull') run('git pull')
...@@ -84,6 +84,22 @@ def pull_staging_media(): ...@@ -84,6 +84,22 @@ def pull_staging_media():
local('rsync -avz %s:\'%s\' /vagrant/media/' % (env['host_string'], '$CFG_MEDIA_DIR')) local('rsync -avz %s:\'%s\' /vagrant/media/' % (env['host_string'], '$CFG_MEDIA_DIR'))
@roles('pre-production')
def deploy_pre_production():
_build_static()
_deploy_static()
run('git pull')
run('pip install -r requirements.txt')
_run_migrate()
run('django-admin collectstatic --noinput')
# 'restart' should be an alias to a script that restarts the web server
run('restart')
_post_deploy()
@runs_once @runs_once
def _pull_data(env_name, remote_db_name, local_db_name, remote_dump_path, local_dump_path): def _pull_data(env_name, remote_db_name, local_db_name, remote_dump_path, local_dump_path):
timestamp = datetime.now().strftime('%Y%m%d-%I%M%S') timestamp = datetime.now().strftime('%Y%m%d-%I%M%S')
...@@ -153,9 +169,8 @@ def _post_deploy(): ...@@ -153,9 +169,8 @@ def _post_deploy():
@runs_once @runs_once
def _build_static(): def _build_static(build_branch='master'):
# Build a specific branch # Build a specific branch
build_branch = 'master'
current_branch = local('git rev-parse --abbrev-ref HEAD', capture=True) current_branch = local('git rev-parse --abbrev-ref HEAD', capture=True)
if current_branch != build_branch: if current_branch != build_branch:
raise RuntimeError("Please switch to '{}' before deploying".format(build_branch)) raise RuntimeError("Please switch to '{}' before deploying".format(build_branch))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment