Added fabfile for easy deployment.

rtd2
Eric Holscher 2010-08-28 14:21:36 -05:00
parent 8f44e32f32
commit 6e1ea9db04
1 changed files with 29 additions and 0 deletions

29
fabfile.py vendored Normal file
View File

@ -0,0 +1,29 @@
import datetime
from fabric.api import *
from fabric.contrib import files, console
env.runtime = 'production'
env.hosts = ['readthedocs.org']
env.user = 'docs'
env.code_dir = '/home/docs/sites/readthedocs.com/checkouts/tweezers'
env.virtualenv = '/home/docs/sites/readthedocs.com'
env.rundir = '/home/docs/sites/readthedocs.com/run'
def update_requirements():
"Update requirements in the virtualenv."
run("%s/bin/pip install -r %s/pip_requirements.txt" % (env.virtualenv, env.code_dir))
def push():
"Push new code, but don't restart/reload."
local('git push origin master')
with cd(env.code_dir):
run('git pull origin master')
def reload():
"Reload the server."
with cd(env.code_dir):
run("kill -HUP `cat %s/gunicorn.pid`" % env.rundir)
def restart():
"Restart (or just start) the server"
run("~/run_gunicorn.sh")