Merge pull request #211 from efagin/master

Deployment improvements
This commit is contained in:
David Buxton 2015-04-05 14:44:54 -04:00
commit a9820f0818
2 changed files with 6 additions and 6 deletions

10
fabfile.py vendored
View File

@ -42,24 +42,24 @@ def run_migrations(deploy_path=DEPLOY_PATH):
with cd(deploy_path):
with prefix("source {venv}/bin/activate".format(venv=VENV_DIR)):
sudo(
"foreman run python manage.py syncdb -e conf/{env}.env".format(env=env.deploy_version))
"foreman run -e conf/{env}.env python manage.py syncdb".format(env=env.deploy_version))
sudo(
"foreman run python manage.py migrate cabotapp --noinput -e conf/{env}.env".format(env=env.deploy_version))
"foreman run -e conf/{env}.env python manage.py migrate cabotapp --noinput".format(env=env.deploy_version))
# Wrap in failure for legacy reasons
# https://github.com/celery/django-celery/issues/149
print "You can ignore an error message regarding 'relation \"celery_taskmeta\" already exists'"
with settings(warn_only=True):
sudo(
"foreman run python manage.py migrate djcelery --noinput -e conf/{env}.env".format(env=env.deploy_version))
"foreman run -e conf/{env}.env python manage.py migrate djcelery --noinput".format(env=env.deploy_version))
def collect_static(deploy_path=DEPLOY_PATH):
with cd(deploy_path):
with prefix("source {venv}/bin/activate".format(venv=VENV_DIR)):
sudo(
"foreman run python manage.py collectstatic --noinput -e conf/{env}.env".format(env=env.deploy_version))
"foreman run -e conf/{env}.env python manage.py collectstatic --noinput".format(env=env.deploy_version))
sudo(
"foreman run python manage.py compress -e conf/{env}.env".format(env=env.deploy_version))
"foreman run -e conf/{env}.env python manage.py compress".format(env=env.deploy_version))
def setup_upstart(deploy_path=DEPLOY_PATH):

View File

@ -3,4 +3,4 @@ stop on stopping <%= app %>-<%= name %>
respawn
respawn limit 50 5
exec su - <%= user %> -c 'cd <%= engine.root %>; export PORT=<%= port %>;<% engine.env.each_pair do |var,env| %> export <%= var.upcase %>="<%= env %>"; <% end %> export TMPDIR=$TMPDIR/<%= app %>/<%= name %>/<%= num %>; rm -rf $TMPDIR; mkdir -p $TMPDIR; source $VENV/bin/activate; <%= process.command %> >> <%= log %>/<%=name%>-<%=num%>.log 2>&1'
exec su - <%= user %> -c 'cd <%= engine.root %>; export PORT=<%= port %>;<% engine.env.each_pair do |var,env| %> export <%= var.upcase %>='\''<%= env %>'\''; <% end %> export TMPDIR=$TMPDIR/<%= app %>/<%= name %>/<%= num %>; rm -rf $TMPDIR; mkdir -p $TMPDIR; source $VENV/bin/activate; <%= process.command %> >> <%= log %>/<%=name%>-<%=num%>.log 2>&1'