Created
January 19, 2012 04:33
-
-
Save boralyl/1637931 to your computer and use it in GitHub Desktop.
Fabfile Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import with_statement | |
from fabric.api import * | |
env.roledefs = { | |
'production': ['[email protected]'], | |
'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