Skip to content

Instantly share code, notes, and snippets.

@johnie
Created January 11, 2015 20:37
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 johnie/cf553bc4bb2e86d3ddc5 to your computer and use it in GitHub Desktop.
Save johnie/cf553bc4bb2e86d3ddc5 to your computer and use it in GitHub Desktop.
Simple Fabric deploy
from __future__ import with_statement
import os.path
from fabric.api import *
from fabric.contrib.project import *
"""
Environments
"""
def prod():
env.hosts = ['ssh.host.com']
env.user = 'sshmaster'
env.path = 'path/to/prod-folder'
"Default deploy to prod"
prod()
def stage():
env.hosts = ['ssh.host.com']
env.user = 'sshmaster'
env.path = 'path/to/stage-folder'
"""
Deployment
"""
def deploy():
require('path', provided_by=[prod])
extra_opts = '--omit-dir-times --no-perms'
rsync_project(
env.path,
'%s/' % os.path.dirname(__file__),
['log/*', 'cache/*', '.git', '.DS_Store', 'Gulpfile.js', 'fabfile.py*', 'node_modules/', 'bower_components/'],
False,
extra_opts=extra_opts,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment