"""
Connection information for the local machine
"""
+ def _custom_local(command):
+ prefixed_command = '/bin/bash -l -i -c "%s"' % command
+ return local(prefixed_command)
+ env.run = _custom_local
# This is required for the same reason as above
- env.proj_dir = os.getcwd()
- env.proj_root = os.path.dirname(env.proj_dir)
+ env.proj_root = '/var/www/karmaworld'
env.cd = lcd
env.reqs = 'reqs/dev.txt'
- env.confs = 'confs/stag/'
+ env.confs = 'confs/beta'
env.branch = 'beta'
- env.run = virtenv_exec
env.user = 'djkarma'
env.hosts = ['karmanotes.org']
env.proj_root = '/var/www/karmaworld'
- env.proj_dir = '/var/www/karmaworld'
env.reqs = 'reqs/prod.txt'
- env.confs = 'confs/beta/'
+ env.confs = 'confs/prod/'
env.branch = 'beta'
env.run = virtenv_exec
env.gunicorn_addr = '127.0.0.1:8000'
env.user = 'djkarma'
env.hosts = ['beta.karmanotes.org']
env.proj_root = '/var/www/karmaworld'
- env.proj_dir = '/var/www/karmaworld'
- env.reqs = 'reqs/beta.txt'
- env.confs = 'confs/beta/'
+ env.reqs = 'reqs/prod.txt'
+ env.confs = 'confs/prod/'
env.branch = 'beta'
env.run = virtenv_exec
- env.gunicorn_addr = '127.0.0.1:8000'
######## Run Commands in Virutal Environment
def virtenv_exec(command):
Execute command in Virtualenv
"""
- with virtualenv('%s/%s' % (env.proj_dir, env.branch)):
+ with virtualenv('%s/%s' % (env.proj_root, env.branch)):
run('%s' % (command))
######## Sync database
Sync Database
"""
- env.run('%s/manage.py syncdb --noinput --migrate' % env.proj_dir )
+ env.run('%s/manage.py syncdb --migrate' % env.proj_root )
####### Collect Static Files
@task
def collect_static():
"""
- Collect static files (if AWS config. present, push to S3
+ Collect static files (if AWS config. present, push to S3)
"""
- env.run('%s/manage.py collectstatic --noinput' % env.proj_dir )
+ env.run('%s/manage.py collectstatic --noinput' % env.proj_root )
####### Run Dev Server
@task
Runs the built-in django webserver
"""
- env.run('%s/manage.py runserver' % env.proj_dir )
+ env.run('%s/manage.py runserver' % env.proj_root)
####### Create Virtual Environment
@task
"""
run('virtualenv %s/%s' % (env.proj_root, env.branch))
- env.run('pip install -r %s/reqs/%s.txt' % (env.proj_dir, env.branch) )
+ env.run('pip install -r %s/reqs/%s.txt' % (env.proj_root, env.branch) )
@task
def start_supervisord():
####### Pull new code
@task
def update_code():
- env.run('cd %s; git pull' % env.proj_dir)
+ env.run('cd %s; git pull' % env.proj_root )
+
+@task
+def backup():
+ """
+ Create backup using bup
+ """
+@task
+def first_deploy():
+
+ """
+ Sets up and deploys the project for the first time.
+ """
+ make_virtualenv()
+ update_reqs()
+ syncdb()
+ manage_static()
+ start_supervisord()
+
+@task
+def deploy():
+ """
+ Deploys the latest changes
+ """
+ update_code()
+ update_reqs()
+ syncdb()
+ collect_static()
+ restart_supervisord()
+########## END COMMANDS