Created
March 8, 2012 18:49
-
-
Save pix0r/2002643 to your computer and use it in GitHub Desktop.
Sample Fabric environment setup
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 fabric.api import env, run | |
from fabric.contrib.project import rsync_project | |
try: | |
from fabfile_local import * | |
except ImportError, e: | |
environments = { | |
"dev": { | |
"hosts": ["localhost"], | |
}, | |
} | |
print "You can customize environments with fabfile_local.py" | |
def e(name='dev'): | |
print "Setting environment", name | |
env.update(environments[name]) | |
env.environment = name | |
def host_type(): | |
run('uname -s') | |
def rsync(remote_dir='/srv/myproject/'): | |
rsync_project( | |
remote_dir="/srv/myproject/", | |
local_dir="./", | |
exclude=("*_local.py", "*.pyc",), | |
) | |
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
environments = { | |
"staging": { | |
"hosts": [ | |
"[email protected]", | |
"[email protected]", | |
], | |
}, | |
"production": { | |
"hosts": [ | |
"[email protected]", | |
"[email protected]", | |
], | |
}, | |
} |
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
fab e:production host_type | |
fab e:staging rsync |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment