Skip to content

Instantly share code, notes, and snippets.

@boralyl
Created January 19, 2012 04:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boralyl/1637931 to your computer and use it in GitHub Desktop.
Save boralyl/1637931 to your computer and use it in GitHub Desktop.
Fabfile Example
from __future__ import with_statement
from fabric.api import *
env.roledefs = {
'production': ['user@domain.com'],
'localhost': ['user@localhost'],
}
REMOTE_APP_DIR = "/path/to/remote/app"
REMOTE_APACHE_DIR = "/path/to/apache/dir"
@roles('production')
def deploy():
version = prompt("Please specify a version to tag this release:")
local("hg tag -m 'Tagged %s' %s" % (version, version))
local("hg push")
with(cd(REMOTE_APP_DIR)):
run("hg update; hg pull;")
run("hg update %s" % (version, ))
run("python2.5 manage.py migrate --all")
with(cd(REMOTE_APACHE_DIR)):
run("bin/stop")
run("sleep 1")
run("bin/start")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment