2012-03-12 21:16:19 -07:00
|
|
|
from fabric.api import cd, local, env, run, sudo
|
2011-10-23 20:13:37 -07:00
|
|
|
|
2012-04-26 19:49:43 -07:00
|
|
|
import datetime
|
|
|
|
|
2011-10-23 20:07:59 -07:00
|
|
|
|
2012-04-08 14:41:25 -07:00
|
|
|
env.hosts = ['nick@snipt.net:39039']
|
2012-03-05 13:48:03 -08:00
|
|
|
env.site_path = '/var/www/snipt'
|
2012-03-05 13:57:18 -08:00
|
|
|
env.venv_path = '/home/nick/.virtualenvs/snipt'
|
2012-01-25 07:20:52 -08:00
|
|
|
|
2012-03-05 13:57:18 -08:00
|
|
|
def _python(cmd):
|
|
|
|
return env.venv_path.rstrip('/') + '/bin/python ' + cmd
|
|
|
|
|
|
|
|
def deploy(m):
|
2012-03-05 13:48:03 -08:00
|
|
|
local('python manage.py collectstatic --ignore grappelli --ignore admin --noinput')
|
2012-03-05 13:57:18 -08:00
|
|
|
|
|
|
|
try:
|
2012-03-05 13:57:36 -08:00
|
|
|
local("hg commit -m '{}'".format(m))
|
2012-03-05 13:57:18 -08:00
|
|
|
except:
|
|
|
|
pass
|
2012-04-07 16:17:27 -07:00
|
|
|
try:
|
|
|
|
local('hg push')
|
|
|
|
except:
|
|
|
|
pass
|
2012-03-05 13:57:18 -08:00
|
|
|
|
2012-03-05 13:48:03 -08:00
|
|
|
with cd(env.site_path):
|
|
|
|
run('hg pull -u')
|
2012-03-05 13:57:18 -08:00
|
|
|
run(_python('manage.py collectstatic --ignore grappelli --ignore admin --noinput'))
|
|
|
|
|
2012-03-12 21:16:19 -07:00
|
|
|
def re():
|
|
|
|
sudo('rc.d restart memcached')
|
|
|
|
with cd(env.site_path):
|
|
|
|
run('/var/www/snipt/gk')
|
|
|
|
run('/var/www/snipt/gs')
|
2012-04-26 19:49:43 -07:00
|
|
|
|
|
|
|
def db_backup():
|
|
|
|
|
|
|
|
filename = datetime.datetime.now().strftime('%m-%d-%y')
|
|
|
|
|
|
|
|
print filename
|
|
|
|
|
|
|
|
#run('pg_dump snipt > snipt.pgdump')
|
|
|
|
|
|
|
|
#conn = S3Connection('AKIAJJRRQPTSPKB7GYOA', 'DIYz2g5vPjcWE4/YI7wEuUVAskwJxs2llFvGyI1a')
|
|
|
|
#snipt_bucket = conn.get_bucket('snipt')
|
|
|
|
|
|
|
|
#k = Key(snipt_bucket)
|
|
|
|
#k.set_contents_from_filename('snipt.pgdump')
|