Commit ecc7ec0d authored by Nikolai R Kristiansen's avatar Nikolai R Kristiansen

馃殌 Add fabfile for easier deployment

parent 1d7860df
import os
from fabric import Connection
from invoke import task
@task()
def deploy(c):
"""Make sure proxy_user is set to your neuf username."""
project_path = '/opt/mdb'
proxy_user = os.getenv('DEPLOY_USER', os.getenv('USER'))
c = Connection(host='gitdeploy@sega.neuf.no', gateway=Connection('login.neuf.no', user=proxy_user))
with c.cd(project_path), c.prefix('source {}/venv/bin/activate'.format(project_path)):
c.run('git pull') # Get source
c.run('pip install -U pip')
c.run('pip install -r requirements.txt') # install deps in virtualenv
c.run('python manage.py collectstatic --noinput') # Collect static
c.run('python manage.py migrate') # Run DB migrations
# Reload gunicorn
c.sudo('/usr/bin/supervisorctl pid mdb.neuf.no | xargs kill -HUP', shell=False)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment